[gameprogrammer] newb openGL q: positioning multiple objects
- From: Ethan Grammatikidis <eekee57@xxxxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Sun, 5 Jul 2009 02:47:55 +0100
Hi, I'm just starting out with OpenGL on a Linux box. I've been working through
an old O'Rielly tutorial creating a spinning cube,[1] and thought I could
modify the program to display multiple cubes, but no matter what I do I only
get one or zero cubes.
[1]
http://www.oreillynet.com/pub/a/network/2000/06/23/magazine/opengl_build.html?page=2
It's GLUT-based with a cbRenderScene() callback which originally contained all
the drawing code for the cube and the HUD-like text. I rearranged
cbRenderScene() so that it calls my functions, do_objects() and do_hud().
do_objects calls obj_spinning_cube() twice, passing different positions each
time. obj_spinning_cube() passes this position (a struct with x, y, z) to
glTranslatef() immediately after calling glLoadIdentity().
I only see one spinning cube, corresponding to the second call to
obj_spinning_cube(). I can see the first cube if I disable that second call. I
wonder if I'm misunderstanding glLoadIdentity()?
--
Ethan Grammatikidis
Those who are slower at parsing information must
necessarily be faster at problem-solving.
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
Other related posts: