View Full Version : how to make a line look like a cylinder?
10-08-2003, 06:43 PM
For the performance reason, I want to provide a draft mode for drawing, in which drawing cylinders should be faster. Unfortunately, simply turning on the GL_LINE polygon mode is not accepted by my customers. I try to draw a line with the max line width instead of a cylinder. But a line just looks like a long rectangle. Do you have any other way?
Please help. Thanks.
10-08-2003, 09:50 PM
No, there is no easy better way. Thick lines are pretty poor in OpenGL and there's no good capping defined that might help you out.
You may want to try drawing a very simplified cylinder with significantly fewer polygons. Beyond this you're really getting into the realms of vertex programs to be practical.
If you're on an ATI card you may be able to use a very simple cylinder but still use the TRUFORM surface subdivision to make it rounded again with decent performance if you specify the normals correctly.
It really depends on how (in)efficient your software is now.
[This message has been edited by dorbie (edited 10-08-2003).]
10-09-2003, 02:59 AM
i thought you could use texture impostors, but that really depends on what you actually have to draw
10-09-2003, 03:43 AM
You can try a google on "Polyline quadstrips". The concept is to draw a billboarded texture along a spline.
10-13-2003, 01:58 PM
How about 5 quads?
One quad represents the Main cylinder section. You could texture this with a 1D texture representing the lighting of the clyinder from all angles (360 degrees)
Shift the 1d Texture according the the angle the viewer is looking at the cylinder's "forward" angle.
Have this quad rotate along the Y axis to face the user.
Make two more quads, facing inward, to cap the top and bottom. These would also rotate along the Y axis with the user. Same deal here, shift the 1d texture with rotation of cylinder -> user position. Make the quads look like circles by specifying a (2D) alpha mask for the quads (is this possible, given we're already using the 1D texture thing?)
The last two again cap the top and bottom but face upward. These have the same alpha mask, but are given a single color (it's a flat surface.)
I'm not sure how well this would work, but it sounds like an interesting idea.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.