OPEN GL - Bipindra Bir Shrestha. A GENDA Introduction to OpenGL Demo Programming in OpenGL Demo References.

Slides:



Advertisements
Similar presentations
Programming with OpenGL - Getting started - Hanyang University Han Jae-Hyek.
Advertisements

Computer Graphics - Graphics Programming -
OpenGL CMSC340 3D Character Design & Animation. What is OpenGL? A low-level graphics library specification designed for use with the C and C++ provides…
OPEN GL. Install GLUT Download package di sini Dari devcpp, buka Tools->PackageManager-
Chapter 2: Graphics Programming
Computer Graphics CSCE 441
Pemrograman OpenGL Dasar
© 2004, Tom Duff and George Ledin Jr1 Lectures OpenGL Introduction By Tom Duff Pixar Animation Studios Emeryville, California and George Ledin Jr Sonoma.
CS 4731 Lecture 2: Intro to 2D, 3D, OpenGL and GLUT (Part I) Emmanuel Agu.
 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.
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.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Computer Science,
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical.
Computer Graphics (Fall 2005) COMS 4160, Lecture 10: OpenGL 1
30/1/2006Based on: Angel (4th Edition) & Akeine-Möller & Haines (2nd Edition)1 CSC345: Advanced Graphics & Virtual Environments Lecture 1: Introduction.
CSE 494/598 Intro to Applied Computer Graphics Anshuman Razdan DCST AR's Web Page AR's Web Page
Programming with OpenGL Part 1: Background Mohan Sridharan Based on slides created by Edward Angel CS4395: Computer Graphics 1.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Introduction to OpenGL M. Ramanathan STTP CAD 2011Introduction to OpenGL.
Write a Simple Program with OpenGL & GLUT. Books and Web Books OpenGL Programming Guide (Red-book) OpenGL Reference Manual (Blue-book) OpenGL Super Bible.
Introduction to OpenGL Jian Huang This set of slides are extracted from the Interactive OpenGL Programming course given by Dave Shreine, Ed Angel and Vicki.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Lecture 2.
Computer Graphics Bing-Yu Chen National Taiwan University.
Using OpenGL in Visual C++ Opengl32.dll and glu32.dll should be in the system folder Opengl32.dll and glu32.dll should be in the system folder Opengl32.lib.
CSC 461: Lecture 41 CSC461: Lecture 4 Introduction to OpenGL Objectives: Development of the OpenGL API OpenGL Architecture -- OpenGL as a state machine.
2 COEN Computer Graphics I Introductions n Brad Grantham lecturer lab dude n Dave Shreiner lecturer slave driver.
Programming with OpenGL Part 1: Background
CSE 470: Computer Graphics. 10/15/ Defining a Vertex A 2D vertex: glVertex2f(GLfloat x, GLfloat y); 2D vertexfloating pointopenGL parameter type.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical.
Introduction to OpenGL 1. 2 OpenGL A Graphics rendering API introduced in 1992 by Silicon Graphics Inc Provide the low-level functions to access graphics.
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,
1 Figures are extracted from Angel's book (ISBN x) The Human Visual System vs The Pinhole camera Human Visual System Visible Spectrum Pinhole.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 43 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 43 Computer Graphics Programming with OpenGL I.
Draw a Simple Object. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture blending.
Intro to OpenGL (Version 2) Geb Thomas. Setting Up GLUT You will need GLUT for opening windows We can use the version made by Nate Robins: –
Chun-Yuan Lin Introduction to OpenGL 2015/12/19 1 CG.
NoufNaief.net TA: Nouf Al-harbi.
Introduction to OpenGL & HW1 Announcement 劉軒銘, 網媒所 碩二 ICG 2012 Fall.
Graphics: Conceptual Model
Introduction to OpenGL Programming
OpenGL Basic Drawing 2003 Spring Keng Shih-Ling
Lecture 2 Review OpenGL Libraries Graphics Overview Rendering Pipeline OpenGL command structure.
Chap 2 Write a Simple OpenGL Program. Preparing 1/2 environment : Microsoft Visual C 、 Microsoft Visual C++.Net Also need : GLUT
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.
CIS 681 Review: OpenGL. CIS 681 Command Syntax OpenGL commands start with a gl. This is followed by the base command such as Color. Followed by the number.
Introduction to OpenGL Muhammad Aamir Khan Lecturer, DCS, UOP.
Introduction to Graphics Programming. Graphics API.
Graphics Graphics Korea University kucg.korea.ac.kr Graphics Programming 고려대학교 컴퓨터 그래픽스 연구실.
Computer Graphics I, Fall Programming with OpenGL Part 2: Complete Programs.
INTRODUCTION TO OPENGL
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Computer Graphics -practical- Lecture 6. (visual c++) open gl library To use open GL with VC++ we add these files:- 1)Glut.h C:\program files\ Microsoft.
Basic Program with OpenGL and GLUT
The Human Visual System vs The Pinhole camera
Programming with OpenGL Part 1: Background
Programming with OpenGL Part 1: Background
Programming with OpenGL Part 2: Complete Programs
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.
גרפיקה ממוחשבת: מבוא ל-OpenGL
Programming with OpenGL Part 1: Background
Introduction to OpenGL
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 1: Background
Programming with OpenGL Part 2: Complete Programs
Presentation transcript:

OPEN GL - Bipindra Bir Shrestha

A GENDA Introduction to OpenGL Demo Programming in OpenGL Demo References

W HAT IS O PEN GL? An application programmer’s interface (API) that allows programmers to write programs that access graphics hardware.

B ENEFITS It is close enough to hardware so that programs written with OpenGL run efficiently It is easy to learn and use.

T HREE V IEWS OF O PEN GL 1. Programmer’s View 2. The OpenGL State Machine 3. The OpenGL Pipeline

T HE PROGRAMMER ’ S V IEW Specify Geometric Objects Describing properties of these objects Defining how these objects should be viewed

T HE O PEN GL S TATE MACHINE Application Program OpenGLDisplay Function Call Pixels

T HE O PEN GL P IPELINE PrimitivesTransformerClipper ProjectorRasterizerPixels

O PEN GL F UNCTIONS Primitive functions Geometric : polygons Discrete : bitmap Attribute functions Control attribute of primitives. Eg color, line type, light sources, textures Viewing functions Determine properties of Camera. Input functions Allow us to control windows on the screen and to use the mouse and keyboard Control functions Allow us to start and to terminate OpenGL programs and to turn on various OpenGL features.

O PEN GL V ERSIONS AND E XTENSIONS OpenGL is controlled by OpenGL Architectural Review Board (ARB), which has members from companies such as SGI,IBM and Microsoft. Present version is 2.1. Next version 3.0, release date is not yet announced due to some issues. OpenGL is very stable and has lower compatibility. Extensions: allow vendors to provide additional functionality through extensions. Each vendor has alphabetic abbreviation. E.g: glCombinerParameterfvNV() : NV for NVDIA If many vendors agree on same implementation it becomes “Standard extension” abbriviated with ARB. Eg. GL_ARB_multitexture

L ANGUAGES C C#C#: The framework Tao for Microsoft.NET includes OpenGL between other multimedia libraries TaoMicrosoft.NET DelphiDelphi: Dot [4] [4] FortranFortran: f90gl supports OpenGL 1.2, GLU 1.2 and GLUT 3.7 [5][5] JavaJava: Java Bindings for OpenGL (JSR 231) and Java OpenGL (JOGL) Java Bindings for OpenGLJava OpenGL Lightweight Java Game Library (LWJGL) Lightweight Java Game Library LispLisp: See the cl-opengl project at common-lisp.netthe cl-opengl project at common-lisp.net PerlPerl: Perl OpenGL (POGL) module - shared libs written in C Perl OpenGL C vs Perl and Perl vs Python benchmarks C vs Perl and Perl vs Python PHPPHP: See PythonPython: PyOpenGL supports GL, GLU and GLUT [8][8] RubyRuby: See [9] - supports GL, GLU and GLUT[9] SmalltalkSmalltalk as seen in Croquet Project running on Squeak SmalltalkCroquet Project Visual BasicVisual Basic: ActiveX ControlActiveX Control

C ONFIGURING V ISUAL S TUDIO 2005 Download GLUT binaries for windows from “Nate Robins” ‘s website put the files as Make sure visual studio c++ projects links in the GLUT/gl/glu libraries. Goto: Menu: “Project -> (your-project-name) Properties” Tab: “Configuration Properties -> Linker -> Input” Under “Additional Dependencies”, add “glut32.lib opengl32.lib glu32.lib” Under Configuration Properties->C++->General->Additional Include Directories : add "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include" FileLocation glut32.dllC:\WINDOWS\system\ (or system32) glut32.libC:\Program Files\Microsoft Visual Studio 2005\VC\PlatformSDK\Lib glut.hC:\Program Files\Microsoft Visual Studio 2005\VC\PlatformSDK\Include\gl

DEMO

P ROGRAMMING IN O PEN GL -1 GLUT Initialize : void glutInit( int argc, char ** argv) Creating a window int glutCreateWindow(char * title) Display Function void glutDisplayFunc(void (*func)(void)) Main Loop void glutMainLoop()

P ROGRAMMING IN O PEN GL -2 Drawing a rectangle glBegin(Glenum mode) glEnd() void glVertex{2 3 4}{sifd}(Type xcoordinate,……) void glClear(Glbitfield mask) void glFlush() Changing GLUT defaults void glutInitDisplayMode(unsigned int mode) void glutInitWindowSize(int width,int height) void glutInitWindowPosition( int x, int y)

P ROGRAMMING IN O PEN GL -3 Setting Colors void glColor*() void glClearColor( Glclampf r, GLClampf g, Glclampf b, Glclampf a ) Two Dimensional Viewing void gluOrtho2D( Gldouble left, Gldouble right, Gldouble bottom, Gldouble top) Coordinate Systems and Transformation glMatrixMode( GL_PROJECTION ); glLoadIdentity(); Points glPointSize(2.0); Lines GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP in glBegin( GL_LINES ); Enabling OpenGL features void glEnable( Glenum feature) void glDisable( Glenum feature )

P ROGRAMMING IN O PEN GL -4 Rectangles void glRect{ sifd} ( TYPE x1,y1,x2,y2 ) Text void glutBitMapCharcter( void * font, int char ) Save the state void glpushMatrix() void glPopMatrix() Viewport void glViewport( Glint x, GLint y, Glsizei w, Glsizei h )

I NTERACTION AND ANIMATION Reshape and Idle Callback Double buffering Using keyboard and mouse Mouse motion Subwindows and Multiple Windows

T HREE -D IMENSIONAL P ROGRAMMING Cameras and Objects Orthographic Projections in OpenGL Vertex Arrays Hidden Surface removal GLUT Objects

T RANSFORMATION Translation Rotation Scaling Setting vertices directly

L IGHTS AND M ATERIALS Enabling and disabling OpenGL lighting Specifying Light source Controlling the Lighting Calculation Smooth Shading Transparency

I MAGES Pixels and Bitmaps Displaying a bitmap Mixing Bitmaps and Geometry Colors and Masks Drawing Modes Reading and Writing Pixels Selecting Buffers Luminance Pixel Zoom

T EXTURE M APPING Texture Coordinates Texture Parameters Applying textures to surface Minimaps

C URVES AND SURFACES Bezier Curves and surfaces One dimensional OpenGL evaluators for Bezier Curves Two dimensional evaluators to evaluate Bernstein polynomials and to form Bezier surfaces.

DEMO

R ESOURCES Official Website : SDK : Reference pages : GLUT : Sample Projects at :