Sign in to follow this  

OpenGL - AllegroGL DirectX

Recommended Posts

cowsarenotevil    3005
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:

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?

Share this post

Link to post
Share on other sites
markr    1692
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.


Share this post

Link to post
Share on other sites
besh81    122
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]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this