Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 07-07-07, 04:09 PM   #1
Ian McLean
Registered User
 
Join Date: Jul 2007
Posts: 3
Default Black surfaces with GL_RENDERBUFFER_EXT

I have this code for making an offscreen buffer:

Code:
GL_VERIFY(glGenFramebuffersEXT(1, &m_frameBuffer));
GL_VERIFY(glGenTextures(1, &m_colorTexture));
GL_VERIFY(glBindTexture(GL_TEXTURE_2D, m_colorTexture));
GL_VERIFY(glEnable(GL_TEXTURE_2D));
GL_VERIFY(glTexImage2D(GL_TEXTURE_2D, 0, m_color, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0));
GL_VERIFY(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
GL_VERIFY(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
GL_VERIFY(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
GL_VERIFY(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
GLint prevFrameBuffer = 0;
GL_VERIFY(glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &prevFrameBuffer));
GL_VERIFY(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_frameBuffer));
GL_VERIFY(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_colorTexture, 0));
GL_VERIFY(glGenTextures(1, &m_depthTexture));
GL_VERIFY(glBindTexture(GL_TEXTURE_2D, m_depthTexture));
GL_VERIFY(glTexImage2D(GL_TEXTURE_2D, 0, m_depth, m_width, m_height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0));
GL_VERIFY(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
GL_VERIFY(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
GL_VERIFY(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
GL_VERIFY(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
GL_VERIFY(glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE, GL_LUMINANCE));
GL_VERIFY(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, m_depthTexture, 0));
_RendCheckFramebufferStatus();
GL_VERIFY(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, prevFrameBuffer));
That works fine. However, when I modify it to this:

Code:
GL_VERIFY(glGenFramebuffersEXT(1, &m_frameBuffer));
GL_VERIFY(glGenTextures(1, &m_colorTexture));
GL_VERIFY(glBindTexture(GL_TEXTURE_2D, m_colorTexture));
GL_VERIFY(glEnable(GL_TEXTURE_2D));
GL_VERIFY(glTexImage2D(GL_TEXTURE_2D, 0, m_color, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0));
GL_VERIFY(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
GL_VERIFY(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
GL_VERIFY(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
GL_VERIFY(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
GLint prevFrameBuffer = 0;
GLint prevRenderBuffer = 0;
GL_VERIFY(glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &prevFrameBuffer));
GL_VERIFY(glGetIntegerv(GL_RENDERBUFFER_BINDING_EXT, &prevRenderBuffer));
GL_VERIFY(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_frameBuffer));
GL_VERIFY(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_colorTexture, 0));
GL_VERIFY(glGenRenderbuffersEXT(1, &m_depthTexture));
GL_VERIFY(glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_depthTexture));
GL_VERIFY(glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, m_width, m_height));
GL_VERIFY(glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthTexture));
_RendCheckFramebufferStatus();
GL_VERIFY(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, prevFrameBuffer));
GL_VERIFY(glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, prevRenderBuffer));
I start to have problems.

Whenever my application's window size changes, I delete and recreate about a half dozen of these buffers, of various sizes. With the second implementation, after a few hundred delete+creates (eg, resizing the window border around the screen for a few seconds), everything goes black. No asserts from GL_VERIFY (which checks glGetError for all GL calls in my app), and glCheckFramebufferStatusEXT still returns GL_FRAMEBUFFER_COMPLETE_EXT when I bind the buffer targets each frame.

The second snippet runs under Windows without any problems.

This looks a lot like the 'Beryl-black-window' problem. I couldn't find any technical description of it to confirm, though. I've no problem using my first snippet of code until the next driver rev if that's the case (I'm going to want render-to-depth-texture for shadow maps eventually, anyway).

Can anyone confirm that, or see any problems with either piece of code? If not I'll bother NVIDIA with a bug report.

Thanks
Ian McLean is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
AMD FX-8120 Black Edition CPU Review (with Asus M5A99X EVO) News Archived News Items 0 06-21-12 08:30 AM
Black Mesa Invites You To Look At Its Bowels News Archived News Items 1 06-12-12 01:05 AM
Review: Men in Black 3 Will Erase All Meaning in Your Life News Archived News Items 0 05-25-12 09:30 PM
What Happened To Black Mesa: Source? Part Two News Archived News Items 0 05-10-12 07:47 AM
Pre-Purchase Now: Call of Duty®: Black Ops II News Archived News Items 0 05-05-12 02:00 AM

All times are GMT -5. The time now is 08:57 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.