republican-creole
site Search:


 
    All Forums Hot Topics Gallery






how-to block ads


 
Search Topic:
Share Topic
Posting?
Post a:
Post a:
Links: ·How To Get Noticed ·Web Monks FAQ ·Webhosting FAQ ·Posting Code ·How To Post ·Webhosting forum
AuthorAll Replies


Bach
I'll Be Bach
Premium
join:2002-02-16
Flint, MI

reply to me1212

Re: OpenGL ellipses with GL_TRIANGLE_FAN? Anyone know about them

Use a different value for "radius" in the calculation of the x and y coordinate, e.g. "1.5f * radius" for the x value and leave the y as is.

me1212

join:2008-11-20
Pleasant Hill, MO

1 edit

Thank you so much, that worked! I have one more thing I've been wondering though, how would I go about placing the circle inside of the ellipse? I tried having it draw the ellipse then circle right after each other, called the drawEllipse function the immediately after that was done I called the drawCircle function, but that just made HAL9000 show up on my screen. I used black for the ellipse and red for the circle.



Bach
I'll Be Bach
Premium
join:2002-02-16
Flint, MI
Reviews:
·Comcast

Since you are drawing in 2D, all objects have the same Z value. OpenGL still does depth checking even though everything is at the same depth. Consequently the larger ellipse has already drawn in the affected area and the circle gets ignored.

A couple ways to get around this:

1. Draw the smaller object (circle) first, then the ellipse.

or 2. Call glDepthFunc(GL_LEQUAL); once before you start any drawing. This will allow pixels at the same depth to be overwritten.


me1212

join:2008-11-20
Pleasant Hill, MO

1 edit

Never mind, I'm a derp who accidentally called swapbuffers after each function and that made it not work right.



Bach
I'll Be Bach
Premium
join:2002-02-16
Flint, MI
Reviews:
·Comcast

Yeah, I'm a derp as well in the mis-advice I gave on the Z buffer.

My test program had GL_DEPTH_TEST enabled, which is probably not the case in your program since it defaults to off.


me1212

join:2008-11-20
Pleasant Hill, MO

Its all good man, having the glDepthFunc(GL_LEQUAL); still in my program doesn't seem to be making a difference, plus now I know how to use it. I'm sure it will come in handy down the road.


Wednesday, 19-Jun 17:59:06 Terms of Use & Privacy | feedback | contact | Hosting by nac.net - DSL,Hosting & Co-lo
over 13.5 years online © 1999-2013 dslreports.com.
Most commented news this week
Hot Topics