Hallo,
for three days I try to texture my objects without succeed …
My work is based on the good understandable “NeHe”-Tutorial. Unmodified all sources of this tutorial run very well but when I edit the texture-section it drops out …
here is my source:
Traceback (most recent call last):
File “texturetest.py”, line 182, in ?
main()
File “texturetest.py”, line 178, in main
InitGL(1024, 768)
File “texturetest.py”, line 121, in InitGL
LoadTextures() #texture
File “texturetest.py”, line 109, in LoadTextures
glTexImage2D(GL_TEXTURE_2D, 0, 3, 150, 150, 0, GL_RGBA, GL_UNSIGNED_BYTE, image)
OpenGL.GL.GLerror: [Errno 1281] invalid value
Sadly I never found an example or a documentation of “glTexImage2D” I realy understand
That’s easy, glTexImage width and height need to be power of two values, 150 is not.
Other things:
Instead of the internalFormat parameter set to three, you should use GL_RGB8.
You have an GL_RGBA source image, are you sure you don’t need the alpha in the internalFormat? It would be GL_RGBA8 then.
Don’t set the glTexParameter for WRAP_S and _T twice, only the last will be used.
Of course I set 150 two times (for width and height)
I typed “GL_RGB8” in the internalFormat-section and deleted the needless WRAP_S and _T glTextParameters but it does not run now (same error) !?
width and height must be powers of two. that means 2^x = width and 2^x = height. x must be an integer type.
you cannot find any integer x for 2^x = 150. thats why opengl is complaining.
try a width and a height of 128 or 256 (that are powers of two, x = 7 or 8). width and height dont have to be the same but both values MUST be powers of two. powers of two!