Error: There is an error!

  • Kinda bored with some spared time today I decide to play around with some OpenGL CG Shader stuff. Never really done anything with it and I just love 3D graphics.

    Not surprisingly my first CG shader program contains an error somwhere (still need to figure out what I messed up). So I figure I'll ask the API for a clue as to what I did wrong. After all, there are these two handy functions, cgGetError and cgGetErrorString right? They should tell me what I need to know, right? Riiiighhtt??


    Thanks! Why not tell me something I don't already know!? As an added bit of info, function which compiles the source file returns NULL if there is a problem. So I was already aware there is a compiler error before calling cgGetError and receiving that exceedingly useful message.

  • NAME
    cgGetLastListing − get the current listing text

    #include <Cg/cg.h>
    const char * cgGetLastListing( CGcontext context );

    context The context handle.

    Returns a NULL-terminated string containing the current listing text.
    Returns NULL if no listing text is available, or the listing text string is empty.
    In all cases, the pointer returned by cgGetLastListing is only guaranteed to be valid until the next Cg entry
    point not related to error reporting is called. For example, calls to cgCreateProgram, cgCompileProgram,
    cgCreateEffect, or cgValidateTechnique will invalidate any previously-returned listing pointer.

    Each Cg context maintains a NULL-terminated string containing warning and error messages generated by
    the Cg compiler, state managers and the like
    . cgGetLastListing allows applications and custom state
    managers to query the listing text.
    cgGetLastListing returns the currrent listing string for the given CGcontext. When a Cg runtime error
    occurs, applications can use the listing text from the appropriate context to provide the user with detailed
    information about the error.


    CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.

    cgGetLastListing was introduced in Cg 1.1.

    cgSetLastListing, cgCreateContext, cgSetErrorHandler

  • Oh cool, thanks for the info

    I did end up switching to GLSL however and have things working wonderfully with that, but still, if I do mess with CG again that'll be very handy to keep in the back of my mind.

     Appreciate it!

Log in to reply

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.