Search Projects

Wednesday, July 2, 2014

New graphics editor Opengl mini Projects

We came across with graphics editor Opengl mini Projects in our earlier post. In this post we are going to see new graphics editor project. It is similar to in work with the previous project but an advance version. It is also a replica of MS paint provides many options that are not in the previous projects like - Triangle, Square, Circle, Parallelepiped, Pencil, Ellipse etc. These extra option like Triangle standalone draw the figure so you need not to work on the line most of the time, one click figure, thus saving the time.

New graphics editor Opengl mini Projects


Before we go on to the functionality let's clear about the few feature of this Opengl mini Projects.

1. The whole application has three user interface block - first the figures selectors (tools), second draw panel, third and last the color panel for selecting the specific color.

2. There are range of figures or tools to choose - LINE, TRIANGLE, SQUARE, ERASER, CIRCLE, EXIT, CCTRIANGLE, CCSQUARE, CYLINDER, BULLET, PARALLELEPIPED, SPRAY, MESH, TEXT, PENCIL, BRUSH, ELLIPSE, CLEAR. All these tools are having functionality as per their name.

3. The TEXT tool allows to have text typed rather than drawing it. There is no option for font family and sizes.

4. The color option having many shades to choose for the drawing. The only thing that lack is the color eavesdropping.

5. In the Draw panel we can see different shapes that can be drawn there by moving the mouse with the tools selected in appropriated color.

6. The last Exit button in the tools allows to close the program.

This Opengl mini Projects uses the important glut functions, that I am going to discuss here. The function are - glutMotionFunc() and glutPassiveMotionFunc(). These functions provides for the motion detection of mouse.It is similar like we detect the mouse click with glutMouseFunc(). The glutMotionFunc() detects the active motion (mouse is moved and button is pressed) while the glutPassiveMotionFunc() detects passive motion (mouse is moved but button is not pressed).

The signatures for the GLUT functions are as follows: 

void glutMotionFunc(void (*func) (int x,int y)); 
void glutPassiveMotionFunc(void (*func) (int x, int y)); 

Parameters: func - the function that will be responsible for the respective type of motion. 

The parameters for the motion processing function are the (x,y) coordinates of the mouse relatively to the upper left corner of the window's client area.

The Mouse click and motion are the major functionality of the project while we have figure predefined with primitive calls. Color selection and display uses the array. Keyboard function for entering the text when text tool is selected. There are whole bunch of things there. 

How you like this project? Download the source code of the project and do comments about it in the comment box.

Advance graphics editor Opengl mini Projects Source Code -

No comments:

Post a Comment