0
我試過texture_2D來推動我的立方體上的紋理。那沒問題。PyOpenGL多維數據集貼圖紋理
但是當我使用TEXTURE_CUBE_MAP紋理是不可見的。只是一個黑色立方體。
任何人都可以幫助我嗎?
#### INIT FUNCTION
textureIDs = glGenTextures(1)
glBindTexture(GL_TEXTURE_CUBE_MAP, textureIDs)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, imgRaw.size[0], imgRaw.size[1], 0, GL_RGB, GL_UNSIGNED_BYTE, img)
..... (for the other five also)
####DISPLAY FUNCTION
glEnable(GL_TEXTURE_GEN_S)
glEnable(GL_TEXTURE_GEN_T)
glEnable(GL_TEXTURE_GEN_R)
glEnable(GL_TEXTURE_CUBE_MAP)
glEnableClientState(GL_VERTEX_ARRAY)
myVBO.bind()
glUseProgram(program) #shader frag and vert
varLocation = glGetUniformLocation(program, "mvpMatrix")
glUniformMatrix4fv(varLocation , 1, GL_TRUE, mvpMat.tolist())
glVertexPointer(3, GL_FLOAT, 32, myVBO)
glBindTexture(GL_TEXTURE_CUBE_MAP, textureIDs)
glDrawArrays(GL_QUADS, 0 ,len(data))
myVBO.unbind()