Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 30 Jan 2000
Offline Last Active Jul 20 2015 02:30 PM

Topics I've Started

Problem with clearing a 3D texture in FBO

22 March 2011 - 08:02 PM

I'm working on a project in which I want to render stuff into a 3D texture. Once I got everything set up and started testing it, it looked as if it wasn't clearing properly. My shaders seemed to be drawing correctly into the texture, but I of course want to clear it every frame before using it, but it only seems to be clearing the first layer of the texture, leaving the rest as is.

To prove to myself that I wasn't just missing something in my messy project code, I wrote a little test program with GLUT to see if I could narrow down the problem. The problem persists, and I'm not sure what is going wrong. Full program (under 300 lines, needs GLEW and GLUT): 3dTexTest.cpp

Framebuffer and 3d texture setup:
glGenTextures(1, &_volumeTex);
glBindTexture(GL_TEXTURE_3D, _volumeTex);

// Fill texture with some initial colors	

glGenFramebuffers(1, &_volumeFBO);
glBindFramebuffer(GL_FRAMEBUFFER, _volumeFBO);

// Let glFramebufferTexture attach all layers of _volumeTex to FBO, on color attachment 0.
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, _volumeTex, 0);
if (FboStatus()) {
  return 1;

glBindTexture(GL_TEXTURE_3D, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);

Every frame I do this, then draw a box with 3d tex coords:
glBindFramebuffer(GL_FRAMEBUFFER, _volumeFBO);
glViewport(0, 0, VOL_DIM, VOL_DIM);

glBindFramebuffer(GL_FRAMEBUFFER, 0);

// Draw the box...

If I comment out the clear of the FBO, the 3d texture stays the same as what I initially stuck in it (of course). However, when I do clear it here to yellow, only the bottom (i.e. far) layer of the texture is cleared:

Posted Image

Am I setting something up wrong? Is this a problem with my driver (AMD Radeon 4850, Catalyst 11.2 on Windows 7)? I've checked the FBO status and for any GL errors along the way, and nothing shows up. As I said, in my actual project I have a shader that draws into the texture using gl_Layer in the geometry shader, and that works, it's just this clearing thing. I just don't get it. Hopefully someone can see what's wrong.


Computer Instability

11 January 2005 - 02:34 PM

Over the last month and a half my computer has been getting more and more unstable. Initially I attributed it to Windows being dumb, but things have been getting worse. A month ago I tried updating my video card drivers to the new(est) official NVIDIA Forceware 66.93. Half-Life 2 and some other games refused to run, so I downgraded back to 61.77. I was getting BSODs complaining about the driver, occasionally memory (page fault) errors, and sometimes some interrupt errors. After a while, I figured it could be a problem with my memory, so I pulled out one (of two) stick of memory (the older, smaller stick). This seemed to fix that problem. About three weeks ago, I got a new processor. I installed it myself, with a new heatsink/fan. Again Windows became very unstable around this time. So I remounted the HSF making extra sure to do everything right. I've run stress test benchmarks to try and induce a crash to see if it was the CPU, but the temperature never gets above 53 degrees celsius (~128 deg farenheit) and it hasn't crashed when I tried to make it. I'd like to assume it is not the problem. Again I thought it could be the memory. So today I bought two more DIMMs and plugged them in. When I tried to turn it on, nothing. Wouldn't even boot. I messed around, trying each stick individually, changed an IDE cable (when the hard drives started complaining), changed around the power connectors on hard drives, etc. In the end, after over a half an hours work and much frustration, it worked... In the exact same configuration that I started with... Now after numerous reboots, it's still not entirely stable. In fact I'm sure it's very unstable. I talked to my dad who has been working with computers for the last 30 odd years, and he suggested it could be either my power supply or my motherboard. I thought I'd see if anyone here has any idea of what it might be. So what do you think? Feel free to ask if you need to know anything else. P.S. Nothing in this computer has been overclocked... well except the video card, but that was using the built in (coolbits) overclocker that tested itself to make sure it was stable. And I never left it overclocked for very long anyway (30 minutes max). Computer Specs: Asus A7V-133 Mobo 300W PSU AMD Athlon XP 2100+ (Palomino) 512MB (x3) PC-133 SDRAM (Unbuffered, non-ECC, CL3) MSI Geforce FX5200 AGP Video Card 80GB UATA100 Hard Drive (7200RPM, 8MB Cache) 200GB UATA100 HDD (7200RPM, 8MB Cache) SBLive Value, Two IDE Controllers, Realtek 100Mbps NIC Two case fans running at 5000RPM, plus HSF on the CPU DVD-RW & CD-RW Computer is ALWAYS ON, and has been for years... :P --Buzzy