PDA

View Full Version : Urgent glHelp( )!!



SpaceGhost
04-28-2003, 09:41 AM
Hi all,

I am having trouble with glePolyCylinder.
glePolyCylinder (n, dpts,dcol,.006);
I am trying to replace GL_LINES with the poly extrusion to emulate a tool path with a radius of 6 thousandths. Here is were it gets a bit rediculas. I think I have to use a width of 1.0f or height, so that last parameter would have to be at least 1.0f.

What can be done to scale graphics with OpenGL to some real size...so that it is at least proportional?

Help please

SpaceGhost

Deiussum
04-28-2003, 09:51 AM
Never used the gle stuff, but scale is all about how you define it. There's nothing that says you need to have polys that are greater than 1. You could for instance, set an orhtographic projection where the left plane is -0.1, and the right plane is 0.1, and then draw a line from -0.004 to 0.004.

Obviously, as you use smaller numbers like this, you are more likely to run into rounding errors in floating point numbers, though. It might be better to multiply everything by 100, or some other multiple of 10.

SpaceGhost
04-28-2003, 10:05 AM
Is there a polyline command, or something that is not part of gle32 that I do not know about? I just need some sort command I can use to generate a cylindrical path.

Thanks SG

SpaceGhost
04-28-2003, 10:16 AM
And thanks for your reply D.
-SG

shinpaughp
04-28-2003, 10:54 AM
GL_LINE_STRIP or GL_LINE_LOOP

SpaceGhost
04-28-2003, 11:23 AM
Originally posted by shinpaughp:
GL_LINE_STRIP or GL_LINE_LOOP

Ok, great!
..and how do you suggest I show a line width of .006? would glLineWidth(.006)work?

Thanks Shin,
-SG

Gavin
04-28-2003, 12:09 PM
Scale up by a thousand! so you have line width of 6

nexusone
04-28-2003, 12:13 PM
First openGL size should be treated as relative size and scale.

If this is for a CAD program, you convert you exact measurements to relative for drawing to the screen.

X line maybe 0.006 thick, but since your monitor's resolution will not let you draw a line that size you just draw the line relative to other lines.

So a 0.006 maybe 6 gl units in width and a 0.010 would be 10 gl units to show diffrence in size.

You just store in a seperate variable what each line real value is, when the user draws the line on the screen.

data example:

line // What we are drawing.
X1,Y1,Z1 //Starting point of line in real terms
X2,Y2,Z2 // Ending point of line in real terms.
0.006 // Real width of line.

Note when displaying the line, screen size will very based on zoom and scaling, but not the real size.

Hope this helps.



Originally posted by SpaceGhost:
Ok, great!
..and how do you suggest I show a line width of .006? would glLineWidth(.006)work?

Thanks Shin,
-SG

SpaceGhost
04-29-2003, 02:59 AM
Sounds correct nexusone, thanks for your reply.

I had thought I might do a thing like that, but I guess what threw me was that I could use units like .001 when assigning vertices and other glXXX3d() functions.

glEnable(GL_LINE_SMOOTH) was supposed to allow for a Line Width less than 1.0f, but when I tried the width, it seemed to fail.

SpaceGhost

Deiussum
04-29-2003, 04:40 AM
I think glLineWidth sets the width of the line in pixels, not in the virtual coordinates of the scene.

SpaceGhost
04-29-2003, 05:54 AM
Originally posted by Deiussum:
I think glLineWidth sets the width of the line in pixels, not in the virtual coordinates of the scene.

Mmmmmm...TY D.