Jump to content
  • Advertisement
Sign in to follow this  
AverageJoeSSU

OpenGL Black screen with multiple shaders

This topic is 3852 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.
....

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");


Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!