View Full Version : Rendering to Texture
Sherrine
02-09-2007, 07: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?
plasmonster
02-09-2007, 10:59 PM
Try a search for "opengl render to texture".
Here's a great site for OpenGL demos:
http://download.developer.nvidia.com/developer/SDK/Individual_Samples/samples.html
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.
Hello!
I was thinking in render the scene and the use glCopyPixels(). Is there a better approach?
glReadPixels() is a good option?????
plasmonster
02-10-2007, 05: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):
http://www.opengl.org/registry/specs/EXT/framebuffer_object.txt
http://www.opengl.org/registry/specs/ARB/wgl_pbuffer.txt
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.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.