Jump to content
  • Advertisement
Sign in to follow this  
grassi3000

OpenGL Porting FBO Code to Vista - FBOs black

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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.

thx in advance
grassi

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!