Re: FBO problem
"bear007" <[email protected]> Thu, 31 Jul 2008 16:50:33 -0800
| Newsgroups | gmane.games.devel.opengl |
|---|---|
| Organization | Fat City Network Services, San Diego, California |
| Message-ID | <[email protected]> |
Hello, Is there any chance that I will be removed from this mailing list? I've= =20 tried provided link to unsubscribe several times, and still get messages. Kind regards, bear ----- Original Message -----=20 =46rom: "Gernot Ziegler" <[email protected]> To: "Multiple recipients of list OPENGL-GAMEDEV-L"=20 <[email protected]> Sent: Thursday, July 31, 2008 4:05 PM >i am glad it worked out alright :) if you want, then send me the code = one=20 >more time, marking where the difference lies with a #define and i can=20 >report it as a bug > > /gernot > > ________________ Reply Header ________________ > Subject: Re: FBO problem > Author: Rhadam=E9s Carmona <[email protected]> > Date: 31st July 2008 01:35 > > Hello Guys > > Now works. The trick was to use GL_RGBA32F_ARB instead of GL_RGBA32F_= NV > > > Regards > > 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. A= lso >> note that your texture coordinates are different for GL_TEXTURE_RECT= ANGLE >> in contrast to GL_TEXTURE_2D, but it seems you only use texture rect= angle >> anyways. >> >>> I am playing a little bit with FBO. By the way, I am rendering a li= ttle=20 >>> red >>> quad in the middle of the FBO. It works perfect while I use >>> >>> glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, w, h, 0, GL_RGBA, >>> GL_UNSIGNED_BYTE, NULL); >>> >>> yeah...a 8 bits FBO. I can change GL_UNSIGNED_BYTE by GL_FLOAT, and= I=20 >>> always >>> get a 8 bits FBO... (well known behaviour). >>> >>> But, If I just change that command by >>> >>> glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_FLOAT_RGBA16_NV, w, h, >>> 0,GL_RGBA, GL_UNSIGNED_SHORT, NULL); >>> >>> or even by >>> >>> glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_FLOAT_RGBA32_NV, w, h, >>> 0,GL_RGBA, GL_FLOAT, NULL); >>> >>> then, I get a full screen red image (even if I comment the=20 >>> glBegin(QUADS) - >>> glEnd() block to render the quad). The entire FBO gets the color of= my >>> glColor3ub(255,0,0). >>> >>> I have test every OpenGL code line with glGetError(), and there is = not=20 >>> any >>> error. I also installed latest glew and drivers for my 8800 NVidia=20 >>> graphics >>> board. >>> >>> I hope some of you could have a suggestion about what I am doing wr= ong. >>> >>> Thanks a lot! >>> Rhadam=E9s >>> >>> >>> #include "glew.h" >>> #include <gl/glut.h> >>> #include <stdio.h> >>> #include <stdlib.h> >>> #include <iostream> >>> >>> #define GL_TEXTURE_RECTANGLE GL_TEXTURE_RECTANGLE_NV >>> >>> int height=3D0, width=3D0; >>> GLuint g_fb=3D0; >>> GLuint g_tex=3D0; >>> GLuint g_depth=3D0; >>> >>> using namespace std; >>> >>> >>> void Abort(char *msg) >>> { >>> printf(msg); >>> exit(1); >>> } >>> >>> >>> >>> void CheckErrorsGL(const char* location=3DNULL, ostream& ostr=3D st= d::cerr ) >>> { >>> GLuint errnum; >>> const char *errstr; >>> int counter =3D 0; >>> while (errnum =3D glGetError()) >>> { >>> errstr =3D reinterpret_cast<const char *>(gluErrorString(errnum)); >>> if(errstr) >>> { >>> ostr << errstr; >>> } >>> else >>> { >>> ostr << "Error " << errnum; >>> } >>> >>> if(location) >>> ostr << " at " << location; >>> ostr << endl; >>> counter++; >>> } >>> if (counter) >>> Abort("Application cannot continue!\n"); >>> >>> return; >>> } >>> >>> void TestOpenGLError() >>> { >>> CheckErrorsGL(NULL); >>> } >>> >>> >>> 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(); >>> glViewport(0,0,width, height); TestOpenGLError(); >>> glClearColor(0,0,0,0); TestOpenGLError(); >>> glClear(GL_COLOR_BUFFER_BIT); TestOpenGLError(); >>> >>> >>> float size =3D 100.0f; >>> >>> glColor3f(1,0,0.5f); >>> 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(); >>> //glColor3ub(0,0,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(); >>> // back to 3D mode >>> >>> >>> glFinish(); >>> glutSwapBuffers(); >>> } >>> >>> void Init() >>> { >>> GLenum err =3D glewInit(); >>> if (GLEW_OK !=3D err) >>> // Problem: glewInit failed, something is seriously wrong. >>> Abort("init error\n"); >>> >>> >>> TestOpenGLError(); >>> glGenFramebuffersEXT(1, &g_fb); ; TestOpenGLError(); >>> glBindTexture(GL_TEXTURE_2D, 0); TestOpenGLError(); >>> glBindTexture(GL_TEXTURE_RECTANGLE, 0); TestOpenGLError(); >>> glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, g_fb); TestOpenGLError(); >>> >>> // create the texture for the color >>> glGenTextures(1, &g_tex); &nbs p; TestOpenGLError(); >>> glBindTexture(GL_TEXTURE_RECTANGLE, g_tex); TestOpenGLError(); >>> >>> glTexParameteri (GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP)= ; >>> glTexParameteri (GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP)= ; >>> glTexParameteri (GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER,=20 >>> GL_NEAREST); >>> glTexParameteri (GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER,=20 >>> GL_NEAREST); TestOpenGLError(); &nbs p; >>> >>> //glTexImage2D(GL_TEXTURE_RECTANGLE, 0, 4, width, height, 0, GL_RGB= A,=20 >>> GL_UNSIGNED_BYTE, NULL); //works >>> //glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA16, width, height,=20 >>> 0,GL_RGBA, GL_UNSIGNED_SHORT, NULL); //works >>> //glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_FLOAT_RGBA32_NV, w, h,=20 >>> 0,GL_RGBA, GL_FLOAT, NULL); //does not work >>> glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_FLOAT_RGBA16_NV, width, he= ight,=20 >>> 0,GL_RGBA, GL_UNSIGNED_SHORT, NULL); >>> >>> TestOpenGLError(); >>> glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_E= XT,GL_TEX=20 >>> TURE_RECTANGLE,g_tex, 0); >>> if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) !=3D=20 >>> GL_FRAMEBUFFER_COMPLETE_EXT) >>> Abort("Error adding color to FBO\n"); >>> TestOpenGLError(); >>> >>> glMatrixMode(GL_PROJECTION); >>> glLoadIdentity(); >>> glOrtho(0,width,0,height,-1,100.0f); >>> glMatrixMode(GL_TEXTURE); >>> glLoadIdentity(); >>> glMatrixMode(GL_MODELVIEW); >>> glLoadIdentity(); >>> glTranslatef(0,0,-5); >>> } >>> >>> void Reshape(int w, int h) >>> { >>> width =3D w; >>> height=3D h; >>> glViewport(0,0,width,height); >>> Init(); >>> } >>> >>> >>> void main(int argc, char **argv) >>> { >>> glutInit(&argc, argv); >>> glutInitDisplayString("double blue>=3D8 red>=3D8 alpha>=3D8 green>=3D= 8=20 >>> depth=3D32");// rgba>=3D8 depth>=3D24"); >>> glutInitWindowSize(640,480); >>> glutInitWindowPosition(0,0); >>> glutCreateWindow("test"); >>> glutSetWindowTitle("test"); >>> >>> >>> glutIdleFunc(Draw); >>> glutDisplayFunc(Draw); >>> glutReshapeFunc(Reshape); >>> >>> glutShowWindow(); >>> glutMainLoop(); >>> >>> } >>> ----- FAQ and OpenGL Resources at:=20 >>> http://www.geocities.com/SiliconValley/Hills/9956/OpenGL -- Author:= =20 >>> [email protected] >>> INET: [email protected] Fat City Hosting, San Diego, California -- =20 >>> http://www.fatcity.com >>> -------------------------------------------------------------------= -- To=20 >>> REMOVE yourself from this mailing list, send an >>> E-Mail message to: [email protected] (note EXACT spelling of=20 >>> 'ListGuru') and in the message BODY, include a line >>> containing: UNSUB OPENGL-GAMEDEV-L (or the name of mailing list you= want=20 >>> to be removed from). You may also send the HELP >>> command for other information (like subscribing). >>> >> >> Servus, >> Gernot >> >> GPU. 3D Vision. Europe. Future. Now. >> Drop by: www.mpi-sb.mpg.de/~gziegler - www.geofront.eu >> > > --=20 > Estoy usando la versi=F3n gratuita de SPAMfighter para usuarios priva= dos. > 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: Gernot Ziegler > 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). > > __________ NOD32 Informacje 3301 (20080727) __________ > > Wiadomosc zostala sprawdzona przez System Antywirusowy NOD32 > http://www.nod32.com lub http://www.nod32.pl > >=20 ----- FAQ and OpenGL Resources at: http://www.geocities.com/SiliconValley/Hills/9956/OpenGL -- Author: bear007 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).