Quote:
Originally Posted by SDyer
Hi - this is a noob OpenGL ES question. I'm starting with the Open GL ES app that XCode gives you, the one with the rotating gradient square. I would like to display a background behind that rotating square. I am able to display a background, but it rotates too! I've not found a way to "decouple" them. How do I apply rotation to only one of them? My draw source code is below. Thanks!
|
The "flaw" in the default OpenGL project is that they don't reset the modelview matrix to the identity matrix for each new draw call. They apply a rotation of 3 degrees every frame, but that rotation is multiplied to the existing modelview matrix, which is how they achieve the constant rotation effect. If you want independent control of your scene objects (and who doesn't), you'll probably want to set the modelview matrix to the identity on every new draw call, then apply the individual transformations for each of your scene objects.