[gameprogrammer] Re: newb openGL q: positioning multiple objects
- From: Ethan Grammatikidis <eekee57@xxxxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Mon, 6 Jul 2009 08:01:34 +0100
On Sun, 5 Jul 2009 20:41:02 +0100
Richard Sabbarton <richard.sabbarton@xxxxxxxxx> wrote:
> Hi Ethan,
>
> Check out line 223...
> glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
>
> This will blank the screen each time...
>
> You should call this once before you begin rendering your scene...
>
> It looks like you are rendering multiple cubes but clearing the buffer
> before each one.
>
> Hope this helps.
>
> Rich
That did help, thank you.
>
>
>
> 2009/7/5 Ethan Grammatikidis <eekee57@xxxxxxxxxxx>:
> > On Sun, 5 Jul 2009 02:47:55 +0100
> > Ethan Grammatikidis <eekee57@xxxxxxxxxxx> wrote:
> >
> >> 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()?
> >
> > I forgot to link my code:
> >
> > http://sprunge.us/NZNc?c
> >
> > and a 3-line header (position struct):
> >
> > http://sprunge.us/VGDc?c
> >
> > --
> > 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
> >
> >
> >
>
> ---------------------
> To unsubscribe go to http://gameprogrammer.com/mailinglist.html
>
>
--
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: