PDA

View Full Version : some problems after I perform rotation



ken84shin
04-30-2010, 01:22 AM
Hi,

Got this problem that I'm unable to solve.
I loaded a mesh model into the screen(a cow model for example). Then I draw strokes on the head of the cow. It appears to be fine. However, when I roate the scene using glrotatef so that I can see the other side of the head of the cow, I would like to draw strokes on it as well. Here is the problem, after I rotate the scence, the following stokes do not appear where i want them to be...
Instead, it appears as thou I did not rotate the scene. Seems to me that when I do :



gl.glGetIntegerv(gl.GL_VIEWPORT, viewport,0);
gl.glGetDoublev(gl.GL_MODELVIEW_MATRIX, mvmatrix,0);
gl.glGetDoublev(gl.GL_PROJECTION_MATRIX, projmatrix,0);


I gives me the original information before the roatation is done.

Anyone can tell me whats wrong here?to draw strokes, I use gl.glunproject.
So sorry If I really did not describe the question well.

thank you.

ZbuffeR
04-30-2010, 02:08 AM
You have to apply the same modelview transformation to the cow and to the strokes.
Be sure to call glGetDoublev(gl.GL_MODELVIEW_MATRIX, mvmatrix,0); at the place the cow is rotated, and not after some pushMatrix() or other modelview changes.