Author Topic: manually draw a face  (Read 1917 times)

Offline pitt

  • byte
  • *
  • Posts: 13
    • View Profile
manually draw a face
« on: May 25, 2006, 05:12:15 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
manually draw a face
« Reply #1 on: May 25, 2006, 06:33:42 pm »
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).