Re: FBO problem
Rhadamés Carmona <[email protected]> Wed, 30 Jul 2008 08:45:23 -0800
| Newsgroups | gmane.games.devel.opengl |
|---|---|
| Organization | Fat City Network Services, San Diego, California |
| Message-ID | <[email protected]> |
Hello Gernot
Thanks for your help. I have added a little shader, but I still get the s=
ame=20
problem.
//Fragment
void main()
{
gl_FragColor =3D vec4(0.0,1.0,0.0,0.0); // notice, it is blue!
}
// vertex
void main()
{
gl_Position =3D gl_ProjectionMatrix * gl_Vertex;
}
There is no error after compiling the shaders, and link. Now, my draw=20
callback is this
void Draw()
{
// working with main object (the application)
if (!width || !height)
return;
glClearColor(0,0,0,0);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, g_fb); TestOpenGLError();
glDrawBuffer( GL_COLOR_ATTACHMENT0_EXT ); TestOpenGLError();
glEnable(GL_TEXTURE_RECTANGLE);
glViewport(0,0,width, height); TestOpenGLError();
glClearColor(0,0,0,0); TestOpenGLError();
glClear(GL_COLOR_BUFFER_BIT); TestOpenGLError();
/////////////////////////////// SHADER //////////////////////////////////=
//
glUseProgramObjectARB(m_slProgram); TestOpenGLError();
float size =3D 100.0f;
glColor3f(1,0,0); // it is red...but, I am using shaders
glBegin(GL_QUADS);
glVertex2f(width*0.5f - size, height*0.5f - size);
glVertex2f(width*0.5f - size, height*0.5f + size);
glVertex2f(width*0.5f + size, height*0.5f + size);
glVertex2f(width*0.5f + size, height*0.5f - size);
glEnd();
glUseProgramObjectARB(0);
/////////////////////////////////////////////////////////////////////////=
/
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDrawBuffer( GL_BACK );
glViewport(0,0,width, height); TestOpenGLError();
glFinish();
glEnable(GL_TEXTURE_RECTANGLE);
glBindTexture(GL_TEXTURE_RECTANGLE, g_tex); TestOpenGLError();
glEnable(GL_TEXTURE_RECTANGLE); TestOpenGLError();
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex2f(0.0f, 0.0f);
glTexCoord2f(0.0f, height);
glVertex2f(0.0f, height);
glTexCoord2f(width, height);
glVertex2f(width, height);
glTexCoord2f(width, 0.0f);
glVertex2f(width, 0.0f);
glEnd();
glDisable(GL_TEXTURE_RECTANGLE); TestOpenGLError();
glFinish();
glutSwapBuffers();
}
I do not know why this code works perfect for 8 bits FBO, but does not wo=
rk=20
for floating point FBO.
I get a full screen RED quad (if FBO is not 8bits), but the correct resul=
t=20
must be a blue quad of 100x100 in the middle of the screen.
Thanks aghain for any help!
Rhadam=E9s
----- Original Message -----=20
To: "Multiple recipients of list OPENGL-GAMEDEV-L"=20
<[email protected]>
Sent: Wednesday, July 30, 2008 5:50 AM
> Hej,
>
> have you actually used shaders? Float FBOs only work with shaders. Also
> note that your texture coordinates are different for GL_TEXTURE_RECTANG=
LE
> in contrast to GL_TEXTURE_2D, but it seems you only use texture rectang=
le
> anyways.=20
--=20
Estoy usando la versi=F3n gratuita de SPAMfighter para usuarios privados.
Ha eliminado 29139 correos spam hasta la fecha.
Los usuarios de pago no tienen este mensaje en sus correos.
Obtenga SPAMfighter gratis aqu=ED: http://www.spamfighter.com/les
-----=20
FAQ and OpenGL Resources at:
http://www.geocities.com/SiliconValley/Hills/9956/OpenGL
--=20
Author: =3D?iso-8859-15?Q?Rhadam=3DE9s_Carmona?=3D
INET: [email protected]
Fat City Hosting, San Diego, California -- http://www.fatcity.com
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [email protected] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).