Skip to content

Rewrite of Tutorial5 texture loading code#2

Open
stuaxo wants to merge 5 commits intoJerdak:masterfrom
stuaxo:tutorial5
Open

Rewrite of Tutorial5 texture loading code#2
stuaxo wants to merge 5 commits intoJerdak:masterfrom
stuaxo:tutorial5

Conversation

@stuaxo
Copy link

@stuaxo stuaxo commented Aug 5, 2015

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,
    )
)

stuaxo added 5 commits August 5, 2015 22:38
Use / in paths to shaders.
Window hint for 3.3 context needs to happen before window creation.
Re-wrote texture loader.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant