Skip to main content
GameDev.net gamedev.net
🔒 Locked

Custom framebuffer

Started by GaboonViper Oct 15, 2005 at 2:30 AM 5 replies 950+ views
Original Post
GaboonViper
GaboonViper
I'm trying to draw a shape using an alpha map. The shape can be filled with a color a gradient or anything else. In order to do this I'm using a custom buffer X * Y (RGBA). In order to draw on it I'm currently using direct pixel acces, but I'd prefer to use Opengl to draw on it. This way I won't have to create two seperate draw-functions for each kind of graphic I want to fill the buffer with. So my question is: how?
Geocyte
Geocyte
Just draw on the back buffer like you usually do and then copy that buffer to another area of memory (glReadPixels) then clear the back buffer (don't swap buffers or whatever you draw ends up on the screen).

There are other ways. That's just how I do it.
Geocyte Has Committed Suicide.
GaboonViper
GaboonViper
Unfortunately it could be possible that I'm already using the backbuffer during such an operation. I don't want to mess up whatever I was already drawing on it.
Rasmadrak
Rasmadrak
check out auxilary buffers...

and btw, if you read from the backbuffer, it wont get messed up. :)

"Game Maker For Life, probably never professional thou." =)
Kambiz
Kambiz
Why not using a Frame Buffer Object?
GaboonViper
GaboonViper
Quote:
Original post by Rasmadrak
check out auxilary buffers...

and btw, if you read from the backbuffer, it wont get messed up. :)

reading not, but drawing on it will mess it up. I think using the auxiliary buffers would be a bit overkill since I usually will only use a small piece of a the whole frame.



Quote:
Original post by Rasmadrak
why not using a Frame Buffer Object?

Because I didn't know about them. It sounds like what I'm looking for though. Could you direct me to some information on this subject?
Geocyte
Geocyte

You could use an auxiliary buffer...

To find out how many auxiliary buffers are present, use glGetIntegerv() with GL_AUX_BUFFERS.

glDrawBuffer(GLenum mode) selects the buffers enabled for writing or clearing. The value of mode can be one of the following:

GL_FRONT
GL_BACK
GL_RIGHT
GL_LEFT
GL_FRONT_RIGHT
GL_FRONT_LEFT
GL_BACK_RIGHT
GL_BACK_LEFT
GL_AUXi
GL_FRONT_AND_BACK
GL_NONE
Geocyte Has Committed Suicide.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.