OpenGL - AllegroGL DirectX

Started by
4 comments, last by besh81 18 years, 5 months ago
Can OpenGL or AllegroGL or DirectX render a memory bitmap (eg. Allegro's BITMAP) instead of screen???
Advertisement
yes, they can, I'm a noob, and even I knew that...
...and how can I redirect the rendering to the bitmap????
Are you looking to output it to a file, or just store it in memory for later use? In OpenGL you can render to a texture, and I believe you only have to bind your texture and use the glCopyTexImag2D function:

glBindTexture(GL_TEXTURE_2D,BlurTexture);			glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 0, 0, 128, 128, 0);


The above is taken from this tutorial, which explains it in greater detail.

Is this what you want?
-~-The Cow of Darkness-~-
OpenGL can render to non-visible surfaces in the following ways:

1. Using back buffers or aux buffers of a visible surface - This is the simplest method - you just render what you want rendered on the texture to the back buffer, copy it to a texture (I assume this is what you want it for), then clear the back buffer and render what you actually wanted to render, before calling swapbuffers.

2. Using the pbuffer extension - which is rather complicated to use and highly platform dependent (well, actually it is two extensions, one for X and one for Windows)
3. Using the easier, more portable, but less widely supported EXT_framebuffer_object extension. This is available on newer cards / drivers, and is more straightforward than the pbuffer approach but still allows you to render totally offscreen.

---

None of these methods renders in to CPU-accessible memory. If you wanted to get the image into CPU memory, you'd need a slow glReadPixels.

Mark

Thanks to everybody,
I have used the method explain int NeHe Lesson 36!

There's a glReadPixel similar func in directx??


[Edited by - besh81 on November 12, 2005 4:19:31 AM]

This topic is closed to new replies.

Advertisement