Apart from needing to call glUseProgram before you can ask its uniform location, your vertex or fragment shader also needs to use the variables in the shader itself. If you don't use them, the shader-compiler will optimize the program so that the variable doesn't exist (since it's not used anyway, it wouldn't really matter), thereby saving memory. The uniform location of a shader variable which doesn't exist or is not used is -1.

Not defining the version of the shader afaik doesn't really matter on Windows or Linux, except for special cases, however on Mac OS X you hardly can do without. Mac OS X is quite strict in things like that. You need to define the extensions you use as well, even though Windows and Linux both have no problem if you don't specify them. (I think it does give you a warning of some sorts though).

Regards, Gijs

PS: You don't have to put GLUT. or GL. in front of every call to glut or the GL. Since you imported them, you have direct access to the functions defined in glut and the GL.

On 8/26/09 20:39 , Ian Mallett wrote:
Firstly, you probably don't want to specify the version in the vertex shader unless you're sure of your system.  I also don't know what happens if you don't specify anything under the main function.  Try using: "void main { gl_Position = ftransform(); }".  As to your problem, I presume the uniform location is returning -1?  You need to use the shader before you can query values from it.  I think it's glUseProgram()

------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

_______________________________________________ PyOpenGL Homepage http://pyopengl.sourceforge.net _______________________________________________ PyOpenGL-Users mailing list PyOpenGL-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyopengl-users