Learning OpenGL

I have Computer Graphics and Image Processing subjects in my curriculum. So as a part of curiosity to learn something new. I started OpenGL.

This is my first program:

Screenshot from 2015-02-13 15:00:02

#include<GL/gl.h>
#include <GL/glut.h>
void display(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glOrtho(0.0, 1.0, 0.0, 1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glColor3f(0.8,0.7,0.6);
glVertex3f (-0.75, -0.75, 0.0);
glVertex3f (0.0, 0.75, 0.0);
glVertex3f (0.75, -0.75, 0.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE| GLUT_RGB);
glutInitWindowSize (900, 900);
glutInitWindowPosition (100, 100);
glutCreateWindow (“hello”);
glutDisplayFunc(display);
glutMainLoop();
return 0;
}

Advertisements

About Jasleen Kaur

Hi, I am Jasleen kaur, a Computer Science Student.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s