OpenGL CMSC340 3D Character Design & Animation. What is OpenGL? A low-level graphics library specification designed for use with the C and C++ provides…

Slides:



Advertisements
Similar presentations
SUJAN CHOWDHURY Lecturer, CSE, CUET
Advertisements

Computer Graphics - Graphics Programming -
Department of nskinfo i-education
OpenGL Open a Win32 Console Application in Microsoft Visual C++.
OPEN GL. Install GLUT Download package di sini Dari devcpp, buka Tools->PackageManager-
Lecture 3 Graphics Pipeline and Graphics Software
Line and Curve Drawing Algorithms. Line Drawing x0x0 y0y0 x end y end.
Chapter 2: Graphics Programming
OPENGL.
Computer Graphics CSCE 441
Pemrograman OpenGL Dasar
#include int line_width = 1; void Display( void ) { glEnable( GL_LINE_STIPPLE ); glClearColor (0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT);
CS 4731 Lecture 2: Intro to 2D, 3D, OpenGL and GLUT (Part I) Emmanuel Agu.
OpenGL Basics Donghui Han. Assignment Grading Visual Studio Glut Files of four types needed: – Source code:.cpp,.h – Executable file:.exe (build in release.
OpenGL (Graphics Library) Software Interface to graphics software Allows to create interactive programs that produce color images of moving 3D objects.
OpenGL (I). What is OpenGL (OGL)? OGL is a 3D graphics & modeling library Can also use it to draw 2D objects.
CSC 461: Lecture 51 CSC461 Lecture 5: Simple OpenGL Program Objectives: Discuss a simple program Discuss a simple program Introduce the OpenGL program.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Computer Science,
CENG477 Introduction to Computer Graphics Introduction to OpenGL, GLUT and GLUI.
Based on slides created by Edward Angel
Computer Graphics CS 385 February 7, Fundamentals of OpenGl and Glut Today we will go through the basics of a minimal OpenGl Glut project, explaining.
Chapter 03: Graphics Primitives Course web page: Chapter #3.
Reference1. [OpenGL course slides by Rasmus Stenholt]
Using Graphics Libraries Lecture 3 Mon, Sep 1, 2003.
Introduction to OpenGL and GLUT GLUT. What is OpenGL? An application programming interface (API) A (low-level) Graphics rendering API Generate high-quality.
Lecture 3 OpenGL.
Computer Graphics I, Fall 2010 Input and Interaction.
 “OpenGL (Open Graphics Library) is a standard specification defining a cross- language cross-platform API for writing applications that produce 2D and.
1 Figures are extracted from Angel's book (ISBN x) The Human Visual System vs The Pinhole camera Human Visual System Visible Spectrum Pinhole.
Managing Multiple Windows with OpenGL and GLUT
Introduction to GL Geb Thomas. Example Code int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode ( GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
CS 480/680 Computer Graphics Programming with Open GL Part 7: Input and Interaction Dr. Frederick C Harris, Jr. Fall 2011.
Interactive Computer Graphics CS 418 MP1: Dancing I TA: Zhicheng Yan Sushma S Kini Mary Pietrowicz Slides Taken from: “An Interactive Introduction to OpenGL.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Programming with OpenGL Review.
Introduction to OpenGL and GLUT. What’s OpenGL? An Application Programming Interface (API) A low-level graphics programming API – Contains over 250 functions.
Program 2 due 02/01  Be sure to document your program  program level doc  your name  what the program does  each function  describe the arguments.
1 Input and Interaction. 2 Objectives Introduce the basic input devices ­Physical Devices ­Logical Devices ­Input Modes Event-driven input Introduce double.
University of New Mexico
Chun-Yuan Lin Introduction to OpenGL 2015/12/19 1 CG.
NoufNaief.net TA: Nouf Al-harbi.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Programming with OpenGL Part 2: Complete Programs Ed Angel Professor.
GLUT functions glutInit allows application to get command line arguments and initializes system gluInitDisplayMode requests properties for the window.
OpenGL Basic Drawing 2003 Spring Keng Shih-Ling
1 Programming with OpenGL Part 2: Complete Programs.
OpenGL API 2D Graphic Primitives Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
OpenGL Basic Drawing Jian-Liang Lin A Smidgen of OpenGL Code #include main() { InitializeAWindowPlease(); glClearColor (0.0, 0.0, 0.0, 0.0); glClear.
Introduction to Graphics Programming. Graphics API.
Computer Graphics I, Fall Programming with OpenGL Part 2: Complete Programs.
OpenGL CS418 Computer Graphics John C. Hart. OpenGL: Event-driven How in OpenGL? Programmer registers callback functions Callback function called when.
CSC Graphics Programming Budditha Hettige Department of Statistics and Computer Science.
INTRODUCTION TO OPENGL
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
CS 480/680 Computer Graphics Programming with Open GL Part 2: Complete Programs Dr. Frederick C Harris, Jr. Fall 2011.
Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran
Basic Program with OpenGL and GLUT
Computer Graphics Lecture 33
Programming with OpenGL Part 2: Complete Programs
Materi Anatomi OpenGL Fungsi GLUT Posisi Kamera Proyeksi
The User Interface Lecture 2 Mon, Aug 27, 2007.
OpenGL API 2D Graphic Primitives
Programming with OpenGL Part 2: Complete Programs
גרפיקה ממוחשבת: מבוא ל-OpenGL
Coordinate Systems and Transforming the Coordinates
Introduction to OpenGL
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 2: Complete Programs
Managing Multiple Windows with OpenGL and GLUT
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 2: Complete Programs
Presentation transcript:

OpenGL CMSC340 3D Character Design & Animation

What is OpenGL? A low-level graphics library specification designed for use with the C and C++ provides… – a set of commands that allow the specification of geometric objects in two or three dimensions – graphics primitives – commands that control how these objects are rendered into the frame buffer

Libraries gl.h - GL foundation glu.h - GL utilities glaux.h - GL auxiliary glut.h - GL utility toolkit Gl.h Glaux.hGlu.h Glut.h

What does GLUT do for us? Allows us to initialize a GL program using fewer function calls than with just GL Allows us to still access the lower level GL, GLU and GLAUX calls

GLUT: main( ) void main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(100,100); glutInitWindowPosition(0,0); glutCreateWindow("GL Example"); init(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutIdleFunc(animate); glutMouseFunc(handleEvent); glutMainLoop(); } Command-line arguments Display mode tokens Window size and position Creates window Specifies display, reshape, idle and mouse functions Starts execution

glutInit ( ); Initialize the GLUT library and negotiate a session with the window system May cause the termination of the GLUT program with an error message to the user if GLUT cannot be properly initialized Processes command line options, but the specific options parse are window system dependent.

glutInitDisplayMode( ) GLUT_RGB – Bit mask to select an RGBA mode window. This is the default if neither GLUT_RGBA nor GLUT_INDEX are specified. GLUT_SINGLE /GLUT_DOUBLE – Bit mask to select a single buffered or double buffered window. GLUT_DEPTH – Bit mask to select a window with a depth buffer. GLUT_STEREO – Bit mask to select a stereo window.

glutInitWindowSize(int width,int height) glutInitWindowPosition(int x,int y) glutCreateWindow(Title) Windows created by glutCreateWindow will be requested to be created with the current initial window position (x,y) and size (width,height)

init( ) void init (void) { // Additional user specified GL calls, such as... glClearColor(1,1,1,0.0); glShadeModel(GL_SMOOTH); }

glutDisplayFunc( ) Sets the display callback for the current window When GLUT determines that the normal plane for the window needs to be redisplayed, the display callback for the window is called Before the callback, the current window is set to the window needing to be redisplayed and (if no overlay display callback is registered) the layer in use is set to the normal plane.

glutReshapeFunc( ) Sets the reshape callback for the current window The reshape callback is triggered when a window is reshaped A reshape callback is also triggered immediately before a window's first display callback after a window is created or whenever an overlay for the window is established The width and height parameters of the callback specify the new window size in pixels Before the callback, the current window is set to the window that has been reshaped

glutIdleFunc( ) Sets the global idle callback so a GLUT program can perform background processing tasks or continuous animation when window system events are not being received If enabled, the idle callback is continuously called when events are not being received

glutMouseFunc( ) Sets the mouse callback for the current window When a user presses and releases mouse buttons in the window, each press and each release generates a mouse callback The button parameter is one of GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON, or GLUT_RIGHT_BUTTON The state parameter is either GLUT_UP or GLUT_DOWN The x and y callback parameters indicate the window relative coordinates when the mouse button state changed

glutMainLoop( ) Enters the GLUT event processing loop This routine should be called at most once in a GLUT program Once called, this routine will never return It will call as necessary any callbacks that have been registered