I am playing around with lesson6.py in the demo files (ported to PyOpenGL 2.0 by Tarn Weiser Burton, original source C based turtorial at nehe.gamedev.net).
When I replace the "NeHe.bmp" file with other bmp files (of similar size) I get the following error:
File "lesson6.py", line 76, in LoadTextures
glTexImage2D(GL_TEXTURE_2D, 0, 3, ix, iy, 0, GL_RGBA, GL_UNSIGNED_BYTE, image)
OpenGL.GL.GLerror: [Errno 1281] invalid value
>Exit code: 1
I have checked the manpages for glTexImage2D for the error INVALID_VALUE (I believe this is correct), but I am unable to figure out the source of the error.
Has anyone else seen this problem ? Do I need to perform some error checks on the bmp format prior to calling glTexImage2D ? I am new to Opengl.
An extract from the source code (lesson6.py is below)
Thanks
Ian Krepps
Ian...@rm...
def LoadTextures():
#global texture
image = open("NeHe.bmp")
ix = image.size[0]
iy = image.size[1]
image = image.tostring("raw", "RGBX", 0, -1)
# Create Texture
glBindTexture(GL_TEXTURE_2D, glGenTextures(1)) # 2d texture (x and y size)
glPixelStorei(GL_UNPACK_ALIGNMENT,1)
glTexImage2D(GL_TEXTURE_2D, 0, 3, ix, iy, 0, GL_RGBA, GL_UNSIGNED_BYTE, image)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL)
|