View Full Version : Rendering to Texture
02-09-2007, 08:00 PM
Hi, I'm new to opengl and need enlightening for my project.
I want to render a scene and use it as a texture map for another object. But I tried, but my code doesn't seem to be copying that scene to the texture and I don't know why is this so.
Any help or sample codes that I can refer?
02-09-2007, 11:59 PM
Try a search for "opengl render to texture".
Here's a great site for OpenGL demos:
In any case, it's a good idea to start with a working example, then build upon it. That way you start with a solid base and there's less to debug.
Hope it helps.
I was thinking in render the scene and the use glCopyPixels(). Is there a better approach?
glReadPixels() is a good option?????
02-10-2007, 06:03 AM
I was thinking in render the scene and the use glCopyPixels(). Is there a better approach?Depending on your hardware, you can use frame buffer objects (FBO) or pixel buffers (Pbuffer):
After context initialization, call glGetString with GL_EXTENSIONS to get a list of supported extensions on your particular hardware. The FBO extension is by far the preferred route--it's supported on most all modern hardware and it's judged by many to be much more pleasant to work with ;-)
There are good demos of both reachable through the link above, and there are countless others online.
Hope it helps.
Edit: fixed link
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.