Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Transform Feedback with Delphi and nVidia CG

  1. #1
    Intern Contributor
    Join Date
    Nov 2011

    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:

    Code :
    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:

    Code :
    var program : GLuint;
    program := cgCreateProgramFromFile( ... );
    ...cgGLGetNamedParameter( ... );
    IF [B][COLOR=#ff0000]glIsProgram[/COLOR][/B]( program ) THEN [B][COLOR=#ff0000]glTransformFeedbackVaryings[/COLOR][/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!
    Last edited by tdname; 10-04-2012 at 12:53 PM.

  2. #2
    Intern Contributor
    Join Date
    Nov 2011
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts