opengl_tutorials_python
opengl_tutorials_python copied to clipboard
Rewrite of Tutorial5 texture loading code
Also being new to opengl I had no idea how to fix the error I was getting under tutorial5.
I rewrote the texture loading code based on the original C++ (and some stackoverflow code on using PIL with textures).
The code in this pull request shows the textured cube in linux + mesa.
The error I was getting with the original code is this:
$ python tutorial5.py
Compiling shader: Shaders/Tutorial5/TransformVertexShader.vertexshader
Compiling shader: Shaders/Tutorial5/TextureFragmentShader.fragmentshader
Linking program
Traceback (most recent call last):
File "tutorial5.py", line 318, in <module>
main()
File "tutorial5.py", line 160, in main
texture = load_image("Content/uvtemplate.bmp")
File "tutorial5.py", line 113, in load_image
bind_texture(texture_id,'MIN_FILTER')
File "tutorial5.py", line 81, in bind_texture
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)
File "/mnt/data/home/stu/.virtualenvs/3d/local/lib/python2.7/site-packages/OpenGL/platform/baseplatform.py", line 402, in __call__
return self( *args, **named )
File "/mnt/data/home/stu/.virtualenvs/3d/local/lib/python2.7/site-packages/OpenGL/error.py", line 232, in glCheckError
baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 1280,
description = 'invalid enumerant',
baseOperation = glTexParameterf,
cArguments = (
GL_TEXTURE_2D,
GL_TEXTURE_WRAP_S,
GL_CLAMP,
)
)