OpenGL Computação Gráfica. O que é OpenGL? A low-level graphics programming language Intended for interactive graphics: 2D & 3D A software interface to.

Slides:



Advertisements
Similar presentations
Computer Graphics - Graphics Programming -
Advertisements

OpenGL Course Notes Chapter 2: State Management and Drawing Geometric Objects Jim Mims, Spring 2009.
OPEN GL. Install GLUT Download package di sini Dari devcpp, buka Tools->PackageManager-
02/17/05CISC640/440 OpenGL Tutorial1 OpenGL Tutorial CISC 640/440 Computer Graphics TA: Qi Li/Mani Thomas
©Zachary Wartell, UNCC9/28/ :30 AM 1 Overview of OpenGL Revision: 1.2 Copyright Professor Zachary Wartell, University of North Carolina All Rights.
Okay, you have learned … OpenGL drawing Viewport and World Window setup main() { glViewport(0,0,300,200); glMatrixMode(GL_PROJECTION); glLoadIndentity();
Line and Curve Drawing Algorithms. Line Drawing x0x0 y0y0 x end y end.
Chapter 2: Graphics Programming
O a polygon is a plane figure specified by a set of three or more coordinate positions, called vertices, that are connected in sequence by straight-Line.
MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Goals of the course: 1. to introduce real-time 3D graphics programming with openGL.
OPENGL.
Computer Graphics CSCE 441
Okay, you have learned … OpenGL drawing Viewport and World Window setup main() { glViewport(0,0,300,200); glMatrixMode(GL_PROJECTION); glLoadIndentity();
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Building Models modified by Ray Wisman Ed Angel Professor of Computer Science,
OPENGL Return of the Survival Guide. Buffers (0,0) OpenGL holds the buffers in a coordinate system such that the origin is the lower left corner.
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);
David Luebke5/16/2015 Administrivia l Back on track: canceling OpenGL lecture 2 l Assignment 1 –Greg Yukl found an alternate XForms site:
 The success of GL lead to OpenGL (1992), a platform-independent API that was  Easy to use  Close enough to the hardware to get excellent performance.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Computer Science,
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Programming in OpenGL Ryan Holmes CSE 570 February 12 th, 2003.
CAP4730: Computational Structures in Computer Graphics Introduction to OpenGL.
JOGL in MS Windows GDI – Graphics Device Interface (Windows-specific) OpenGL Lib JOGL Commands GDI Processor Graphics Hardware JOGL Lib.
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.
OpenGL Shading Language (Advanced Computer Graphics) Ernest Tatum.
OpenGL and Parametric Curves Advanced Multimedia Technology: Computer Graphics Yung-Yu Chuang 2005/12/21 with slides by Brian Curless, Zoran Popovic, Robin.
Ch 2 Graphics Programming page 1 CSC 367 Coordinate Systems (2.1.2) Device coordinates, or screen coordinates (pixels) put limitations on programmers and.
1. OpenGL/GLU/GLUT  OpenGL v4.0 (latest) is the “core” library that is platform independent  GLUT v3.7 is an auxiliary library that handles window creation,
CS 4363/6353 OPENGL BACKGROUND. WHY IS THIS CLASS SO HARD TO TEACH? (I’LL STOP WHINING SOON) Hardware (GPUs) double in processing power ever 6 months!
Introduction to OpenGL Programming Jian-Liang Lin 2002.
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
Lecture 2: Some definitions of terms 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
Introduction to OpenGL. OpenGL is a low-level graphics library specification. It makes available to the programmer  a small set of geometric primitives.
1 A first OpenGL program Brian Farrimond Robina Hetherington.
Color and Color Models Angel 2.5 Angel: Interactive Computer Graphics5E © Addison-Wesley
Chun-Yuan Lin Introduction to OpenGL 2015/12/19 1 CG.
NoufNaief.net TA: Nouf Al-harbi.
OpenGL: The Open Graphics Language Introduction By Ricardo Veguilla.
1 Programming with OpenGL Part 2: Complete Programs.
OpenGL API 2D Graphic Primitives Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Chapter 4 -- Color1 Color Open GL Chapter 4. Chapter 4 -- Color2 n The goal of almost all OpenGL applications is to draw color pictures in a window on.
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,
Introduction to Graphics Programming. Graphics API.
Graphics Graphics Korea University kucg.korea.ac.kr Graphics Programming 고려대학교 컴퓨터 그래픽스 연구실.
Introduction to OpenGL (INF 250) Veronika Solteszova et al., UiB Dept. of Informatics,
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.
OpenGL: The Open Graphics Language Technology and Historical Overview By Ricardo Veguilla.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Computer Graphics Lecture 34. OpenGL Programming II Taqdees A. Siddiqi
Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran
Administrivia Back on track: canceling OpenGL lecture 2 Assignment 1
Draw a Simple Object.
Programming with OpenGL Part 2: Complete Programs
Materi Anatomi OpenGL Fungsi GLUT Posisi Kamera Proyeksi
OpenGL API 2D Graphic Primitives
Programming with OpenGL Part 2: Complete Programs
OpenGL (Open Graphics Library) Mr. B.A.Swamy Assistant Professor Dept of CSE.
Lab 3 Geometric Drawing Lab 3 Geometric Drawing.
Introduction to OpenGL
Primitive Objects Lecture 6 Wed, Sep 5, 2007.
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 2: Complete Programs
CS297 Graphics with Java and OpenGL
Programming with OpenGL Part 2: Complete Programs
OpenGL Background CS 4722.
Presentation transcript:

OpenGL Computação Gráfica

O que é OpenGL? A low-level graphics programming language Intended for interactive graphics: 2D & 3D A software interface to graphics hardware Descendent of GL Cynics have called it GL with longer variable names and no window handling.

Implementações For the Sparcs and Linux PCs we have Mesa, a freeware implementation SGIs have SGI’s implementation. ~ 1500% faster.

Como funciona? Set variables in the state, such as color, current viewing position, line width, material properties... These variables then apply to every subsequent drawing command State variables have default values

O que ele cobre? OpenGL’s Primitives are points, lines and polygons Doesn’t do windowing. Use Xforms (FLTK?)... (ou outro qualquer).

Acertando uma janela de trabalho Coordenadas para os extremos glOrtho(left, right, bottom, top, near, far); e.g., glOrtho(0, 100, 0, 100, -1, 1); near & far should always be -1 & 1 (at least for a while)

Limpando uma janela glClearColor(r, g, b, a); a is the alpha channel; set this to 0. glClear(GL_COLOR_BUFFER_BIT); glClear can clear other buffers as well, but we’re only using the color buffer...

Estabelecendo uma cor All subsequent primitives will be this color. Red, green & blue color model Components are 0-1 (normalized) Side-note: OpenGL naming convention is: –gl [234][sifd][v] (args... ) –s - short, i - integer, f - float, d- double –v - pointer to an array

Desenhando um polígono glBegin(GL_POLYGON); Send it the points making up the polygon glVertex2f(x0, y0); glVertex2f(x1, y1); glVertex2f(x2, y2)... Tell it we’re finished glEnd(); That’s it.

Truques especiais In place of GL_POLYGON: –GL_POINTS: plot points –GL_LINES: draw lines –GL_LINE_LOOP: framed polygon Gouraud Shading: –Change the color between setting each vertex, and GL will smooth-shade between the different vertex colors. Flushing the pipeline : glFlush();

Desenhando uma caixa MakeWindow("Box", 400, 400); /*Sua rotina de criar janela*/ glOrtho(-1, 1, -1, 1, -1, 1); glClearColor(0.5, 0.5, 0.5, 1); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 0.0, 0.0); glBegin(GL_POLYGON); /* or GL_LINES or GL_POINTS... */ glVertex2f(-0.5, -0.5); glVertex2f( 0.5, -0.5); glVertex2f( 0.5, 0.5); glVertex2f(-0.5, 0.5); glEnd();