# so ellipses are really rectangles?

I’ve been experimenting with the rotate and translate functions intandem with the ellipse.

What Ive found is that even with noStroke being used no matter what the background color is?
There is a rectangle that is filled with that color and then the ellipse is grafted into it with its fill color.

This would not have been noticeable had it not been used intandem with another ellipse but I used it with another facing a different direction.

Is there any way to remove the ellipse’s external background color rectangle?

Cause what Im saying ive noticed is hat there is a rectangle outside of every ellipsethat has ever been drawn.

otherwise im thinking im going to have to do a screencap and set the background alpha to 0 so it wont be capture

``````background( 0,0,0,0)
``````

then save it and use that sprite as an ellipse.

in otherwords we dont really have any ellipses do we?

All we have are rectangles.
Some that are straight up rectangles and some that are made to look like circles.

Can you post some example code that exhibits the issue you are describing?

Ellipses are rendered as a shader into two triangles that form a rectangle, but their exterior region is transparent (or should be!).

The only time you will see issues with this is if you attempt to render multiple ellipses at arbitrary Z orderings (generally in 3D scenes). In these scenes you would need to render transparent objects back-to-front to get the correct appearance.

(Edit: If you want to make an ellipse out of actual geometry, you can look at using meshes to construct triangles in the shape of a circle. My mesh example here does this: http://twolivesleft.com/Codea/Talk/discussion/734/star-mesh )

Just to clarify, in the ordinary orthographic projection rendering multiple ellipses should behave correctly. If you are moving into 3D or custom z-orderings then you will need to be aware of transparency sorting.

sure here it is

``````function draw()

-- Use this nil condition to perform your initial setup
if Angle == nil then
clearOutput()

displayMode(STANDARD)
aspect = 0.482422

iparameter("FieldOfView", 1, 140, 45)
iparameter("CamHeight",-1000,1000,0)
iparameter("Angle",-180,180,0)
iparameter("bgr", 0, 255,255)--0)
iparameter("bgg", 0, 255,0)
iparameter("bgb", 0, 255,0)
iparameter("bga", 0, 255,0)

iparameter("leftright",0,WIDTH )
iparameter( "updown",0,HEIGHT)
iparameter("forwardbackward",0,WIDTH)

the3DViewMatrix = viewMatrix()
print("done")
end

-- This sets a background color

perspective(FieldOfView,aspect)
camera(0,CamHeight,300, 0,0,0, 0,1,0)

the3DViewMatrix = viewMatrix()

pushMatrix()
pushStyle()

translate(leftright,updown,forwardbackward)
rotate(Angle,0,1,0)

-- Do your drawing here
-- :draw()
background(bgr, bgg, bgb,bga)

translate(-25,10,0)
rotate(1,0,1,0)
noStroke()
fill(46, 28, 46, 255)
ellipse(0,0,25,25)
rotate(-1,0,0,1)
rotate(90,0,1,0)
noStroke()
fill(46, 28, 46, 255)
ellipse(0,0,25,25)
rotate(-90,0,1,0)
rotate(45,0,1,0)
noStroke()
fill(46, 28, 46, 255)
ellipse(0,0,25,25)
rotate(-45,0,1,0)
rotate(135,0,1,0)
noStroke()
fill(46, 28, 46, 255)
ellipse(0,0,25,25)
rotate(-135,0,1,0)
rotate(180,0,1,0)
noStroke()
fill(46, 28, 46, 255)
ellipse(0,0,25,25)

popStyle()
popMatrix()

-- Restore orthographic projection
ortho()

-- Restore the view matrix to the identity
viewMatrix(matrix())

end
``````

You’ll note that if you slide the Angle parameter to -50 you can see the rectangle behind the ellipse also note at 50 you can as well.

You can set the background colors and alphabto whatever you want. But even at 0 background alpha the problem still persists

Thanks @rexworthrs

That is normal behaviour for the ellipse() primitive. It’s a fundamental limitation of how OpenGL works.

The reason this happens is because fragment opacity does not effect the value written to the depth buffer. This article describes the effect (and how to work around it) in detail: http://www.opengl.org/wiki/Transparency_Sorting

A number of workarounds are available in the aforementioned article, or you can re-create ellipses using mesh (which will write correct values to the depth buffer).