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

Slides:



Advertisements
Similar presentations
SUJAN CHOWDHURY Lecturer, CSE, CUET
Advertisements

Computer Graphics - Graphics Programming -
Department of nskinfo i-education
OPEN GL. Install GLUT Download package di sini Dari devcpp, buka Tools->PackageManager-
COMPUTER GRAPHICS SOFTWARE.
Lecture 3 Graphics Pipeline and Graphics Software
©Zachary Wartell, UNCC9/28/ :30 AM 1 Overview of OpenGL Revision: 1.2 Copyright Professor Zachary Wartell, University of North Carolina All Rights.
Chapter 2: Graphics Programming
Computer Graphics CSCE 441
Pemrograman OpenGL Dasar
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.
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 1: Background Ed Angel Professor of Computer Science, Electrical.
30/1/2006Based on: Angel (4th Edition) & Akeine-Möller & Haines (2nd Edition)1 CSC345: Advanced Graphics & Virtual Environments Lecture 1: Introduction.
Programming with OpenGL Part 0: 3D API March 1, 2007.
Programming with OpenGL Part 1: Background Mohan Sridharan Based on slides created by Edward Angel CS4395: Computer Graphics 1.
Chapter 03: Graphics Primitives Course web page: Chapter #3.
Computer Graphics Bing-Yu Chen National Taiwan University.
Lecture 5 - Programming with OpenGL
CAP4730: Computational Structures in Computer Graphics Introduction to OpenGL.
Using OpenGL. 2 What is OpenGL? A software interface to graphics hardware It is a Graphics Rendering API (Application Programmer’s Interface) that is.
Introduction to OpenGL and GLUT GLUT. What is OpenGL? An application programming interface (API) A (low-level) Graphics rendering API Generate high-quality.
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.
Graphics Architectures & OpenGL API Introduction Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CS 480/680 Computer Graphics Programming with Open GL Part 1: Background Dr. Frederick C Harris, Jr. Fall 2011.
Computer Graphics Tz-Huan Huang National Taiwan University.
The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,
Programming with OpenGL Part 1: Background
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical.
Graphics Systems and OpenGL. Business of Generating Images Images are made up of pixels.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical.
Hank Childs, University of Oregon Oct. 31st, 2014 CIS 441/541: Introduction to Computer Graphics Lecture 10: Textures.
Scientific Visualization with OpenGL 22 February 2006.
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.
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 Week 1 David Breen Department of Computer Science Drexel University Based on material from Ed Angel, University of New Mexico CS.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Programming with OpenGL Part 1: Background Ed Angel Professor Emeritus.
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
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.
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.
Chun-Yuan Lin Introduction to OpenGL 2015/12/19 1 CG.
NoufNaief.net TA: Nouf Al-harbi.
CGGM Lab. Tan-Chi Ho Introduction to OpenGL.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
Introduction to OpenGL Programming
Introduction to Graphics Programming. Graphics API.
INTRODUCTION TO OPENGL
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Hank Childs, University of Oregon Oct. 28th, 2016 CIS 441/541: Introduction to Computer Graphics Lecture 16: textures.
The Human Visual System vs The Pinhole camera
Programming with OpenGL Part 1: Background
Programming with OpenGL Part 1: Background
Computer Graphics Lecture 32
Introduction to Computer Graphics with WebGL
גרפיקה ממוחשבת: מבוא ל-OpenGL
Introduction to Computer Graphics with WebGL
Programming with OpenGL Part 1: Background
Introduction to Computer Graphics with WebGL
Introduction to OpenGL
Programming with OpenGL Part 1: Background
Programming with OpenGL Part 1: Background
OpenGL Background CS 4722.
Presentation transcript:

Programming with OpenGL - Getting started - Hanyang University Han Jae-Hyek

Division of Electrical and Computer Engineering, Hanyang University 2 Objective Development of the OpenGL API OpenGL Architecture OpenGL as a state machine Functions Types Formats Programming Environment Setting Simple program

Division of Electrical and Computer Engineering, Hanyang University OpenGL 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 Focus on rendering Omitted windowing and input to avoid window system dependencies

Division of Electrical and Computer Engineering, Hanyang University OpenGL Evolution Originally controlled by an Architectural Review Board (ARB) Members included SGI, Microsoft, Nvidia, HP, 3DLabs, IBM,……. Relatively stable (present version 2.1) Evolution reflects new hardware capabilities 3D texture mapping and texture objects Vertex programs Allows for platform specific features through extensions ARB replaced by Khronos

Division of Electrical and Computer Engineering, Hanyang University OpenGL Libraries OpenGL core library OpenGL32 on Windows GL on most unix/linux systems (libGL.a) OpenGL Utility Library (GLU) Provides functionality in OpenGL core but avoids having to rewrite code Links with window system GLX for X window systems WGL for Windows AGL for Macintosh OpenGL Utility Toolkit (GLUT) Provides functionality common to all window systems OpenGL Extension Wrangler library Helps in querying and loading OpenGL extensions

Division of Electrical and Computer Engineering, Hanyang University GLUT OpenGL Utility Toolkit (GLUT) Provides functionality common to all window systems Open a window Get input from mouse and keyboard Menus Event-driven Code is portable but GLUT lacks the functionality of a good toolkit for a specific platform No slide bars

Division of Electrical and Computer Engineering, Hanyang University 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

Division of Electrical and Computer Engineering, Hanyang University OpenGL Architecture Immediate Mode Display List Polynomial Evaluator Per Vertex Operations & Primitive Assembly Rasterization Per Fragment Operations Texture Memory CPU Pixel Operations Frame Buffer geometry pipeline

Division of Electrical and Computer Engineering, Hanyang University OpenGL Functions Primitives Points Line Segments Polygons Attributes Transformations Viewing Modeling Control (GLUT) Input (GLUT) Query

Division of Electrical and Computer Engineering, Hanyang University OpenGL State OpenGL is a state machine OpenGL functions are of two types Primitive generating Can cause output if primitive is visible How vertices are processed and appearance of primitive are controlled by the state State changing Transformation functions Attribute functions

Division of Electrical and Computer Engineering, Hanyang University Lack of Object Orientation OpenGL is not object oriented so that there are multiple functions for a given logical function glVertex3f glVertex2i glVertex3dv Underlying storage mode is the same Easy to create overloaded functions in C++ but issue is efficiency

Division of Electrical and Computer Engineering, Hanyang University OpenGL function format glVertex3f(x,y,z) belongs to GL library function name x,y,z are floats glVertex3fv(p) p is a pointer to an array dimensions

Division of Electrical and Computer Engineering, Hanyang University OpenGL #defines Most constants are defined in the include files gl.h, glu.h and glut.h Note #include should automatically include the others Examples glBegin(GL_POLYGON) glClear(GL_COLOR_BUFFER_BIT) include files also define OpenGL data types: GLfloat, GLdouble,….

Division of Electrical and Computer Engineering, Hanyang University Programming Environment Setting

Division of Electrical and Computer Engineering, Hanyang University

Division of Electrical and Computer Engineering, Hanyang University

Division of Electrical and Computer Engineering, Hanyang University Platform SDK Platform SDK glut.h

Division of Electrical and Computer Engineering, Hanyang University Platform SDK Platform SDK glut.lib, glut32.lib dll Window/System32/

Division of Electrical and Computer Engineering, Hanyang University ex) d:\library\opengl\

Division of Electrical and Computer Engineering, Hanyang University visual studio tools->options->projects and solutions->VC++ directories

Division of Electrical and Computer Engineering, Hanyang University visual studio tools->options->projects and solutions->VC++ directories

Division of Electrical and Computer Engineering, Hanyang University

Division of Electrical and Computer Engineering, Hanyang University

Division of Electrical and Computer Engineering, Hanyang University

Division of Electrical and Computer Engineering, Hanyang University Project->properties->configuration properties->linker- >input->additional dependencies OpenGL32.lib glu32.lib glut32.lib

Division of Electrical and Computer Engineering, Hanyang University A Simple Program Generate a square on a solid background

Division of Electrical and Computer Engineering, Hanyang University simple.c #include 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(); }