Hello there.
I want to make an application having half of the window showing the front profile of an object whereas the other half showing the top profile. Now I have done this by creating two viewports. I get my objects in the correct orientation but as soon as i rotate them i don’t see them both rotate together. I tried to push matrix and pop it
just to give you the idea this is what I am doing
in my rendering function.
clear
setViewport1()
push matrix
rotate()
drawObject()
pop matrix
setViewport2()
push matrix
rotate()
drawObject()
pop matrix
Help me please. I tried to replace the push pop matrix calls with loadIdentity but still get the same result. Thanx in advance.
Originally posted by Aeluned:
[b]Does your setViewport function set the camera transformations (for a top view for example).
what do you mean you don’t see them rotate together? only one rotates?
I don’t see anything obviously wrong with your code there, it’s probably elsewhere.[/b]
My setViewport is nothing but
glViewport(0,0,300,300);
and the second one is
glViewport(300,0,300,300);
Thus I have two 300x300 regions.
By not seeing them together, I mean that when I place glRotate call before first DrawObject call then both of the objects rotate however when I place two glRotate calls (one before each drawObject function) then nothing rotates everything is static.
Originally posted by <Honk>: Check your glMatrixMode() calls carefully, perhaps you are doing everything on top of the projection matrix (which usually has a stack limit of two).
Well, I have setup the projection in my reshape function. I would check to see if I have changed the matrix to modelview in or before my render function. Thanx for that.
Try this: Remove the glutSwapBuffers from the idle loop and replace the glFlush in the Render function with it.
In general, do not rely on backbuffer contents after SwapBuffers.
Originally posted by Relic: Try this: Remove the glutSwapBuffers from the idle loop and replace the glFlush in the Render function with it.
In general, do not rely on backbuffer contents after SwapBuffers.
Tried what you said but now I don’t see my triangles. When the program runs now, it sort of takes a snapshot of my screen and displays it. Now I do not see my triangles. What is wrong now???
I think you were seeing the right triangle clipped by the far-plane.[/b]
Thanx Graham for that but are the triangles rotating alright they are not rotating on my PC even though I see clipped tringles?