Advertisement

Draw a line from point a to b to c to d to a

Started by June 05, 2002 07:01 PM
17 comments, last by godkane 22 years, 8 months ago
Im making a 3d character file and im trying to make it in wire form now. I write a simpal file to draw a square. But when its in wire form it draws to lines unconnected, in quad form it draws the hole thing together. Here are my coors (x, y, z) (0, 0, 0) (1, 0, 0) (1, 1, 0) (0, 1, 0) That is what is comming from Print.
  
  void Display()
  {
    AXIS axy;
    int a = 0;

    glBegin(GL_LINES);
    //glBegin(GL_QUADS);


    while(Print(ngc, a, &axy))
    {
      glVertex3f(axy.x, axy.y, axy.z);
      a++;
    }

    glEnd();
  }
  
Dose any one have any ideas why this is doing this? thx nuke
--------------------------Nukemmsn: nukem996@hotmail.comaim: nukem996open source open mind
use

glBegin(GL_LINE_STRIP);
//point a
//point b
//point c
//point d
//point ect...
glEnd();
Advertisement
I''d rather use GL_LINE_LOOP
What''s the difference between strip and loop? I''ve never hearth of the loop thing..

When do you use that?
A line strip connects points.
A line loop connects points and then goes back to the beginning point.
k Thnx
Advertisement
wow... i didn''t know that... but that might not be the best in this case... he might end up with a line going through the middle of the cube and that wouldn''t be good. -PmanC
heh thx i didnt know about all that stuff
--------------------------Nukemmsn: nukem996@hotmail.comaim: nukem996open source open mind
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

call this function and everything will be drawn in a wireframe

glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

call this to set it back to normal
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon
I''m sorry but I have to disagree.
This may work, but has two major disadvantages :
1- it slows own a lot the rendering. Depending on your graphics card it may even switch to software rendering !
2- it doesn''t necessarily give you the rendering you want. For instance if one polygon is drawn half inside the viewing frustum and half outside, then the splitten triangles may appear.

In fact, you would have to play with the glEdgaFlag command which is bad known from general programmers.

This topic is closed to new replies.

Advertisement