....
light[0]->Render();
.....
glPushMatrix();
glMultMatrixf(BuildMatrix().m);
RC.LightRender();
glPopMatrix();
....
......
cgGLSetStateMatrixParameter(Lighting->myLRModelViewProj, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY);
glBindTexture(GL_TEXTURE_2D,Lighting->Pos0);
cgGLSetTextureParameter(Lighting->myCgFragmentParam_Pos, Lighting->Pos0);
glBindTexture(GL_TEXTURE_2D,Lighting->Norm1);
cgGLSetTextureParameter(Lighting->myCgFragmentParam_Nor, Lighting->Norm1);
glBindTexture(GL_TEXTURE_2D,Lighting->Diff2);
cgGLSetTextureParameter(Lighting->myCgFragmentParam_Dif, Lighting->Diff2);
Lighting->EnableLightShaders();
cgUpdateProgramParameters(Lighting->myLRFragmentProgram);
cgUpdateProgramParameters(Lighting->myLRVertexProgram);
//glBindTexture(GL_TEXTURE_2D, Lighting->Diff2); // this works
drawScreenQuad();
Lighting->DisableLightShaders();
.....
//My enabling function
cgGLEnableProfile(myLightCgVertexProfile);
checkForCgError("enabling vertex profile");
cgGLBindProgram(myLRVertexProgram);
checkForCgError("binding vertex program");
cgGLEnableProfile(myLightCgFragmentProfile);
checkForCgError("enabling fragment profile");
cgGLBindProgram(myLRFragmentProgram);
checkForCgError("binding fragment program");
}
//disabling function
cgGLDisableProfile(this->myLightCgVertexProfile);
checkForCgError("disabling vertex profile");
cgGLDisableProfile(this->myLightCgFragmentProfile);
checkForCgError("disabling fragment profile");
Black screen with multiple shaders
i am trying to implement a mulitpass system with OpenGL, however i am getting a black screen when i use my second set of shaders.
I have gone through the code a ton of times and cant see whats up.
i am using the same profiles for both shaders
when i bind the off-screen buffers as a texture and then draw the quad, it looks fine.
But when i pass them into the second set of shaders and try to output them through the shader (should look the same as binding and then drawing), i get a black screen!
do i need to unbind cg programs??
here is some of the code... you can assume the textures are filled.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement