Archived

This topic is now archived and is closed to further replies.

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

This topic is 5949 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

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);

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

Share on other sites
use

glBegin(GL_LINE_STRIP);
//point a
//point b
//point c
//point d
//point ect...
glEnd();

Share on other sites
I''d rather use GL_LINE_LOOP

Share on other sites
What''s the difference between strip and loop? I''ve never hearth of the loop thing..

When do you use that?

Share on other sites
A line strip connects points.
A line loop connects points and then goes back to the beginning point.

k Thnx

Share on other sites
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

Share on other sites
heh thx i didnt know about all that stuff

Share on other sites
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

Share on other sites
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.

1. 1
2. 2
3. 3
4. 4
5. 5
Rutin
11

• 12
• 19
• 10
• 14
• 10
• Forum Statistics

• Total Topics
632665
• Total Posts
3007711
• Who's Online (See full list)

There are no registered users currently online

×