PDA

View Full Version : About drawing lines



KurtCob
10-25-2000, 06:16 AM
Hello guys!
I made a application that can load DXF files, and display it on the screen, but in a wrong way, lets imagine that I draw two lines in AutoCAD, like this /\, then I saved it, and load it with my application I have the lines in this way \/, like mirrored, I tried to load the file in AutoCAD again, and in some other applications, and I have the lines in the good way "/\", can someone explain me why ?

Thank you for the moment
Best regards

Kurt

PS.: I'm drawing the lines with :

glBegin(GL_LINES);
glVertex3f(...);
glVertex3f(...);
glEnd();

Bob
10-25-2000, 06:22 AM
Most probably because AucoCAD uses the same window coordinates as Windows does. OpenGL uses a different coordinates system. In Windows, the origin is in the upper left corner, but in OpenGL it's in the lower left corner. You have to either convert all coordinates to OpenGL coordinates or setup you projection so that the origin is in the upper left corner.

The first suggestion is done by substracting the window height by the actual Y-coordinate you got.

The second method is probably the simpliest. Setup your viewing volume like this: gulOrtho2D(0,winX, winY, 0); where winX and winY is the size of the window. If you want, you can also add an offset to these coordinates to move the window in worldspace.

KurtCob
10-25-2000, 09:03 AM
Ok Bob,

Thank you, I will try to do this.

Best regards

Kurt