Header Ads

logo design using opengl and glut by c++(part-3)

logo design using OpenGL and glut by c++


#include <windows.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif

#include <stdlib.h>

#include <GL/gl.h>
#include <GL/glut.h>
void display(void)
{
/* clear all pixels */
glClear (GL_COLOR_BUFFER_BIT);
/* draw white polygon (rectangle) with corners at
* (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)
*/
//triangle part
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f (0.30, 0.30, 0.0);//horizonltal line
glVertex3f (0.70, 0.30, 0.0);

glVertex3f (0.30, 0.30, 0.0);//vertical middle line
glVertex3f (0.30, 0.50, 0.0);

glVertex3f (0.30, 0.50, 0.0);//vertical line ar satr vitorer 1st point
glVertex3f (0.40, 0.60, 0.0);

glVertex3f (0.40, 0.60, 0.0);//vitorer 2nd line
glVertex3f (0.45, 0.50, 0.0);

glVertex3f (0.45, 0.50, 0.0);//vitorer 3rd line
glVertex3f (0.60, 0.70, 0.0);

glVertex3f (0.60, 0.70, 0.0);//vitorer last line
glVertex3f (0.70, 0.60, 0.0);

glVertex3f (0.70, 0.60, 0.0);//last line horizontal ar sate connect
glVertex3f (0.70, 0.30, 0.0);

glEnd();
//horizontal part ses

glColor3f (1.0, 0.0, 0.0);
glBegin(GL_LINES);


glVertex3f (0.30, 0.50, 0.0);//right side ar dik diye vitorer 1st line
glVertex3f (0.40, 0.60, 0.0);

glVertex3f (0.40, 0.60, 0.0);//right side ar dik diye vitore 2nd line
glVertex3f (0.45, 0.50, 0.0);

glVertex3f (0.45, 0.50, 0.0);//right side ar dik diye 3rd line
glVertex3f (0.60, 0.70, 0.0);

glVertex3f (0.60, 0.70, 0.0);//right side ar dik diye last line
glVertex3f (0.70, 0.60, 0.0);

glVertex3f (0.70, 0.60, 0.0);
glVertex3f (0.70, 0.80, 0.0);

glVertex3f (0.70, 0.80, 0.0);
glVertex3f (0.30, 0.80, 0.0);

glVertex3f (0.30, 0.80, 0.0);
glVertex3f (0.30, 0.50, 0.0);
glEnd();
/* don't wait!
* start processing buffered OpenGL routines
*/
glFlush ();
}
void init (void)
{
/* select clearing (background) color */
glClearColor (0.0, 0.0, 0.0, 0.0);
/* initialize viewing values */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
/*
* Declare initial window size, position, and display mode
* (single buffer and RGBA). Open window with "hello"
* in its title bar. Call initialization routines.
* Register callback function to display graphics.
* Enter main loop and process events.
*/
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (100, 100);
glutCreateWindow ("hello");
init ();
glutDisplayFunc(display);
glutMainLoop();
return 0; /* ISO C requires main to return int. */
}
logo 

No comments

Theme images by caracterdesign. Powered by Blogger.