OpenGL: Introduction #include main() { OpenWindow() ; glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0,

Slides:



Advertisements
Similar presentations
© 2004, Tom Duff and George Ledin Jr1 Lectures OpenGL Introduction By Tom Duff Pixar Animation Studios Emeryville, California and George Ledin Jr Sonoma.
Advertisements

OpenGL (Graphics Library) Software Interface to graphics software Allows to create interactive programs that produce color images of moving 3D objects.
What is OpenGL The OpenGL graphics system is a software interface to graphics hardware. (The GL stands for Graphics Library.) It allows you to create interactive.
Draw a Simple Object. Example 1/4 #include “ glut.h ” void display(); void reshape(GLsizei w, GLsizei h); void main(int argc, char** argv){ glutInit(&argc,
Drawing Geometric Objects
1 Lecture 4 Graphical primitives Rasterization: algorithmic approach Rasterization: geometric approach 2D discrete lines, triangles Discrete planes 3D.
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.
Reference1. [OpenGL course slides by Rasmus Stenholt]
CS380 LAB I OpenGL Donghyuk Kim Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
CAP 4703 Computer Graphic Methods Prof. Roy Levow Lecture 2.
3D coordinate systems X Y Z Right-Hand Coordinate System X Y Z Left-Hand Coordinate System OpenGL uses this! Direct3D uses this!
COS 397 Computer Graphics Assoc. Prof. Svetla Boytcheva AUBG 2013 COS 397 Computer Graphics Practical Session №1 Introduction to OpenGL, GLFW and CG.
Basic OpenGL Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, September 10, 2003.
Using OpenGL. 2 What is OpenGL? A software interface to graphics hardware It is a Graphics Rendering API (Application Programmer’s Interface) that is.
Drawing Basic Graphics Primitives Lecture 4 Wed, Sep 3, 2003.
2 COEN Computer Graphics I Introductions n Brad Grantham lecturer lab dude n Dave Shreiner lecturer slave driver.
Interactive Computer Graphics Lecture 2: The programming approach to building graphical applications using OpenGL API.
Computer Graphics CS 385 January 31, Fractals Some definitions Object which is self-similar at all scales. Regardless of scale the same level of.
State Management and Drawing Geometry Objects
1 Figures are extracted from Angel's book (ISBN x) The Human Visual System vs The Pinhole camera Human Visual System Visible Spectrum Pinhole.
P RACTICING O PEN GL- P RIMITIVES. O PEN GL O UTPUT P RIMITIVES  Each geometric object is described by a set of vertices and the type of primitive to.
Computer Graphics Bing-Yu Chen National Taiwan University.
Computer Graphics I, Fall 2010 Programming with OpenGL Part 3: Three Dimensions.
Introduction to OpenGL. OpenGL is a low-level graphics library specification. It makes available to the programmer  a small set of geometric primitives.
Draw a Simple Object. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture blending.
Intro to OpenGL: Vertices and Drawing
CA 302 Computer Graphics and Visual Programming Lecture 2: Introduction to OpenGL Aydın Öztürk
NoufNaief.net 1 TA: Nouf Al-Harbi.
Lecture 2: Introduction to OpenGL
CSCE 441: Computer Graphics
OpenGL Basic Drawing 2003 Spring Keng Shih-Ling
Lecture 2 Review OpenGL Libraries Graphics Overview Rendering Pipeline OpenGL command structure.
1 Programming with OpenGL Part 2: Complete Programs.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 15 Creating 3D Models.
OpenGL Basic Drawing Jian-Liang Lin A Smidgen of OpenGL Code #include main() { InitializeAWindowPlease(); glClearColor (0.0, 0.0, 0.0, 0.0); glClear.
2002 by Jim X. Chen: Drawing Geometric Models.1. Objectives –OpenGL drawing primitives and attributes –OpenGL polygon face.
Introduction to OpenGL Muhammad Aamir Khan Lecturer, DCS, UOP.
The Framebuffer Hyun-Chul Cho. HyunChul Cho - KUCG -2 Buffer Goal of a graphics program Draw pictures on the screen Screen Rectangular array.
Introduction to Graphics Programming. Graphics API.
Graphics Graphics Korea University kucg.korea.ac.kr Graphics Programming 고려대학교 컴퓨터 그래픽스 연구실.
Introduction to Graphics Programming. Graphics: Conceptual Model Real Object Human Eye Display Device Graphics System Synthetic Model Synthetic Camera.
Computer Graphics I, Fall Programming with OpenGL Part 2: Complete Programs.
OpenGL CS418 Computer Graphics John C. Hart. OpenGL Based on GL (graphics library) by Silicon Graphics Inc. (SGI) Advantages: Runs on everything, including.
INTRODUCTION TO OPENGL
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
1 OpenGL Computer Graphics Tutorial on OpenGL. 2 Objectives  Development of the OpenGL API  OpenGL Architecture OpenGL as a state machine  Functions.
Computer Graphics Lecture 34. OpenGL Programming II Taqdees A. Siddiqi
OpenGL Programming Guide Chapter 2 Korea Univ. Graphics Labs. Ji Jun Yong Korea Univ. Graphics Labs. Ji Jun Yong.
CSC Graphics Programming
The Human Visual System vs The Pinhole camera
Draw a Simple Object.
State Management and Drawing Geometric Objects
Introduction to OpenGL
Programming with OpenGL Part 3: Three Dimensions
OpenGL API 2D Graphic Primitives
Graphics Programming (I)
OpenGL (Open Graphics Library) Mr. B.A.Swamy Assistant Professor Dept of CSE.
Lab 3 Geometric Drawing Lab 3 Geometric Drawing.
Objectives OpenGL drawing primitives and attributes
OpenGL.
Drawing in the plane 455.
Introduction to OpenGL
Line and Curve Drawing Algorithms
Computer Graphics, Lee Byung-Gook, Dongseo Univ.
Lecture 12: OpenGL Li Zhang Spring 2008
Computer Graphics Gerda Kamberova GK, Intro 3 Hofstra University.
OpenGL program.
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 3: Three Dimensions
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Presentation transcript:

OpenGL: Introduction #include main() { OpenWindow() ; glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); glColor3f(1.0, 1.0, 1.0); glBegin(); glVertex2f(-0.5, -0.5); glEnd(); glFlush(); WaitForAWhille() ; }

OpenGL Data Types Suffix Data Type C-Language Type OpenGL Type b 8-bit int signed char GLbyte s 16-bit int short GLshort i 32-bit int long GLint, GLsizei f 32-bit float float GLfloat, GLclampf d 64-bit float double GLdouble, Glclampd ub 8-bit uns int unsigned char Glubyte, GLboolean us 16-bit uns int unsigned short GLushort ui 32-bit usn int unsigned long GLuint, GLenum uns: unsigned

Color glClearColor( GLcampf r, GLcampf g, GLcampf b, GLcampf a ); Sets the current clearing color. Colors 0.0, 0.0, 0.0 black 1.0, 1.0, 0.0 yellow 0.0, 1.0, 1.0 cyan 1.0, 1.0, 1.0 white glClear( Glbitfield mask) Clears the specified buffer Buffers Color Buffer GL_COLOR_BUFFER_BIT Depth Buffer GL_DEPTH_BUFFER_BIT Accum Buffer GL_ACCUM_BUFFER_BIT Stencil Buffer GL_STENCIL_BUFFER_BIT

glVertex glVertex{234}{sifd}[v]{TYPE coords); Specifies a vertex for use in geometric objects glVertex2s(2,3); glVertex3d(5.2, 4.1, 4.0); GLint vert[3] = {3,7,11}; glVertex3iv(vert); glVertex2f(2.5, 7.0);

glBegin( Glenum mode) … glEnd() Marks a beginning of a vertex list that describes a geometric object Mode Meaning GL_POINT individual points GL_LINES pairs of vertices as individual line segments GL_POLYGON boundary of simple polygon GL_TRIANGLES triples of vertices interpreted as triangles GL_QUADS quadruples of vertices, as quads GL_LINE_STRIP series of connected line segment GL_LINE_LOOP closed polyline

Examples glBegin(GL_POLYGON); glVertex2i(0,0); glVertex2i(0,1); glVertex2i(1,1); glVertex2i(1,0); glEnd() ; glBegin(GL_POINTS); glVertex2i(0,0); glVertex2i(0,1); glVertex2i(1,1); glVertex2i(1,0); glEnd() ;

Examples GLfloat list[6][2] ; glBegin(GL_LINES) for (int i = 0 ; i < 6 ;i++) glVertex2v(list[i]); glEnd() ; glBegin(GL_LINE_STRIP) for (int i = 0 ; i < 6 ;i++) glVertex2v(list[i]); glEnd() ; glBegin(GL_LINE_LOOP) for (int i = 0 ; i < 6 ;i++) glVertex2v(list[i]); glEnd() ;

Examples GLfloat list[6][2] ; glColor3f(0.0, 1.0, 0.0); glBegin(GL_TRIANGLES) for (int i = 0 ; i < 6 ;i++) glVertex2v(list[i]); glEnd() ; glBegin(GL_TRIANGLES) glColor3f(1.0, 0.0, 0.0); for ( i = 0 ; i < 3 ;i++) glVertex2v(list[i]); glColor3f(1.0, 1.0, 1.0); for ( i = 3 ; i < 6 ;i++) glVertex2v(list[i]); glEnd() ;