# OpenGL Porting FBO Code to Vista - FBOs black

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

## Recommended Posts

Hi, I hope that somebody knows a solution to my following problem: I developed an OpenGl engine using windows XP 32bit. There everything works, concerning FBOs (strangely only TEXTURE_RECTANGLE_NV based Fbos work with 16bit floating point targets and nobody seems to know about this problem, whatever) My current problem is, that with Vista 64bit or 32bit, my fbos are black. I tried out in vista 32 and 64bit, with nVidia graphics cards up from 7600Gt, 8600Gt and 8800Gtx, with graphics card drivers from the last half year, so at least 4 or 5 versions. When I am looking at the framecounter of my program, it shows differing framerates, when i am moving in my game, as it does with windows xp too, but there I see the images. In vista, everything is black, as soon as I render to an fbo and render it to screen (but it seems, as the actual rendering takes place, only the fbos don't work. There are no OpenGl and FBO errors, as I check them every frame. Another strange thing is, that I wrote an fbo code for another project, that uses texture_2d and floating point targets, which runs perfectly in xp and vista, but as soon as i use this code in the other framework, the same happens -> black screen. I am using Glut for my window, but I also tested OpenGlut, FreeGlut and QT 4.3.2 based OpenGl windows, because I thought about a bad Ogl context or something like that. Has anybody of you seen (and hopefully solved) a similar problem? Yours grassi

##### Share on other sites
I remember hearing of some differences of how drivers work in Vista because of the aero interface. Vaguely(might be wrong), it has something to do with flushing or swapping when rendering to FBOs. I really cant remember the details but something along that line.

##### Share on other sites
@GamerSg: I already tried out disabling Aero, but there was no difference.

when initing the fbo I do the following (my actual code is split into several classes, so this is more or less a summary)
glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &mMaxColorTargets);glGenFramebuffersEXT(1, &mFboId);glGenTextures(1, &mGlTextureId);glBindTexture(GL_TEXTURE_RECTANGLE_NV, mGlTextureId);glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA16F_ARB,  mWidth, mHeight, 0, GL_RGBA, GL_FLOAT, 0);glTexParameterf(mGlTexTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);glTexParameterf(mGlTexTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);glTexParameteri(mGlTexTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);glTexParameteri(mGlTexTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);				glBindTexture(mGlTexTarget, 0);glGenRenderbuffersEXT(1, &mGLDepthId);glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, mGLDepthId);glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, mWidth, mHeight);

when binding the fbo
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFboId);glPushAttrib(GL_VIEWPORT_BIT | GL_COLOR_BUFFER_BIT);glViewport(0, 0, mWidth, mHeight);//////// Here code to insert the current active attachment into a member called mActiveAttachments// Used because I support more than one texture attachments//////glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_NV, mGlTextureId, 0 );glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mGLDepthId);glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mGLDepthId);glDrawBuffers(mActiveAttachments.size(), &mActiveAttachments[0]);

to unbind the fbo i do the following
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, mGlTexTarget, 0, 0 );glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, 0);glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, 0);glPopAttrib(); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);glDrawBuffer(GL_BACK);

What I want to mention: changing the depth buffer from the packed depth/stencil format to the "normal" GL_DEPTH_COMPONENT_24 makes no difference.

grassi

##### Share on other sites
Are you using glFlush() or SwapBuffers() before you unbind your FBO?

##### Share on other sites
no, I am not using it. Is this recommended somewhere?

##### Share on other sites
I'm the same though I for the life of me cannot understand why I can't get either FBO's or Pbuffer's working correctly in my own program and I've read tutorial after tutorial on it.

I would indeed be grateful if anyone can post some working FBO code which is multi-platform.

neutrinohunter

##### Share on other sites
Hi, it took me until today to have access to the vista box.

I tried out inserting a glFlush(); before each glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); call.

In my Debug build, everything stayed the same, whereas the Release build crashes.
Could this crashing have something to do with my Problem? I did nothing else but insert the glFlush().

I tried out glFinish() before switching the buffers, which causes the same effects.
Does anybody have an idea why? In the debug build nothing crashes (but the black screen is still there)

According to the callstack in the release build, the nvoglv32.dll causes this crash.
My current vista is 64bit, but the app is still 32bit, due to some libs.

##### Share on other sites
Check that the size for the FBO/Textures are correct, thats where my problem was and I had the same callstack error it seems.

neutrinohunter

1. 1
2. 2
3. 3
Rutin
18
4. 4
JoeJ
14
5. 5

• 14
• 9
• 23
• 9
• 32
• ### Forum Statistics

• Total Topics
632621
• Total Posts
3007498
• ### Who's Online (See full list)

There are no registered users currently online

×