OpenGL - AllegroGL DirectX
Can OpenGL or AllegroGL or DirectX render a memory bitmap (eg. Allegro's BITMAP) instead of screen???
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:
The above is taken from this tutorial, which explains it in greater detail.
Is this what you want?
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?
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement