zada

08-22-2004, 05:59 PM

just want ask if anybody here have or can teach me how to create circle using bresenham method with coding that using reflection,translate,rotate and scale.

View Full Version : help me with coding cpp+glut

zada

08-22-2004, 05:59 PM

just want ask if anybody here have or can teach me how to create circle using bresenham method with coding that using reflection,translate,rotate and scale.

mikael_aronsson

08-23-2004, 03:01 AM

Hi !

The bresenham algorithm is used to draw straight lines and have nothing to do with circles, you can use sin/cos to calculate sample points on a circle and use the brsenham algorithm to draw line segments between thoose sample points.

If you search google you will get help on the bresenham algorithm, if you do want to do it yourself instead of letting openGL do it (use glbegin( GL_LINE_STRIP); ).

OpenGL does not support reflection, but it can be faked a number of ways, a number of descriptions on this is also available with a quick google search.

Any OpenGL tutorial will explain how to do transformations.

Mikael

The bresenham algorithm is used to draw straight lines and have nothing to do with circles, you can use sin/cos to calculate sample points on a circle and use the brsenham algorithm to draw line segments between thoose sample points.

If you search google you will get help on the bresenham algorithm, if you do want to do it yourself instead of letting openGL do it (use glbegin( GL_LINE_STRIP); ).

OpenGL does not support reflection, but it can be faked a number of ways, a number of descriptions on this is also available with a quick google search.

Any OpenGL tutorial will explain how to do transformations.

Mikael

ZbuffeR

08-23-2004, 01:11 PM

The bresenham algorithm is used to draw straight lines and have nothing to do with circlesExcuse me, but Bresenham worked hard not only on lines but on circles and xy radius ellipses too.

Java code :

http://www-students.biola.edu/~jeremyb/CompGraphics/BresenhamCircle.html

More detailed explanation :

http://www.gamedev.net/reference/articles/article767.asp

Java code :

http://www-students.biola.edu/~jeremyb/CompGraphics/BresenhamCircle.html

More detailed explanation :

http://www.gamedev.net/reference/articles/article767.asp

dorbie

08-23-2004, 03:04 PM

OpenGL does support reflection depending on your definition. In this context the reflection discussed may be the symmetry exploits for fast circle drawing.

This has nothing to do with OpenGL, about all you'd use OpenGL for is to draw an final image or plot points in 2D. You should use OpenGL to draw a circle with a lineloop without Bresenham's algorithm if this is anything other than an exercise.

This has nothing to do with OpenGL, about all you'd use OpenGL for is to draw an final image or plot points in 2D. You should use OpenGL to draw a circle with a lineloop without Bresenham's algorithm if this is anything other than an exercise.

zada

08-23-2004, 06:39 PM

hi...

thank to all for the information...i appreciate that...

thank to all for the information...i appreciate that...

zada

08-23-2004, 06:59 PM

hi mikael,

just want to ask,do you have any example create circle using brensenham using C++?for your information i have coding using java to create cirlce but unfortunely i did not familiar with it.can u help me?

just want to ask,do you have any example create circle using brensenham using C++?for your information i have coding using java to create cirlce but unfortunely i did not familiar with it.can u help me?

mikael_aronsson

08-24-2004, 02:34 AM

Hi !

Sorry had no idea he did circles also :)

you can use the java code pretty much as it is, java and C++ is very much alike in terms of syntax, the Point() and myLine() methods do the drawing (a point or a line) and that would be done with OpenGL in your case I guess.

This is how you draw points and lines with OpenGL...

glBegin( GL_POINTS);

glvertex2d( x, y);

glEnd();

glbegin( GL_LINES);

glVertex2d( x1, y1);

glVertex2d( x2, y2);

glEnd();Mikael

Sorry had no idea he did circles also :)

you can use the java code pretty much as it is, java and C++ is very much alike in terms of syntax, the Point() and myLine() methods do the drawing (a point or a line) and that would be done with OpenGL in your case I guess.

This is how you draw points and lines with OpenGL...

glBegin( GL_POINTS);

glvertex2d( x, y);

glEnd();

glbegin( GL_LINES);

glVertex2d( x1, y1);

glVertex2d( x2, y2);

glEnd();Mikael

zada

08-24-2004, 06:52 PM

thank mikael

zada

08-25-2004, 05:27 PM

hi zbuffer,

do u have any example that is using C++ to create cirlce using bresenham?i'm fail when i'm create using Java that u give me..thank you..

do u have any example that is using C++ to create cirlce using bresenham?i'm fail when i'm create using Java that u give me..thank you..

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.