PDA

View Full Version : Seeing Double



Charles
05-28-2004, 03:54 PM
Having tried some code from Computer Graphics 3rd edit in C (foley) I have been working on, I started messing with my ModelView. My rotation and translation work, however I obtain two copies of the same display, list. My question is that (to the best of my knowledge) a linear transformation has a unique image in the range. i.e for any x,y,z there are unique x',y',z' under an affine transformation. why have i ended up with two images?
Sample code I was testing

glPushMatrix();
float modelview[16];
glGetFloatv(GL_MODELVIEW_MATRIX , modelview);
//Change The Matrix
for(int i=0; i<3; i++ )
for(int j=0; j<3; j++ )
modelview[i*4+j] = PlaneMatrix[i+4*j];

//Change The Translations
modelview[12]=xtrans+ PlaneMatrix[12];
modelview[13]=ypos + PlaneMatrix[13];
modelview[14]=-12.5f-ztrans+PlaneMatrix[14];

//Reload Updated Matrix
glLoadMatrixf(modelview);
BuildAircraft();
glPopMatrix();I end up with two aircraft, which seem to be reflections of each other. One of them has the desired property (following a Direction of flight)
the other is unwanted.
What is going on behind the scenes to produce a second image?

ZbuffeR
05-29-2004, 09:35 AM
Your problem does not seem to be related to the transformations. I don't think it is possible to have such a transformation that draw 2 copies of an object.

It seems to be about the way you draw your object. You mentionned display lists ? Be sure you don't have the object drawn twice, it has happened to me.

Can you post code of the BuildAircraft() and how you build your display list ?