Transform Feedback with Delphi and nVidia CG

Hello guys!
I need to implement Transform Feedback in my application.
I would like to use it to read (from CPU) new vertice’s position after Vertex Shader Skinning (bones, vertices, weight, etc…) to be able to select body’s pieces, calculate frustum culling and collision during model’s animation.

I’ve found many examples but I’m unable to call few functions in my application.
This is one example I’ve found:


GLuint program = glCreateProgram();
glAttachShader( program, vertexShader );
glAttachShader( program, fragmentShader );
GLchar const * Strings[] = {"gl_Position"};
glTransformFeedbackVaryings(program, 1, Strings, GL_SEPARATE_ATTRIBS);
glLinkProgram( program );

In Delphi+nVidiaCG I’ve something like this:


var program : GLuint;

program := cgCreateProgramFromFile( ... );
...cgGLGetNamedParameter( ... );
IF [b]glIsProgram[/b]( program ) THEN [b]glTransformFeedbackVaryings[/b]( program ... )
else MessageBox('Error', 'Error 1', MB_ICONERROR);
...cgGLLoadProgram( ... );
...cgGLBindProgram( ... );
...cgGLEnableProfile( ... );
glDrawArrays( ... )

When I pass “program” variable to GL* functions I gen an Exception/Error and my application crashes immediatly with error window.
No any special error, just a general Memory Exception.
But my “program” variable is REALLY valid because I use it continously during program execution (always in CG* functions) to enable Shader, pass Vertices Attributes, etc…

My trouble is: can I use GL* functions with nVidia CG* ones like I’ve explained??

Maybe with GL* (for native GLSL usage) functions like “glCompileShader()” it could be simple…but I don’t want to renew all my code and shaders, and I like nVidia CG…

Is there a substitute of those “incompatible” functions?

Sorry for my bad English and thanks in advance!

I’ve changed all my code to use GLSL instead of nVidia’s CG.
Now calling that function doesn’t crashes my application.

So I suppose CG’s program_id is something different from GLSL’s program_id.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.