Hi,
I have build a simple application that should run a shader, which will render a teapot to a texture and then show the result on a Quad.
The bad thing about that is, that my code doesn’t work. When I run the application there is a transparent window (you see the desktop through it).
Here’s the code of my rendering-function:
const GLfloat emission[4] = {0.0, 0.0, 0.0, 1.0};
const GLfloat ambient[4] = {0.1, 0.1, 0.2, 1.0};
const GLfloat diffuse[4] = {0.8, 0.85, 1.0, 1.0};
const GLfloat specular[4] = {0.95, 0.96, 1.0, 1.0};
GLint shininess = 64;
glEnable( GL_TEXTURE_2D );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(0.0,0.0,5.0,
0.0,0.0,-1.0,
0.0f,1.0f,0.0f);
glLightfv(GL_LIGHT0, GL_POSITION, lpos);
GLint loc;
glEnable(GL_LIGHT0); glEnable(GL_LIGHTING);
loc = glGetUniformLocationARB(clearRender,"Scale");
glUniform1fARB(loc,0.1);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, fb[1].texobj);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb[1].fbobj);
glutSolidTeapot(1);
glUseProgramObjectARB(clearRender);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glBindTexture(GL_TEXTURE_2D, fb[1].fbobj);
glBegin(GL_QUADS);
glTexCoord2i(0, 0);
glVertex2f(-1, -1);
glTexCoord2i(320, 0);
glVertex2f(-1 + 2, -1);
glTexCoord2i(320, 320);
glVertex2f(-1 + 2, -1 + 2);
glTexCoord2i(0, 320);
glVertex2f(-1, -1 + 2);
glEnd();
glUseProgramObjectARB(0);
I guess for you it’s easy stuff, but I am completely despaired.
Thanks
Nick