I have written a very basic shader and am trying to get it to run. I can load and compile the vertex shader and the fragment shader. When linking, however, the log returns : “error C3001: no program defined”
Here is my code snipper
// Create an empty program object
PFNGLCREATEPROGRAMOBJECTARBPROC programObject =
(PFNGLCREATEPROGRAMOBJECTARBPROC) wglGetProcAddress("glCreateProgramObjectARB");
program_handle = programObject();
// Now attach the vertex and fragment shaders to this program object
PFNGLATTACHOBJECTARBPROC attachObject =
(PFNGLATTACHOBJECTARBPROC) wglGetProcAddress("glAttachObjectARB");
attachObject( program_handle, vertex_shader_handle );
attachObject( program_handle, fragment_shader_handle );
// Now link it all together to send to the GPU
PFNGLLINKPROGRAMARBPROC linkObjects =
(PFNGLLINKPROGRAMARBPROC) wglGetProcAddress("glLinkProgramARB");
linkObjects( program_handle );
// see if we had any errors
int result=-1;
PFNGLGETOBJECTPARAMETERIVARBPROC getObjectParamI =
(PFNGLGETOBJECTPARAMETERIVARBPROC) wglGetProcAddress("glGetObjectParameterivARB");
getObjectParamI( program_handle, GL_OBJECT_LINK_STATUS_ARB, &result );
if( result == GL_FALSE )
{
Log( Fmt("Could not link the specified objects. See log for details."));
PFNGLGETINFOLOGARBPROC getLogInfo =
(PFNGLGETINFOLOGARBPROC) wglGetProcAddress("glGetInfoLogARB");
getLogInfo( program_handle, 1024, &length, log );
Log(Fmt("%s", log) );
}
Is there something wrong here ? I have defined the vertex_shader_handle, fragment_shader_handle and program_handle as member variables of my class and they have been initialized appropriately.
and here is the code to compile the shaders.
I have also added the code to validate the program object after attaching the shaders, and that returns success !!