objective c - How to work with several objects in OpenGL-ES -


I'm trying to learn how to add many objects and work with them in my 3D-world. I am developing for the iPhone below. I did not get good information about my question below while Googling

I have a function that works with all the corners - Makes the array. There is no problem connecting it as an object only. The problem is that the data for the area is not aware of any other thing that I have created and added in the world. Of course, I think I am with arrays I can merge in the corner and add it at the same time and the world will look at me as I want with my items. But then, how can I do glTranslatef (,) , glScalef , and glRotatef (,,,) ? It will affect the whole world, and maybe I will just rotate the area. When I want to move the area, how do I change the position of the corner of the field and nothing else?

So, I really want to ask this question: what are the strategies / patterns to use when working with many things to be able to work with them as single institutions and Not working with the world, in which there are so many objects? Later I will need a strategy that works even with the collision detection. During learning, I need some help to move in the right direction.

There are basically two patterns : Using the Matrix Stack, and copying data.

To use the matrix stack, you do something like this:

  for every object {glPushMatrix glTranslate (location of first object) / * desired to rotate Also * / draw_one_object (); GlPopMatrix (); }  

The same coordinate data can be recycled because it is dragged in different places.

Alternate (data copy) is to allocate a lot of array, it contains data n times, and then add your object offset to each copy to make unique copies of the original copies.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -