Skip to main content

OpenGL


OpenGL is an interface to graphics hardware. The GL stands for Graphics Library. It provides commands for specifying geometric objects in two or three dimensions, and for controlling how these objects are drawn on the display. Objects, in this case, are points, lines, polygons, images, and bitmaps.

How to Install in Microsoft Visual Studio:
After downloading glut-3.7.6-bin.zip

  1. Copy all the .h files into the C:\Program Files\Microsoft SDKs\Windows\v6.1\Include\GL folder. This should be glut.h, freeglut.h, freeglut_ext.h, and freeglut_std.h.
  2. Copy all the .lib files into the C:\Program Files\Microsoft SDKs\Windows\v6.1\Lib folder. This should be freeglut.lib and glut32.lib.
  3. Copy all the .dll files into the C:\Windows\system32 folder. This should be freeglut.dll and glut32.dll.

For Details:
http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studio_Express_2008


My first Program

Open a c++ project in VS 2005/2008/2000
Select win32 Console Applocation
Click Finish.
Then Copy the program & Run it.
Let me know if u face any problem.

triangle.c

#include
/*
* triangle.c -- A simple example of OpenGL and GLUT.
*/

#include

void displayCB(void) /* function called whenever redisplay needed */
{
glClear(GL_COLOR_BUFFER_BIT); /* clear the display */
glColor3f(1.0, 1.0, 1.0); /* set current color to white */
glBegin(GL_POLYGON); /* draw filled triangle */
glVertex2i(200,125); /* specify each vertex of triangle */
glVertex2i(100,375);
glVertex2i(300,375);
glEnd(); /* OpenGL draws the filled triangle */
glFlush(); /* Complete any pending operations */
}

void keyCB(unsigned char key, int x, int y) /* called on key press */
{
if( key == 'q' ) exit(0);
}

int main(int argc, char *argv[])
{
int win;

glutInit(&argc, argv); /* initialize GLUT system */

glutInitDisplayMode(GLUT_RGB);
glutInitWindowSize(400,500); /* width=400pixels height=500pixels */
win = glutCreateWindow("Triangle"); /* create window */

/* from this point on the current window is win */

glClearColor(0.0,0.0,0.0,0.0); /* set background to black */
gluOrtho2D(0,400,0,500); /* how object is mapped to window */
glutDisplayFunc(displayCB); /* set window's display callback */
glutKeyboardFunc(keyCB); /* set window's key callback */

glutMainLoop(); /* start processing events... */

/* execution never reaches this point */

return 0;
}


Comments

Popular posts from this blog

Creating dynamic email templates using C# and Office Outlook

It is quite common for many applications to send automated email notifications. Couple of months ago, I have worked on improving our old email template format to make it more user friendly.
In this tutorial I will walk you though regarding how I took advantage of Microsoft Outlook to quickly generate custom email template and later using the html template for building an automated custom email application using C#.

Steps:Creating Templates: Using the rich text editor support  in Outlook create a nicely formatted email. Use placeholder text for the values you like to change dynamically based on your task completion status.

To keep this tutorial simple, I have created a  simple table with placeholder text inside the third bracket [place holder text]. However, you can use anything supported by outlook editor.Getting HTML code: Send the created email to your own address. After that, open the sent email and right click to view source. It will display the HTML source of the email body with …

Book Review - The Phoenix Project

Here at Skybox Labs, we do regular lunch and learn session where a fellow colleague present on topics ranging from clean code, continuous integration, game development, machine learning to almost any areas where there are reasonable interests.

One of the very recent lunch and learn series that I have attended was focusing on DevOps which got me interested to learn more about the topic. I was looking for recommended books and the lead presenter highly recommended that I start with 'The Phoenix Project' by Gene Kim

Being inspired by the stellar reviews in Amazon, I have decided to get a copy and read it over the weekend.
A fantastic book that contains a wealth of information and delivers it in an intelligent and interesting way; a story. The book successfully captures the events and struggles of most people who work in IT Operations and gives a very good explanation on why these problems exist, and how you can solve them. It portrays a very effective way of thinking in applying …

Persian Music - Homayoon - Nemitonam English lyrics

I love this song. I have requested one of my Persian friend to translate it for me and she did really nice job.. I am sure you will love it..
"

"The person who was the only person I had,
was the only refuge of my lonely heart,
Left me alone and went from my side
I am restless form the pain of her separation

I thought she stays with me
sings love song for me
I thought she understand my words
I didn’t know she’s unkind

Though gone, but still
I am full of her love
Her thought is always with me
Wherever I go, she is in front of my eyes, in front of my eyes
I want to stand out
find a way to reduce my pain of her separation
But it is not possible, There is no way
I cannot bear
I cannot bear

The person who was the only person I had,
was the only refuge of my lonely heart,
Left me alone and went from my side
I am restless form the pain of her separation

I thought she stays with me
sings love song for me
I thought she understand my words
I didn’t know she’s unkind

Though gone, but still
I …