Re: [PyOpenGL-Users] Difficulty with the shaders tutorial
Brought to you by:
mcfletch
From: Derakon <de...@gm...> - 2012-02-16 19:10:09
|
On further investigation, those functions weren't available because I didn't have an OpenGL context yet. My bad. Moving the set-up to later on in the program (the first paint call) instead gives these errors: RuntimeError: ('Shader compile failure (0): 0(3) : error C7533: global variable gl_ModelViewProjectionMatrix is deprecated after version 120\n0(3) : error C7533: global variable gl_Vertex is deprecated after version 120\n', ['#version 330\n void main() {\n gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n }'], GL_VERTEX_SHADER) Feel free to correct me, but it looks like this means that the tutorial is using deprecated concepts? GL_VERSION is 3.3.0 and GL_SHADER_VERSION is "3.30 NVIDIA via Cg compiler", for what it's worth. -Chris On Thu, Feb 16, 2012 at 10:05 AM, Derakon <de...@gm...> wrote: > I'm trying to figure out OpenGL 3. Well, really I'm trying to figure > out fragment shaders so I can do a false-color filter for my > monochrome camera displays, but the fragment shader tutorial is also > an OpenGL 3 tutorial, so it's off the deep end I go. I took a look at > the shaders tutorial: > http://pyopengl.sourceforge.net/context/tutorials/shader_1.xhtml > > The first problem I run into is literally a context problem: I have no > idea what the high-level structure of the tutorial is because it's > broken up into chunks of a few lines at a time separated by > explanatory text. That'd be fine if the script were repeated without > those interruptions at some point, or if the chunks of program were > bigger, but as it stands the code part of the tutorial is very hard to > read. > > The second problem I have is also a context problem: OpenGLContext > doesn't exist for me. I have a standard Windows Python 2.7 / PyOpenGL > / numpy install. Fortunately I have some prior experience with OpenGL > and guess that I can work around this by using WX rendering contexts > instead. So I adapt the tutorial script to this standalone program: > http://pastebin.com/KWwi1Ahi > > However, when I run this, I get the following error when the first > call to shaders.compileShader is made: > OpenGL.error.NullFunctionError: Attempt to call an undefined alternate > function (glCreateShader, glCreateShaderObjectARB), check for > bool(glCreateShader) before calling > > Amusingly, calling glGetBoolean(glCreateShader) throws *another* error: > KeyError: ('Unknown specifier > <OpenGL.platform.baseplatform.glCreateShader object at > 0x00000000031360F0>', 'Failure in cConverter > <OpenGL.converters.SizedOutput object at 0x0000000002E27748>', > (<OpenGL.platform.baseplatform.glCreateShader object at > 0x00000000031360F0>,), 1, <OpenGL.wrapper.glGetIntegerv object at > 0x000000000305D4C8>) > > -Chris |