DaleAT

10-24-2000, 05:56 PM

I've been trying to draw an oval shape or an elipse in opengl. I have figured out how to draw a sphere. But what I am really trying to do is find an elipse. Any help? txs

View Full Version : Drawing Elipses or Ovals in OpenGL

DaleAT

10-24-2000, 05:56 PM

I've been trying to draw an oval shape or an elipse in opengl. I have figured out how to draw a sphere. But what I am really trying to do is find an elipse. Any help? txs

Roach

10-25-2000, 03:36 AM

The only way I know how to do it is to specify the points that will be 'the elipse' and then use GL_LINE_LOOP to connect the dots.

Roach

Roach

jc

10-25-2000, 04:32 AM

You can use a sphere and scale with different values on each axes...

Spaceman

10-25-2000, 11:23 PM

This draws an elipse because of the multiplication from 1/2 with cos.

float PI=3.14159

for(float x=0.0; x<=2*PI; x+=0.06)

{

glBegin(GL_LINES);

glVertex2f(sin(x), 1/2 * cos(x));

glVertex2f(sin(x+0.06), 1/2 * cos(x+0.06));

glEnd();

}

float PI=3.14159

for(float x=0.0; x<=2*PI; x+=0.06)

{

glBegin(GL_LINES);

glVertex2f(sin(x), 1/2 * cos(x));

glVertex2f(sin(x+0.06), 1/2 * cos(x+0.06));

glEnd();

}

trickster

10-26-2000, 12:45 AM

assuming you want to scale your sphere in the x-axis do the glScalef(X,0,0) operation

where X is the amount you want to scale (e.g. if it is 2 then the sphere wil have double size in the x axis) http://www.opengl.org/discussion_boards/ubb/smile.gif

where X is the amount you want to scale (e.g. if it is 2 then the sphere wil have double size in the x axis) http://www.opengl.org/discussion_boards/ubb/smile.gif

julien

10-26-2000, 03:45 AM

Oups, I just wanted to correct the previous post, if you want to scale only on the X axis you can call glScale(X, 1,1) ...otherwise it will be "empty"

I guess you wrote it a bit too fast spaceman http://www.opengl.org/discussion_boards/ubb/wink.gif

I guess you wrote it a bit too fast spaceman http://www.opengl.org/discussion_boards/ubb/wink.gif

Spaceman

10-26-2000, 05:32 AM

@julien

Sure, glScale is an option but i think it's important to show the math behind this operation.

I prefer the manual way in many things.

Sure, glScale is an option but i think it's important to show the math behind this operation.

I prefer the manual way in many things.

11-08-2000, 10:32 AM

Originally posted by DaleAT:

I've been trying to draw an oval shape or an elipse in opengl. I have figured out how to draw a sphere. But what I am really trying to do is find an elipse. Any help? txs

Have you tried using the gluDisk or gluCylinder commands?By tweaking the inner and outer radius parameters you can get a decent ellipse.Or perhaps you can draw the sphere and rotate on the -z/z axis.

I've been trying to draw an oval shape or an elipse in opengl. I have figured out how to draw a sphere. But what I am really trying to do is find an elipse. Any help? txs

Have you tried using the gluDisk or gluCylinder commands?By tweaking the inner and outer radius parameters you can get a decent ellipse.Or perhaps you can draw the sphere and rotate on the -z/z axis.

monson

11-08-2000, 11:08 AM

there is a good tutorial that has a texture mapped object that when you press SPACEBAR it changes from square->circle->donut->sphere->partial disk, the partial disk part you may find interesting it shows how to draw partial or complete arcs. The tutorial is on NeHe Tutorials, unfortunately I cant give you any code , BECAUSE THEIR DAMN SYSTEM IS DOWN...

calm down, calm down.... It will be back up soon http://www.opengl.org/discussion_boards/ubb/smile.gif

calm down, calm down.... It will be back up soon http://www.opengl.org/discussion_boards/ubb/smile.gif

Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.