I am trying to learn how to add several objects and working with those in my 3D-world. I am developing for iPhone. Regarding my question below I couldn't find good information about it while Googling.
I have a function that creates all vertices-arrays with data in order to create a sphere. No problem adding it as the only object. The problem is that the data for the sphere is not aware of any other objects I may have created and added to the world. Of course, I understand that I can merge the arrays with vertices and add it all at the same time and the world will look as I want with my objects in place. But then, how do I do the glTranslatef(,,)
, glScalef
, and glRotatef(,,,)
? It will affect the entire world and perhaps I only want to rotate the sphere. How do I change the position of only the vertices of the sphere and nothing else when I want to move the sphere?
So, the question I really want to ask is: What is the strategies/patterns to use when working with several objects in order to be able to work with them as single entities and not working with the world as just one chunk containing a lot of objects? Later on I will need to have a strategy that works with collision detection as well. I just need some help in order to move in the right direction while learning.