paint program

I’m trying to create a paint program, but I’ve never used openGL before and I’m really confused.
you know how in paint you can draw a mouse button and have the rectangle you are drawing get displayed as you move the mouse and then when you release the button it draws permanently? how do you accomplish that? also, how would I create a toolbar?
thanks so much! any hints would be awesome

i would use a ortho projection. -> try this tutorials to get started!

I’m sorry I’m still really confused, I know that openGL has functions like glutAddMenu and such but these are only for popup menus right? how do you get a permanent toolbar? what are these toolkits and widgets I keep reading about? also, I wanted to try to accomplish rubberbanding, when you want to have interactive drawing where as the user moves the mouse the line is drawn and the old one is erased until the button is released. thanks soooo much!!!

should I use selection and picking? are these reasonable ideas? thanks again!

toolbars have nothing to do with opengl. same as glutaddmenu or stuff like that.

you could use a gui api to create the toolbars of the system. (MFC, cocoa, for example). you can also render your own gui (there are also opengl gui libaries) in this case it is possible to use picking but there are a lot of possibilities.

if you want something like the first suggestion:

examples for visualC++:

otherwise search on for opengl gui or draw your own gui.

Originally posted by painter:
should I use selection and picking? are these reasonable ideas? thanks again!
You’ll need to use picking if and only if you’ll have to select some objects drawn by the mouse, like for modelers. Otherwise, I guess you won’t need it. Just know where your mouse is and what button was clicked should suffice.

thank you so much, I found several helpful libraries, thanks! what about implementing the ability to fill a certain region of the canvas? the “fill” in paint programs fills in areas closed by edges of some sort. any hints about what functions may be useful for this? thanks again!

oh and a quick question about picking and selection, say I name a square the user draws and a circle is drawn on top of it, then the user wants to move the circle, is the part of the square underneath the circle still there? how does the layering thing work?