Graphics and steep OpenGL learning

Hello friends,

I want to have some basic rounded shape rectangles with some transparency and a border. Seems like a nice thing to have in one’s toolkit. I started with the assumption that it would be something easily doable (atleast to me).

After a couple of hours of googling, I was taken to openGL texture mapping where I have to load a rounded shape rectangle png image and applying some sort of blending.

To post one of the link I found from google:…–id=363153

To me, this was very discouraging. Not that I dont want to learn texture in GL, but, that this rounded shape rectangle thing should not be so complex to achieve.

Do we have some ofx addons (shamelessly asking for code) :lol: that I can use for such a thing. If you guys can think of some easier way to achieve this, please let me know.

Many thanks in advance,

Hello Dece:
I have just post an addon I have been working on. It seams is what you here asking for… some basic rectangle shapes with round corners… It have more stuff like video and text conteiners.

Tthe basic conteiner class (ofxBlackBox) you can found a the source for making round rectangular shapes. Something like this:

        float a = height/6* scale;  
	float b = a/4;  
	float W = width/2* scale;  
	float H = height/2* scale;  
	ofVertex(		W -a,	-H );  
	ofBezierVertex( W -b ,	-H,  
					W    ,	-H +b,   
					W    ,	-H +a);  
	ofVertex(       W    ,	H -a);  
	ofBezierVertex( W    ,	H -b,  
					W -b ,	H,  
					W -a ,	H);  
	ofVertex(       -W +a , H );  
	ofBezierVertex( -W +b , H,  
					-W    , H -b,  
					-W    , H -a );  
	ofVertex(       -W    , -H +a );  
	ofBezierVertex( -W    ,	-H +b,  
					-W +b , -H,  
					-W +a , -H );  
	ofVertex(		W -a,	-H );  

At the end it will look like this:

I hope this helps


Thanks a lot my friend. Appreciate your help.

I will check out this addon. Looks like exactly what I want. Many thanks again for your generous help.

  • Dece