PDA

View Full Version : Help!: Drawing objects with OpenGL(similar to the "Paint" program under windows)



slai11
10-03-2001, 08:57 PM
Hi everyone,
I'm doing a programm in VisualC++6 and have the following problem: I would like to Drawing lines (and other objects, ie squares, circles, etc) with OpenGL(like the Paint program in windows)with a MFC application.

I've created a MFC application that is linked to OpenGL. How do I created functions like the ones we see in the "Paint" program found in windows accesories?

For example, if I click on the menu which as a "draw lines" function and after clicking on that, I would like to use the mouse to draw lines, (line starts when the mouse is clicked and dragged. Then the line stops when mouse is released).

I'm having great difficulty doing this and if anyone can help it would be greatly appreciated.
Thank you in advance!
Steve

Gavin
10-04-2001, 12:45 AM
Two ways I can think of doing that. If you don't need to alter the object, such as just drawing a freehand line you could bitmask it, saves redrawing all the points from an array. Or save all the pixel positions, i.e.
onmousemove
array[n].x = mouse_x;
array[n].y = mouse_y;

then you can loop through this array and draw all the pixels.

For curves use bezier curves and just store the control points.

You can use selection buffers for dragging points, or just use mouse co-ordinates.

gav