PDA

View Full Version : How to code Paint in Opengl



libra
07-28-2002, 05:09 PM
i need help to code a simple openGL program for Paint...can anyone help me please.

jubei_GL
07-28-2002, 05:27 PM
you don't use OpenGL for paint .. Use Win32 api for drawing stuff..

libra
07-28-2002, 05:54 PM
but i need to use OpenGL for the project. its actually to code a simple paint program where i can generate circle, elipse, square, dashed line, dotted line and straight line but i have no idea how to start coding, i mean how to integrate the codings for each of this primitive data types.

07-28-2002, 07:26 PM
The first step is to crosspost, this will get everyone mad and really rarin' to help you.

Next, don't bother studying the material you probably have. Bothering other people to tell you things again is a better way to get information.

nexusone
07-29-2002, 04:51 AM
OpenGL is not a good for bitmap paint, but can be used to make vector drawings.

You will need to setup a object array variable to store your drawn objects
example:

typedef struct
{
int type; // 0=line, 1= box, etc.
int x1, y1, z1, x2, y2, z2; // 1 = first point of line or corner of box, 2 end point or corner.
int color_r, color_g, color_b; //color of object.
}Object;

static Object Object_store[100]; // create space for 100 objects.

Just read the mouse button, when down store the x,y from the mouse in x1,y1.
When mouse button is released store the value in x2,y2.


Originally posted by libra:
i need help to code a simple openGL program for Paint...can anyone help me please.