A way to delete the back OR front buffer?

Does anyone know a way to clear a single buffer, back or front, without having to delete both?

glDrawBuffer(GL_BACK);
glClear(GL_COLOR_BUFFER_BIT);

clears the back buffer,

glDrawBuffer(GL_FRONT);
glClear(GL_COLOR_BUFFER_BIT);

clears the front buffer.

but for which reason?

oh, and since i just noticed that the above reply was my post #476, here’s a little quiz, easily to solve:

who knows the computer game in which the number 476 had a special meaning?

For the scene’s background I used a texture that I loaded and rendered once (I don’t want to load AND/OR redraw it more than once because it will slow the fps down a lot). In the front buffer Im trying to draw an animated charachter, because if i draw the charachter to the back buffer it leaves a trail upon calling glswapbuffers().

I don’t want to load AND/OR redraw it more than once because it will slow the fps down a lot
Tough.

Assuming that the back buffer is copied into the front buffer is a bad idea. OpenGL doesn’t define exactly what happens when you swap buffers (note that GL doesn’t even have a command for it. SwapBuffers isn’t an OpenGL call).

The only way to do what you want is to create a renderbuffer that you draw your background to once, then use the new (and virtually unimplemented) EXT_framebuffer_blit extension to blit that data into the backbuffer before rendering your main stuff.

EXT_framebuffer_blit exists, but nobody implements it yet. So it’s not a workable plan as of yet.

In general, on any hardware that you could even consider calling hardware (even Intel on-chip stuff), drawing a textured quad to the screen isn’t going to be a big deal performance-wise.

“In general, on any hardware that you could even consider calling hardware (even Intel on-chip stuff), drawing a textured quad to the screen isn’t going to be a big deal performance-wise.”

Even a 1MB bitmap?

For whatever reason it takes forever to load and draw. Yes, I do have an intel on-board video chip, and it probably isn’t too powerful. I had to cut down video acceleration to stop strange screen behaviour. I decided to proceed with the game even with the charachter flickering due to front-buffer rendering. I will keep asking people in hopes of an arcane solution. If someone cares to look at the program, I will send it to them, along with the 1mb texture, and the small image loader.

www.geocities.com/zadeh1979/grass3

who knows the computer game in which the number 476 had a special meaning?
OK, I give up. What game is it? I remember one but it’s the wrong number :slight_smile:

Yes, I do have an intel on-board video chip, and it probably isn’t too powerful.
By the way, what flavor is that?

It’s… SNAKE 476…and it sure looks corny!

http://instruct1.cit.cornell.edu/courses/ee476/FinalProjects/s2000/wicks/

I honestly don’t know if your last comment was a joke Minstrel.

Intel 82945g with updated drivers.
Im running a P4 3.0 with 1mb L2 cache, 512MB SDRAM on an INTEL 945GPM motherboard with VIV technology, SYSTEM BUS = 800MHZ.

No, it wasn’t a joke. I was just curious. And thanks for the answer. I never would have figured that one out :slight_smile:

Yeah, that boards doesn’t exactly blister, at least not when compared to some others, but it’s not exactly a slouch either.

For whatever reason it takes forever to load and draw.
First, don’t private message me with code that should be shown to the forum.

Second, and more importantly, you keep reloading the texture every frame. The whole point of texture objects is that you only load the data once. Then you bind (and unbind) the texture object as needed.

If you’re loading 1MB of data off the disc every frame, of course it’s going to run slow.

Originally posted by Minstrel:
[quote]who knows the computer game in which the number 476 had a special meaning?
OK, I give up. What game is it? I remember one but it’s the wrong number :slight_smile:
[/QUOTE]mmmh…ok. if this was my own thread, i would make you suffer a bit longer by giving one more hint :smiley:

but since this thread’s not mine, here’s a quick answer:

PARADROID

476 was the maintenance robot’s number.

Zadeh, I don’t understand you… Two day ago I send you correct code as you asked in your private message, but you continued on using your own badly written code. Can’t you just accept that there are people that use OpenGL for years and have far more exprecience then you do? I personally start to see it as an insult: first you bomard me with pms which I throughtly answered, then you start posting same stuff (with same stupid questions) on the forum. If you don’t understand how texturing works then you should read a book. I see really no point in such behaviour. Please do not pm me anymore.

p.s. Sorry everyone, I’m just very annoyed :-/

p.p.s. @Korval: I was ensured by some Nvidia employe that EXT_framebuffer_blit will “appear in next major driver release”, whatever this means :slight_smile:

PARADROID

476 was the maintenance robot’s number.
Paranoid? Never heard of it :stuck_out_tongue:

Sorry for the OT folks, but RigidBody is up to some sort of cunning villainy.

“you keep reloading the texture every frame. The whole point of texture objects is that you only load the data once. Then you bind (and unbind) the texture object as needed.
If you’re loading 1MB of data off the disc every frame, of course it’s going to run slow.”

Actually, I am loading (and rendering) the texture only once in the first loop. For whatever reason, if I do not delete the texture immediately after the first cycle through the loop, the game runs really slow (so apparently binding/unbinding the texture object is not an option as well - maybe my image loader, glbmp, isn’t good). The present post is in regard to a different problem than the first post. I was trying to find a way to draw the animated charachter over the background scene (which, again, is only loaded/rendered once) and avoid flicker. I haven’t found a way to do this and as Korval stated it isn’t possible as of now. Thus, I am forced to render directly to the front buffer. This leaves me with a flickering charachter.

maybe my image loader, glbmp, isn’t good
ARGGGHHHHHHH

Indeed that is your problem since day one !
to do only in loader :

GLuint backgroundTexid;
glGenTextures(1,&backgroundTexid);
glBindTexture(GL_TEXTURE_2D,backgroundTexid);
glTexImage2d(…)

GLuint guyTexid;
glGenTextures(1,&guyTexid);
glBindTexture(GL_TEXTURE_2D,guyTexid);
glTexImage2d(…)


in main loop :

glBindTexture(GL_TEXTURE_2D,backgroundTexid);
<here draw full screen quad>

glBindTexture(GL_TEXTURE_2D,guyTexid);
<here draw small guy quad>

You’ll wont see the guy because it will go too fast :smiley:

Ok. I got a new video card (Geforce 7300 PCIE), and the front buffer flicker went away. I guess it was the onboard intel video that was the culprit. I did change the image loader as well, to further gain some performance.