OpenGl 1.Cpp
-
Upload
tarekhemdan -
Category
Documents
-
view
212 -
download
0
Transcript of OpenGl 1.Cpp
-
8/20/2019 OpenGl 1.Cpp
1/1
//windows library for API//
#include"windows.h" //
///////////////////////////
//main headers in opengl //
#include"Gl/gl.h" //
#include"Gl/glu.h" //
#include"Gl/glaux.h" //
///////////////////////////
// using opengl libraries//////////////
#pragma comment (lib,"OpenGL32.lib") //
#pragma comment (lib,"glu32.lib") //
#pragma comment (lib,"glaux") //
///////////////////////////////////////
void CALLBACK display(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glMatrixMode(GL_PROJECTION);glLoadIdentity();
glBegin(GL_TRIANGLES);glVertex3f( 0.0f, 1.0f, 0.0f);glVertex3f(-1.0f,-1.0f, 0.0f);glVertex3f( 1.0f,-1.0f, 0.0f);glEnd();
glFlush();}//function to draw in open gl window
void main(){
auxInitDisplayMode(AUX_RGB);//properties of opengl window
auxInitPosition(200,200,300,300);//position & size of opengl window
auxInitWindow(L"Example");//name of the window
auxMainLoop(display);//use display function to draw on opengl window
}