Question

I'm trying to convert an openGL [edit: "card that I drew"(?):) thx unwind]containing a lot of textures (nothing moving) into one PNG file that I can use in another part of the framework I'm working with. Is there a C++ library that does that?

thanks!

Was it helpful?

Solution

If you simply mean "take a scene rendered by OpenGL and save it as an image," then it is fairly straightforward. You need to read the scene with glReadPixels(), and then convert that data to an image format such as PNG (http://www.opengl.org/resources/faq/technical/miscellaneous.htm).

There are also more efficient ways of achieving this, such as using FBOs. Instead of rendering the scene directly into the framebuffer, you can render it to a texture via an FBO, then render that texture as a full-screen quad. You can then take this texture and save it to a file (using glGetTexImage, for example).

OTHER TIPS

What is an "OpenGL file"? OpenGL is a graphics API, it doesn't specify any file formats. Do you mean a DDS file, or something?

There are better ways to make a compose texture than drawing them with the graphics card. This is really something you would want to do before hand on the cpu, store and then use as and when you need it with opengl

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top