#225 glShaderSource wrapper fail on ATI card ?

v2.0
closed-fixed
GL (74)
5
2010-02-22
2010-01-19
Anonymous
No

Hi everyone,

I got a problem on my framework with Shader + ATI card. By switching from pyglet to pyopengl, shader just not working anymore. After investigation, it seem that the wrapper on glShaderSource is not working properly.

If i use the pyopengl wrapper (glShaderSource(shader, source)), i got an error at glLinkProgram() :
Fragment shader was successfully compiled to run on hardware.
Fragment shader(s) failed to link, vertex shader(s) failed to link.
ERROR: 1:1: error(#132) Syntax error: 'v' parse error
ERROR: error(#273) 1 compilation errors. No code generated
ERROR: 1:1: error(#132) Syntax error: 'v' parse error
ERROR: error(#273) 1 compilation errors. No code generated

If i'm doing ctype myself like:
glShaderSource = platform.createBaseFunction(
'glShaderSource', dll=platform.GL,
resultType=None,
argTypes=(constants.GLhandle, constants.GLsizei, ctypes.POINTER(ctypes.c_char_p), arrays.GLintArray,),
doc = 'glShaderSource( GLhandle(shaderObj), str( string) ) -> None',
argNames = ('shaderObj', 'count', 'string', 'length',),
)

from ctypes import *
source = c_char_p(source)
length = c_int(-1)
glShaderSource(shader, 1, byref(source), byref(length))

-> no more error message at glLinkProgram.

Where i can debug more the wrapper function ? Is it a converter problem ?

Thanks,

Mathieu

Note: i'm running the 3.0.0-0ubuntu1 from Ubuntu Karmic.

Discussion

    • status: open --> closed-fixed
     
  • This is almost certainly the case where you are specifying the source as a single string. The function actually takes a list-of-strings. Some implementations work perfectly well with the sequence-of-one-character-strings (concatenating them before compiling), others run the syntax check/compile before concatenation.

    I've just added code to convert to a list before doing the conversion if you pass in a string. Hopefully this will avoid these problems in the future.