View Full Version : Changing Picture Every Several Seconds

12-01-2008, 04:09 PM
This is my problem... I need to add a picture on the wall of a room that changes to a different image every several seconds.

What's the best to implement this in OPENGL?

12-01-2008, 05:23 PM
The easiest solution is to use glTexSubImage (http://www.opengl.org/sdk/docs/man/xhtml/glTexSubImage2D.xml).

glTexSubImage2D(GL_TEXTURE_2D,0,0,0,aTextureWidth, aTextureHeight,aTextureFormat,aTextureType,newdata );

This will replace the entire image of the texture bound by glBindTexture. Notice that you must call first and only one time glTexImage2D (with the first image data or NULL if the image is not available at this time) in an init function.

Edit: I suppose that you know how to do texturing in OpenGL, if not read this tutorial (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06)

12-03-2008, 08:20 AM
Wow, one of your room wall is an OpenGL surface? That's totally cool! :D