PDA

View Full Version : 3D screen precision of OpenGL



alneam
09-24-2012, 05:28 AM
hello everybody....
when i need to draw line by one of line algorithms using glvertix3f , it seemed to be as number of points in a Straight line , but my problem is that there is many of free pixels appeared between each two adjacent point , So how can I exceed this problem and make each two adjacent points be Convergent , also the Straight line appear smooth ??

the problem that drawing line appear as folow::
.................................................. .................................................. ...................

But i need it smooth as follow:
__________________________________________________ ________________________


thanks in advance

Dan Bartlett
09-24-2012, 05:53 AM
Are you using GL_LINES? Try using GL_LINE_STRIP.

alneam
09-24-2012, 06:58 AM
Are you using GL_LINES? Try using GL_LINE_STRIP.

thanks for reply

Non of them .............. I need to apply the bresenham algorithm that calculate the pixels and draw it using glvertex3f command ....

The idea that in 3D there is many of free pixels appear between any two adjacent points ,,,,,,,,,,, how can i process it ??

for acknowledge while using the same algorithm in C++ the line appear smooth___________________________________

michagl
09-25-2012, 07:29 PM
You might want to post an image if you can. In general consumer cards are not up to nice looking line drawing nowadays. You need a workstation card (more expensive) to do that, or you can draw chunky lines made out of triangles. There may be other techniques depending on what needs to be done.

EDITED: BTW you are not doing glBegin(GL_LINE...) ? That would be a problem if so.

Dan Bartlett
09-26-2012, 04:03 AM
thanks for reply

Non of them .............. I need to apply the bresenham algorithm that calculate the pixels and draw it using glvertex3f command ....

The idea that in 3D there is many of free pixels appear between any two adjacent points ,,,,,,,,,,, how can i process it ??

for acknowledge while using the same algorithm in C++ the line appear smooth___________________________________

So you're drawing the line using GL_POINTS? Why are you doing this? For educational purposes?

Does your algorithm handle the bresenham algorithm correctly in all 8 octants? If your algorithm doesn't handle all octants correctly it's possible to get gaps between the points generated.
If you're drawing points with size > 1.0 + anti-aliasing is on, then perhaps that could cause problems too when drawing points that overlap.