Lecture04 - Introduction to OpenGL - IntroductiontoOpenGL

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to OpenGL Introduction to OpenGL
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The Programmer’s Interface The Programmer’s Interface Programmer sees the graphics system through a software interface: the Application Programmer Interface (API)
Background image of page 2
OpenGL Libraries OpenGL Libraries GL ( G raphics L ibrary): Library of 2-D, 3-D drawing primitives and operations API for 3-D hardware acceleration GLU ( GL U tilities): Miscellaneous functions dealing with camera set-up and higher-level shape descriptions GLUT ( GL U tility T oolkit): Window-system independent toolkit with numerous utility functions, mostly dealing with user interface
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Software Organization Software Organization GLUT GLU GL GLX, AGL or WGL X, Win32, Mac O/S software and/or hardware application program OpenGL Motif widget or similar
Background image of page 4
OpenGL function format OpenGL function format gl Vertex 3 f (x,y,z) belongs to GL library function name x,y,z are floats glVertex3f v (p) p is a pointer to an array dimensions
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
simple.c simple.c #include <GL/glut.h> void mydisplay(){ glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_POLYGON); glVertex2f(-0.5, -0.5); glVertex2f(-0.5, 0.5); glVertex2f(0.5, 0.5); glVertex2f(0.5, -0.5); glEnd(); glFlush(); } int main(int argc, char** argv){ glutCreateWindow("simple"); glutDisplayFunc(mydisplay); glutMainLoop(); }
Background image of page 6
Event Loop Event Loop Note that the program defines a display callback function named mydisplay Every glut program must have a display callback The display callback is executed whenever OpenGL decides the display must be refreshed, for example when the window is opened The main function ends with the program entering an event loop
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/05/2010 for the course COMPUTER S 876 taught by Professor Ch during the Spring '10 term at Amirkabir University of Technology.

Page1 / 22

Lecture04 - Introduction to OpenGL - IntroductiontoOpenGL

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online