I am developing application for my University project where I am doing anaglyph rendering.
In my project I am using:
[li]FREEGLUT[/li][li]Using OpenGL 3.3 with Shaders #330[/li][li]Using C++[/li][/ul]
I am a beginner with OpenGL API, but I think I have learned the basics so please bear that in mind.
So the problem I am having with is the function
glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE);
which causes unwanted transparancy between different objects rendered.
My rendering function follows like this (I am also using face culling):
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearDepth(1.0f); glClear(clearOptions | GL_DEPTH_BUFFER_BIT); glUseProgram(shaderProgram); // Sets active the left eye perspective matrix // draw scene glClear(GL_DEPTH_BUFFER_BIT); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); // Sets active the right eye perspective matrix // draw scene glUseProgram(0); glutSwapBuffers(); glutPostRedisplay();
In the attachments I have highlighted the problematic areas.
My question is what can I do so that the blending only happens with the two images of the same object (since I am doing anaglyph rendering, I have to render each object twice, I want the blending to happen only with these two images for each object).
I hope I was clear enough, if you need more information then please ask.