manually draw a face

Started by pitt, May 25, 2006, 05:12:15 PM

Previous topic - Next topic

pitt

Hi egon,

   Correct this code for me please.
   manually draw the face by a given Object3D and the polyid.
 
   PolygonManager poly=obj.getPolygonManager();
   GL11.glBegin(GL11.GL_TRIANGLES);
   SimpleVector p=poly.getTransformedVertex(polyid,2);
   GL11.glVertex3f(p.x,p.y,p.z);
   p=poly.getTransformedVertex(polyid,1);
   GL11.glVertex3f(p.x,p.y,p.z);
   p=poly.getTransformedVertex(polyid,0);
   GL11.glVertex3f(p.x,p.y,p.z);
   GL11.glEnd();

   This code goes wrong when I rotate the Y axis of the Camera.
Other axes work properly, I guess.  I need to manually draw some faces cause they are not listed in VisList. But, they can be seen.

Thank you.

EgonOlsen

After getTransformedVertex(), you are in world space, not in camera (eye) space. You have to apply the camera's transformation to the vertices (i.e. translate by the negative camera position, apply the cam's rotation matrix).