Getting Started. 1 st Week, Sun-Jeong Kim. Computer Graphics Applications
|
|
- Claude Fowler
- 6 years ago
- Views:
Transcription
1 OpenGL Programming Getting Started 1 st Week, 2008 Sun-Jeong Kim Visual Studio 2005 Windows Programming 2
2 Visual C++ Win32 Application New Project 3 Empty project Application Settings 4
3 Solution Prac01 5 Downloading main0.cpp 6
4 Adding a Source File (1) Project Add Existing Item 7 Adding a Source File (2) 8
5 Building the Solution 9 Compiling Errors 10
6 Unicode vs. Multi-Byte SBCS (Single Byte Character Set) ASCII code: 1 byte character set DBCS (Double Byte Character Set) Korean MBCS (Multi Byte Character Set) SBCS + DBCS: ~ Windows 9x WBCS (Wide Byte Character Set) Unicode: Windows 2000 ~ 11 Project Properties 12
7 Result main0.cpp 13 main0.cpp #include <windows.h> HWND MyMWindowHandle = 0; LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM ); int WINAPI WinMain( HINSTANCE hinstance, HINSTANCE, LPSTR, int nshowcmd ) { // Create the main window } // Main message loop LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { } 14
8 Includes, Global Variables, and Prototypes Includes #include <windows.h> Obtaining the structures, types, and function declarations needed for using the basic elements of the Win32 API Global Variables HWND MainWindowHandle = 0; Handle to a window to refer our main application window Prototypes LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); Our main window s window procedure 15 WinMain ( ) The Windows equivalent to the main() in normal C++ programming int WINAPI WinMain( HINSTANCE hinstance, HINSTANCE hprevinstance, PSTR pcmdline, int nshowcmd ); hinstance: Handle to the current application instance hprevinstance: Not used in Win32 programming lpcmdline: The command line argument string used to run the program ncmdshow: Specifying how the application should be displayed 16
9 WNDCLASS (1) Describing our window with WNDCLSS typedef struct _WNDCLASS { UINT style; WNDPROC lpfnwndproc; int cbclsextra; int cbwndextra; HANDLE hinstance; HICON hicon; HCURSOR hcursor; HBRUSH hbrbackground; LPCTSTR lpszmenuname; LPCTSTR lpszclassname; } WNDCLASS; style: Specifying the class style lpfnwndproc: Pointer to the window procedure function cbclsextra and cbwndextra: Extra memory slots 17 WNDCLASS (2) hinstance: A handle to our application instance hicon: Specifying a handle to an icon hcursor: Specifying a handle to a cursor hbrbackground: Specifying the background of the client area of the window lpszmenuname: Specifying the window s menu lpszclassname: Specifying the name of the window class structure 18
10 Creating the Window (1) Creating a window based on WNDCLASS description HWND CreateWindow( LPCTSTR lpclassname, LPCTSTR lpwindowname, DWORD dwstyle, int x, int y, int nwidth, int nheight, HWND hwndparent, HMENU hmenu, HANDLE hinstance, PVOID lpparam ); lpclassname: : The name of the registered WNDCLASS structure lpwindowname: The name we want to give our window 19 Creating the Window (2) dwstyle: Defining the style of window x: The position at the top-left corner of the window y: The position at the top-left corner of the window nwidth: The width of the window in pixels nheight: The height of the window in pixels hwndparent: Handle to a window that is to be the parent of this window hmenu: A handle to menu hinstance: Handle to the application lpparam: A pointer to user-defined data 20
11 The Message Loop (1) The message structure that represents a Windows message typedef struct tagmsg { HWND hwnd; UINT message; WPARAM wparam; LPARAM lparam; DWORD time; POINT pt; } MSG; hwnd: The handle to the window message: A predefined constant value identifying the message (e.g. WM_QUIT) wparam and lparam: : Extra information time: The time the message was posted pt: The (x, y) coordinates of the mouse cursor 21 The Message Loop (2) Entering the message loop while( GetMessage( &msg, 0, 0, 0 ) ) { TranslateMessage( &msg g ); DispatchMessage( &msg ); } GetMessage() Returning true unless a WM_QUIT Retrieving a message from the message queue Filling in members of MSG structure TranslateMessage() Performing some keyboard translation and virtual key messages to character messages specifically DispatchMessage() Dispatching the message off to the appropriate window proc. 22
12 The Window Procedure (1) Executing in response to a message our window LRESULT CALLBACK WndProc( receives ); HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam Callback function: Windows will be calling this function outside of the code space of the program hwnd: The handle to the window receiving the message umsg: A predefined value that identifies the particular message (e.g. WM_QUIT) wparam and lparam: Extra information about the message 23 The Window Procedure (2) Handling three messages: switch( msg ) { case WM_KEYDOWN: if( wparam == VK_ESCAPE ) if( IDYES == MessageBox( NULL, "Are you sure to exit?", "Hello", MB_YESNO ) ) DestroyWindow( MyMWindowHandle ); break; case WM_DESTROY: PostQuitMessage( 0 ); break; } default: return DefWindowProc( hwnd, msg, wparam, lparam ); WM_KEYDOWN: pressing a key (c.f. virtual key code) WM_DESTROY: destroying the window 24
13 The Window Procedure (3) Default window procedure return DefWindowProc( hwnd, msg, wparam, lparam ); Win32 API function Using default behavior for all other messages (e.g. minimizing, maximizing, resizing, and closing a window) 25 The Message Box Function Win32 API function int MessageBox( HWND hwnd, LPCTSTR lptext, LPCTSTR lpcaption, UINT utype ); hwnd: Handle of owner window (may specify null) lptext: Text to put in the message box lpcaption: : Text for the title of the message box utype: Style of the message box MessageBox( NULL, Are you sure to exit?", "Hello", MB_YESNO ); 26
14 Exercises (1) Window 의크기를 800x600 으로고정하시오. Window 의배경을검정색으로칠하시오. Window 의제목을자신의학번과이름으로고치시오. 화살표키를눌렀을때, 다음과같은 Message Box 를생성하시오. 좌측마우스버튼을클릭했을때다음과같은 Message Box를생성하시오. 27 Changing a Source File (1) 28
15 Changing a Source File (2) 29 Building the Solution 30
16 Compiling Errors 31 Linking the Library Files Project Properties Configuration Properties Linker Input Additional Dependencies: opengl32.lib lib glu32.lib lib 32
17 OpenGL API (1) API (application programming interface) Interface between an application program and a graphics system Application Program OpenGL interface Graphics Library (API) GLU Hardware Input Device Output Device OpenGL Application Program GL GLUT Xlib, Xtk Frame Buffer GLX 33 OpenGL interface OpenGL API (2) OpenGL core library (names : gl~) : GL OpenGL utility library (names : glu~) : GLU Using only GL functions Creating common objects Other tasks that users prefer not to write repeatedly OpenGL utility toolkit (names : glut~) : GLUT Interface with the window system 34
18 OpenGL API (3) OpenGL architecture Immediate Mode Geometry Pipeline Polynomial Evaluator Per Vertex Operations & Primitive Assembly CPU Display List Rasterization Per Fragment Operations Frame Buffer Pixel Operations Texture Memory 35 OpenGL API (4) OpenGL function format Function name Dimensions glvertex3f( x, y, z ); Belongs to GL library x, y, z are floats p is a pointer to an array glvertex3fv( p ); 36
19 Result main1.cpp 37 main1.cpp #include <windows.h> #include <gl/gl.h> #include <gl/glu.h> HWND MyMWindowHandle dl = 0; HDC MyDC; HGLRC MyRC; LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM ); bool bsetuppixelformat( void ); void Resize( const int cx, const int cy ); void DrawScene( void ); int WINAPI WinMain( HINSTANCE hinstance, HINSTANCE, LPSTR, int nshowcmd ) { // Create the main window // Main message loop } 38
20 OpenGL Camera OpenGL places a camera at the origin in world space pointing in the negative z direction Default viewing volume a box centered at the origin with a side of length 2 The default camera and an orthographic view volume 39 Orthographic Viewing Default orthographic view Projecting points forward along the z axis onto the plane z=0 z=0 z=0 View Volume Orthographic Projection 40
21 Viewing (1) In OpenGL, viewing is carried out by projection matrix First, set the matrix mode first Two most important matrices: model-view and projection glmatrixmode(gl_projection GL_PROJECTION); Start with an identity matrix Multiplying or concatenating a number of transformation matrices glloadidentity(); Alter it with a projection matrix Two- and three-dimensional viewing glortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); 41 Viewing (2) Three-dimensional viewing glortho(left, right, bottom, top, near, far); near, far: distances measured from the camera Two-dimensional viewing Application i is in two dimension i Placing all vertices in the plane z=0 gluortho2d(left, right, bottom, top); View or clipping volume == clipping window Objects before clipping 42 Image after clipping
22 Viewport Viewports A rectangular area of the display window Values in pixels Aspect ratio of a rectangle glviewport(x, y, w, h); The ratio of the rectangle s width to its height 43 Points Lines Line segments Polylines Polygons Polygons Primitives in OpenGL Triangles and quadrilaterals Strips and fans Text Curved objects 44
23 Points in OpenGL glbegin(gl_points); glvertex2fv(p0); glvertex2fv(p1); p7 p0 p1 glvertex2fv(p2); glvertex2fv(p3); p6 p2 glvertex2fv(p4); glvertex2fv(p5); p5 p3 glvertex2fv(p6); glvertex2fv(p7); p4 glend(); 45 Line Segments Lines in OpenGL (1) glbegin(gl_lines); glvertex2fv(p0); glvertex2fv(p1); p7 p0 p1 glvertex2fv(p2); glvertex2fv(p3); glvertex2fv(p4); p6 p2 glvertex2fv(p5); glvertex2fv(p6); p5 p3 glvertex2fv(p7); glend(); p4 46
24 Polylines Line Strip Lines in OpenGL (2) glbegin(gl_line_strip); glvertex2fv(p0); glvertex2fv(p1); p7 p0 p1 glvertex2fv(p2); glvertex2fv(p3); glvertex2fv(p4); p6 p2 glvertex2fv(p5); glvertex2fv(p6); glvertex2fv(p7); glend(); p5 p4 p3 47 Polylines Line Loop Lines in OpenGL (3) glbegin(gl_line_loop); glvertex2fv(p0); glvertex2fv(p1); p7 p0 p1 glvertex2fv(p2); glvertex2fv(p3); glvertex2fv(p4); p6 p2 glvertex2fv(p5); glvertex2fv(p6); glvertex2fv(p7); glend(); p5 p4 p3 48
25 Polygon Polygons in OpenGL (1) glbegin(gl_polygon); glvertex2fv(p0); glvertex2fv(p1); p7 p0 p1 glvertex2fv(p2); glvertex2fv(p3); glvertex2fv(p4); p6 p2 glvertex2fv(p5); glvertex2fv(p6); glvertex2fv(p7); glend(); p5 p4 p3 49 Quadrilaterals Polygons in OpenGL (2) glbegin(gl_quads); glvertex2fv(p0); glvertex2fv(p1); p7 p0 p1 glvertex2fv(p2); glvertex2fv(p3); glvertex2fv(p4); p6 p2 glvertex2fv(p5); glvertex2fv(p6); glvertex2fv(p7); glend(); p5 p4 p3 50
26 Quadstrip Polygons in OpenGL (3) glbegin(gl_quad_strip); glvertex2fv(p0); glvertex2fv(p1); p0 p1 p3 glvertex2fv(p2); glvertex2fv(p3); glvertex2fv(p4); p2 p5 glvertex2fv(p5); glvertex2fv(p6); glvertex2fv(p7); glend(); p4 p6 p7 51 Triangles Polygons in OpenGL (4) glbegin(gl_triangles); glvertex2fv(p0); glvertex2fv(p1); p7 p0 p1 glvertex2fv(p2); glvertex2fv(p3); glvertex2fv(p4); p6 p2 glvertex2fv(p5); glvertex2fv(p6); glvertex2fv(p7); glend(); p5 p4 p3 52
27 Triangle Strip Polygons in OpenGL (5) glbegin(gl_triangle_strip); glvertex2fv(p0); glvertex2fv(p1); p1 p0 p2 glvertex2fv(p2); glvertex2fv(p3); glvertex2fv(p4); p3 p4 glvertex2fv(p5); glvertex2fv(p6); glvertex2fv(p7); glend(); p5 p7 p6 53 Triangle Fan Polygons in OpenGL (6) glbegin(gl_triangle_fan); glvertex2fv(p0); glvertex2fv(p1); p7 p0 p1 glvertex2fv(p2); glvertex2fv(p3); glvertex2fv(p4); p6 p2 glvertex2fv(p5); glvertex2fv(p6); glvertex2fv(p7); glend(); p5 p4 p3 54
28 Setting of Color Attributes (1) Setting of the clear color glclearcolor(1.0, 1.0, 1.0, 1.0); Opaque: opacity is 1.0 Window is cleared by white color Setting of the color state variable glcolor3f(1.0, 0.0, 0.0); RGB color red color Setting of the size of points 2 pixels wide: glpointsize(2.0); Setting of the width of lines 2 pixels width: gllinewidth(2.0); 55 Setting of Color Attributes (2) Creating conceptual vertex colors glcolor3f(1.0, 0.0, 0.0); glvertex2f(0.5, 0.5); glcolor3f(0.0, 0.0, 1.0); glvertex2f(-0.5, -0.5); Default smooth shading Alternative flat shading Color of first vertex determines fill color glshademodel(gl_smooth); glshademodel(gl_flat); 56
29 The Coordinate Systems The origin + the bases (axes) Right-handed handed coordinate system: OpenGL Left-handed coordinate system: DirectX 57 The Coordinate System The Origin 58
30 Result The Origin 59 The Coordinate System The Axes 60
31 Result The Axes 61 Exercises (2) glveiwport( ) 함수의입력인자를변경해보시오. 예 ) (cx, cy) (200, 200), (0, 0) (100, 100) glorhto( ) 함수의입력인자를변경해보시오. 예 ) , ratio 제거 glclearcolor( ) 함수의입력인자를변경해보시오. 예 ) (1.0f, 1.0f, 1.0f, 1.0f) (0.0f, 0.0f, 0.0f, 1.0f) 62
32 Locating Camera (1) Setting position and orient of the camera within the world coordinate system void glulookat(gldouble eyex, GLdouble eyey, GLdouble eyez, GLdouble atx, GLdouble aty, GLdouble atz, GLdouble upx, GLdouble upy, GLdouble upz) 63 Locating Camera (2) 64
33 Result Locating Camera 65 Exercises (3) 화살표에따라카메라의위치를변경해보시오. Left 화살표 : 왼쪽으로 0.1 씩이동 Right 화살표 : 오른쪽으로 씩이동 Up 화살표 : 위쪽으로 0.1 씩이동 Down 화살표 : 아래로 씩이동 66
Windows Programming. 1 st Week, 2011
Windows Programming 1 st Week, 2011 시작하기 Visual Studio 2008 새프로젝트 파일 새로만들기 프로젝트 Visual C++ 프로젝트 Win32 프로젝트 빈프로젝트 응용프로그램설정 Prac01 솔루션 새항목추가 C++ 파일 main.cpp main0.cpp cpp 다운로드 솔루션빌드 오류 Unicode vs. Multi-Byte
More informationGraphics Programming
Graphics Programming 3 rd Week, 2011 OpenGL API (1) API (application programming interface) Interface between an application program and a graphics system Application Program OpenGL API Graphics Library
More informationGraphics Programming. August 31, Programming of the Sierpinski gasket. Programming with OpenGL and C/C++
Computer Graphics Graphics Programming August 31, 2005 Contents Our Goal in This Chapter Programming of the Sierpinski gasket How To? Programming with OpenGL and C/C++ OpenGL API (Application Programmer
More informationWe display some text in the middle of a window, and see how the text remains there whenever the window is re-sized or moved.
1 Programming Windows Terry Marris January 2013 2 Hello Windows We display some text in the middle of a window, and see how the text remains there whenever the window is re-sized or moved. 2.1 Hello Windows
More informationGame Programming I. Introduction to Windows Programming. Sample Program hello.cpp. 5 th Week,
Game Programming I Introduction to Windows Programming 5 th Week, 2007 Sample Program hello.cpp Microsoft Visual Studio.Net File New Project Visual C++ Win32 Win32 Project Application Settings Empty project
More informationInput and Interaction
Input and Interaction 5 th Week, 2011 Graphical Input Devices Mouse Trackball Light Pen Data Tablet Joy Stick Space Ball Input Modes Input devices contain a trigger which can be used to send a signal to
More informationWindow programming. Programming
Window programming 1 Objectives Understand the mechanism of window programming Understand the concept and usage of of callback functions Create a simple application 2 Overview Windows system Hello world!
More informationWindows and Messages. Creating the Window
Windows and Messages In the first two chapters, the sample programs used the MessageBox function to deliver text output to the user. The MessageBox function creates a "window." In Windows, the word "window"
More informationChapter 15 Programming Paradigm
Chapter 15 Programming Paradigm A Windows program, like any other interactive program, is for the most part inputdriven. However, the input of a Windows program is conveniently predigested by the operating
More informationMeshing and Geometry
Meshing and Geometry Points in OpenGL glbegin(gl_points); glvertex2fv(p0); glvertex2fv(p1); p7 p0 p1 glvertex2fv(p2); glvertex2fv(p3); p6 p2 glvertex2fv(p4); glvertex2fv(p5); p5 p3 glvertex2fv(p6); glvertex2fv(p7);
More informationProgramming using OpenGL: A first Introduction
Programming using OpenGL: A first Introduction CMPT 361 Introduction to Computer Graphics Torsten Möller Machiraju/Zhang/Möller 1 Today Overview GL, GLU, GLUT, and GLUI First example OpenGL functions and
More informationProgramming with OpenGL Part 2: Complete Programs Computer Graphics I, Fall
Programming with OpenGL Part 2: Complete Programs 91.427 Computer Graphics I, Fall 2008 1 1 Objectives Refine first program Alter default values Introduce standard program structure Simple viewing 2-D
More informationTeacher Assistant : Tamir Grossinger Reception hours: by - Building 37 / office -102 Assignments: 4 programing using
Teacher Assistant : Tamir Grossinger email: tamirgr@gmail.com Reception hours: by email - Building 37 / office -102 Assignments: 4 programing using C++ 1 theoretical You can find everything you need in
More informationComputer Graphics. Basic 3D Programming. Contents
Computer Graphics Basic 3D Programming September 21, 2005 Sun-Jeong Kim 1 http://www.hallym.ac.kr/~sunkim/teach/2005/cga Contents Cameras and objects Perspective projections Orthographic projections Viewing
More informationComputer graphics MN1
Computer graphics MN1 http://www.opengl.org Todays lecture What is OpenGL? How do I use it? Rendering pipeline Points, vertices, lines,, polygons Matrices and transformations Lighting and shading Code
More informationLSN 4 GUI Programming Using The WIN32 API
LSN 4 GUI Programming Using The WIN32 API ECT362 Operating Systems Department of Engineering Technology LSN 4 Why program GUIs? This application will help introduce you to using the Win32 API Gain familiarity
More informationPrecept 2 Aleksey Boyko February 18, 2011
Precept 2 Aleksey Boyko February 18, 2011 Getting started Initialization Drawing Transformations Cameras Animation Input Keyboard Mouse Joystick? Textures Lights Programmable pipeline elements (shaders)
More informationGL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW
OpenGL Syntax Functions have prefix gl and initial capital letters for each word glclearcolor(), glenable(), glpushmatrix() glu for GLU functions glulookat(), gluperspective() constants begin with GL_,
More informationGetting Started. Overview (1): Getting Started (1): Getting Started (2): Getting Started (3): COSC 4431/5331 Computer Graphics.
Overview (1): Getting Started Setting up OpenGL/GLUT on Windows/Visual Studio COSC 4431/5331 Computer Graphics Thursday January 22, 2004 Overview Introduction Camera analogy Matrix operations and OpenGL
More informationCourse 3D_OpenGL: 3D-Graphics with C++ and OpenGL Chapter 1: Moving Triangles
1 Course 3D_OpenGL: 3D-Graphics with C++ and OpenGL Chapter 1: Moving Triangles Project triangle1 Animation Three Triangles Hundred Triangles Copyright by V Miszalok, last update: 2011-03-20 This project
More informationIntroduction to OpenGL Week 1
CS 432/680 INTERACTIVE COMPUTER GRAPHICS Introduction to OpenGL Week 1 David Breen Department of Computer Science Drexel University Based on material from Ed Angel, University of New Mexico Objectives
More informationObjectives. Image Formation Revisited. Physical Approaches. The Programmer s Interface. Practical Approach. Introduction to OpenGL Week 1
CS 432/680 INTERACTIVE COMPUTER GRAPHICS Introduction to OpenGL Week 1 David Breen Department of Computer Science Drexel University Objectives Learn the basic design of a graphics system Introduce graphics
More informationAn Introduction to Windows Programming Using VC++ Computer Graphics. Binghamton University. EngiNet. Thomas J. Watson
Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced
More informationComputer Graphics. Chapter 10 Three-Dimensional Viewing
Computer Graphics Chapter 10 Three-Dimensional Viewing Chapter 10 Three-Dimensional Viewing Part I. Overview of 3D Viewing Concept 3D Viewing Pipeline vs. OpenGL Pipeline 3D Viewing-Coordinate Parameters
More informationLectures OpenGL Introduction
Lectures OpenGL Introduction By Tom Duff Pixar Animation Studios Emeryville, California and George Ledin Jr Sonoma State University Rohnert Park, California 2004, Tom Duff and George Ledin Jr 1 What is
More informationOpenGL. Toolkits.
http://www.opengl.org OpenGL Open Graphics Library Graphics API Delivered with UNIX, Win9x/2000/Me/Nt/Xp, Mac OS Direct3D (DirectX) is only Windows Utilizes the window system and event handling of the
More information// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations
#include int main(int argc, char** argv) { glutinit(&argc, argv); Typical OpenGL/GLUT Main Program // GLUT, GLU, and OpenGL defs // program arguments // initialize glut and gl // double buffering
More informationTo Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)
Computer Graphics (Fall 2008) COMS 4160, Lecture 9: OpenGL 1 http://www.cs.columbia.edu/~cs4160 To Do Start thinking (now) about HW 3. Milestones are due soon. Course Course 3D Graphics Pipeline 3D Graphics
More informationDrawing Primitives. OpenGL basics
CSC 706 Computer Graphics / Dr. N. Gueorguieva 1 OpenGL Libraries Drawing Primitives OpenGL basics OpenGL core library OpenGL32 on Windows GL on most unix/linux systems (libgl.a) OpenGL Utility Library
More informationCS 4204 Computer Graphics
CS 4204 Computer Graphics OpenGL Basics Yong Cao Virginia Tech References: 2001 Siggraph, An Interactive Introduction to OpenGL Programming, Dave Shreiner,Ed Angel, Vicki Shreiner Official Presentation
More informationCSE4030 Introduction to Computer Graphics
CSE4030 Introduction to Computer Graphics Dongguk University Jeong-Mo Hong Timetable 00:00~00:10 Introduction (English) 00:10~00:50 Topic 1 (English) 00:50~00:60 Q&A (English, Korean) 01:00~01:40 Topic
More informationLecture 4 of 41. Lab 1a: OpenGL Basics
Lab 1a: OpenGL Basics William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://snipurl.com/1y5gc Course web site: http://www.kddresearch.org/courses/cis636 Instructor
More informationComputer Graphics (Basic OpenGL)
Computer Graphics (Basic OpenGL) Thilo Kielmann Fall 2008 Vrije Universiteit, Amsterdam kielmann@cs.vu.nl http://www.cs.vu.nl/ graphics/ Computer Graphics (Basic OpenGL, Input and Interaction), ((57))
More informationBasic Graphics Programming
15-462 Computer Graphics I Lecture 2 Basic Graphics Programming Graphics Pipeline OpenGL API Primitives: Lines, Polygons Attributes: Color Example January 17, 2002 [Angel Ch. 2] Frank Pfenning Carnegie
More informationERKELEY DAVIS IRVINE LOS ANGELES RIVERSIDE SAN DIEGO SAN FRANCISCO EECS 104. Fundamentals of Computer Graphics. OpenGL
ERKELEY DAVIS IRVINE LOS ANGELES RIVERSIDE SAN DIEGO SAN FRANCISCO SANTA BARBARA SANTA CRUZ EECS 104 Fundamentals of Computer Graphics OpenGL Slides courtesy of Dave Shreine, Ed Angel and Vicki Shreiner
More informationCMSC 425: Lecture 4 More about OpenGL and GLUT Tuesday, Feb 5, 2013
CMSC 425: Lecture 4 More about OpenGL and GLUT Tuesday, Feb 5, 2013 Reading: See any standard reference on OpenGL or GLUT. Basic Drawing: In the previous lecture, we showed how to create a window in GLUT,
More information3D computer graphics: geometric modeling of objects in the computer and rendering them
SE313: Computer Graphics and Visual Programming Computer Graphics Notes Gazihan Alankus, Spring 2012 Computer Graphics 3D computer graphics: geometric modeling of objects in the computer and rendering
More informationEarly History of APIs. PHIGS and X. SGI and GL. Programming with OpenGL Part 1: Background. Objectives
Programming with OpenGL Part 1: Background Early History of APIs Objectives Development of the OpenGL API OpenGL Architecture - OpenGL as a state machine Functions - Types -Formats Simple program IFIPS
More informationIntroduction to OpenGL Transformations, Viewing and Lighting. Ali Bigdelou
Introduction to OpenGL Transformations, Viewing and Lighting Ali Bigdelou Modeling From Points to Polygonal Objects Vertices (points) are positioned in the virtual 3D scene Connect points to form polygons
More informationCOMPUTER GRAPHICS LAB # 3
COMPUTER GRAPHICS LAB # 3 Chapter 2: COMPUTER GRAPHICS by F.S HILLs. Initial steps in drawing figures (polygon, rectangle etc) Objective: Basic understanding of simple code in OpenGL and initial steps
More informationCS354 Computer Graphics Viewing and Modeling
Slide Credit: Donald S. Fussell CS354 Computer Graphics Viewing and Modeling Qixing Huang February 21th 2018 Computer Viewing There are three aspects of the viewing process, all of which are implemented
More informationTutorial 3: A Simple Window
Tutorial 3: A Simple Window In this tutorial, we will build a Windows program that displays a fully functional window on the desktop. Source Code for This Tutorial: // Iczelion's tutorial #3: A Simple
More informationProgramming with OpenGL Part 1: Background
Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Objectives Development of the OpenGL API
More informationIntroduction to Computer Graphics with OpenGL/GLUT
Introduction to Computer Graphics with OpenGL/GLUT What is OpenGL? A software interface to graphics hardware Graphics rendering API (Low Level) High-quality color images composed of geometric and image
More informationCS410 Visual Programming Solved Online Quiz No. 01, 02, 03 and 04. For Final Term Exam Preparation by Virtualians Social Network
CS410 Visual Programming Solved Online Quiz No. 01, 02, 03 and 04 For Final Term Exam Preparation by Virtualians Social Network 1. Ptr -> age is equivalent to *ptr.age ptr.age (ptr).age (*ptr).age 2. is
More informationCSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science
CSC 307 1.0 Graphics Programming Department of Statistics and Computer Science Graphics Programming OpenGL 3D Drawing 2 3D Graphics Projections Getting 3D to 2D 3D scene 2D image 3 Projections Orthographic
More informationOpenGL Introduction Computer Graphics and Visualization
Fall 2009 2 OpenGL OpenGL System Interaction Portable Consistent visual display regardless of hardware, OS and windowing system Callable from Ada, C, C++, Fortran, Python, Perl and Java Runs on all major
More informationProgramming with OpenGL Part 1: Background
Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Objectives Development of the OpenGL API
More information4 th (Programmatic Branch ) Advance Windows Programming class
Save from: www.uotechnology.edu.iq 4 th (Programmatic Branch ) Advance Windows Programming class برمجة نوافذ المتقدمة أعداد :م.علي حسن حمادي 2006... 2010 >==> 2012 2013 CONTENTS: The Components of a Window
More informationComputer Graphics. OpenGL
Computer Graphics OpenGL What is OpenGL? OpenGL (Open Graphics Library) is a library for computer graphics It consists of several procedures and functions that allow a programmer to specify the objects
More informationAdvanced Computer Graphics (CS & SE )
Advanced Computer Graphics (CS & SE 233.420) Topics Covered Picking Pipeline Viewing and Transformations Rendering Modes OpenGL can render in one of three modes selected by glrendermode(mode) GL_RENDER
More informationComputer Graphics. Bing-Yu Chen National Taiwan University
Computer Graphics Bing-Yu Chen National Taiwan University Introduction to OpenGL General OpenGL Introduction An Example OpenGL Program Drawing with OpenGL Transformations Animation and Depth Buffering
More informationCameras (and eye) Ideal Pinhole. Real Pinhole. Real + lens. Depth of field
Cameras (and eye) Ideal Pinhole Real Pinhole Real + lens Depth of field 1 Z-buffer How do we draw objects? Polygon Based Fast Raytracing Ray/Object intersections Slow Copyright Pixar 2 Raytracing for each
More informationGraphics Programming. 1. The Sierpinski Gasket. Chapter 2. Introduction:
Graphics Programming Chapter 2 Introduction: - Our approach is programming oriented. - Therefore, we are going to introduce you to a simple but informative problem: the Sierpinski Gasket - The functionality
More informationComputer Programming Lecture 11 이윤진서울대학교
Computer Programming Lecture 11 이윤진서울대학교 2007.1.24. 24 Slide Credits 엄현상교수님 서울대학교컴퓨터공학부 Computer Programming, g, 2007 봄학기 Object-Oriented Programming (2) 순서 Java Q&A Java 개요 Object-Oriented Oriented Programming
More informationDescribe the Orthographic and Perspective projections. How do we combine together transform matrices?
Aims and objectives By the end of the lecture you will be able to Work with multiple transform matrices Describe the viewing process in OpenGL Design and build a camera control APIs Describe the Orthographic
More informationUlf Assarsson Department of Computer Engineering Chalmers University of Technology
Ulf Assarsson Department of Computer Engineering Chalmers University of Technology 1. I am located in room 4115 in EDIT-huset 2. Email: 3. Phone: 031-772 1775 (office) 4. Course assistant: Tomas Akenine-Mőller
More informationLecture 2 CISC440/640 Spring Department of Computer and Information Science
Lecture 2 CISC440/640 Spring 2015 Department of Computer and Information Science Today s Topic The secrets of Glut-tony 2 So let s do some graphics! For the next week or so this is your world: -1 1-1 1
More informationGraphics Pipeline & APIs
Graphics Pipeline & APIs CPU Vertex Processing Rasterization Fragment Processing glclear (GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT); glpushmatrix (); gltranslatef (-0.15, -0.15, solidz); glmaterialfv(gl_front,
More informationOpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL
OpenGL: Open Graphics Library Introduction to OpenGL Part II CS 351-50 Graphics API ( Application Programming Interface) Software library Layer between programmer and graphics hardware (and other software
More informationOpenGL Tutorial. Ceng 477 Introduction to Computer Graphics
OpenGL Tutorial Ceng 477 Introduction to Computer Graphics Adapted from: http://www.cs.princeton.edu/courses/archive/spr06/cos426/assn3/opengl_tutorial.ppt OpenGL IS an API OpenGL IS nothing more than
More informationSpring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013
Spring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013 PROJECT GOAL: Write a restricted OpenGL library. The goal of the project is to compute all the transformation matrices with your
More informationCS450/550. Pipeline Architecture. Adapted From: Angel and Shreiner: Interactive Computer Graphics6E Addison-Wesley 2012
CS450/550 Pipeline Architecture Adapted From: Angel and Shreiner: Interactive Computer Graphics6E Addison-Wesley 2012 0 Objectives Learn the basic components of a graphics system Introduce the OpenGL pipeline
More information3D Graphics for Game Programming (J. Han) Chapter II Vertex Processing
Chapter II Vertex Processing Rendering Pipeline Main stages in the pipeline The vertex processing stage operates on every input vertex stored in the vertex buffer and performs various operations such as
More informationModels and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico
Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Objectives Learn the basic design of a graphics system Introduce
More informationCSE 167: Lecture #4: Vertex Transformation. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012
CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Project 2 due Friday, October 12
More informationOpenGL Basics I. Seoul National University Graphics & Media Lab
OpenGL Basics I Seoul National University Graphics & Media Lab Contents Introduction to OpenGL OpenGL sample 01 OpenGL primitives OpenGL colors Introduction to OpenGL Evolution of Computers 4 Graphics
More informationModels and Architectures
Models and Architectures Objectives Learn the basic design of a graphics system Introduce graphics pipeline architecture Examine software components for an interactive graphics system 1 Image Formation
More informationVisualizing Molecular Dynamics
Visualizing Molecular Dynamics Aiichiro Nakano Collaboratory for Advanced Computing & Simulations Department of Computer Science Department of Physics & Astronomy Department of Chemical Engineering & Materials
More informationComputer graphic -- Programming with OpenGL I
Computer graphic -- Programming with OpenGL I A simple example using OpenGL Download the example code "basic shapes", and compile and run it Take a look at it, and hit ESC when you're done. It shows the
More informationCSC 8470 Computer Graphics. What is Computer Graphics?
CSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures can be generated using a computer. But it also includes: software tools used to make pictures hardware
More informationGraphics Pipeline & APIs
3 2 4 Graphics Pipeline & APIs CPU Vertex Processing Rasterization Processing glclear (GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT); glpushmatrix (); gltranslatef (-0.15, -0.15, solidz); glmaterialfv(gl_front,
More informationIntroduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico Models and Architectures
More informationCSE4030 Introduction to Computer Graphics
CSE4030 Introduction to Computer Graphics Dongguk University Jeong-Mo Hong Week 2 The first step on a journey to the virtual world An introduction to computer graphics and interactive techniques How to
More informationTransformation Pipeline
Transformation Pipeline Local (Object) Space Modeling World Space Clip Space Projection Eye Space Viewing Perspective divide NDC space Normalized l d Device Coordinatesd Viewport mapping Screen space Coordinate
More informationTransformations (Rotations with Quaternions) October 24, 2005
Computer Graphics Transformations (Rotations with Quaternions) October 4, 5 Virtual Trackball (/3) Using the mouse position to control rotation about two axes Supporting continuous rotations of objects
More informationGraphics Hardware and OpenGL
Graphics Hardware and OpenGL Ubi Soft, Prince of Persia: The Sands of Time What does graphics hardware have to do fast? Camera Views Different views of an object in the world 1 Camera Views Lines from
More informationBasic Graphics Programming
CSCI 480 Computer Graphics Lecture 2 Basic Graphics Programming January 11, 2012 Jernej Barbic University of Southern California http://www-bcf.usc.edu/~jbarbic/cs480-s12/ Graphics Pipeline OpenGL API
More informationCS559: Computer Graphics. Lecture 12: OpenGL Transformation Li Zhang Spring 2008
CS559: Computer Graphics Lecture 2: OpenGL Transformation Li Zhang Spring 28 Today Transformation in OpenGL Reading Chapter 3 Last time Primitive Details glpolygonmode(glenum face, GLenum mode); face:
More informationOpenGL. Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University
OpenGL Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University Background Software interface to graphics hardware 250+ commands Objects (models) are built from geometric primitives
More informationAssignment 1. Simple Graphics program using OpenGL
Assignment 1 Simple Graphics program using OpenGL In this assignment we will use basic OpenGL functions to draw some basic graphical figures. Example: Consider following program to draw a point on screen.
More informationOpenGL/GLUT Intro. Week 1, Fri Jan 12
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner OpenGL/GLUT Intro Week 1, Fri Jan 12 http://www.ugrad.cs.ubc.ca/~cs314/vjan2007 News Labs start next week Reminder:
More informationComputer Graphics. Chapter 3 Computer Graphics Software
Computer Graphics Chapter 3 Computer Graphics Software Outline Graphics Software Packages Introduction to OpenGL Example Program 2 3 Graphics Software Software packages General Programming Graphics Packages
More informationImage Rendering. Rendering can be divided into three sub-problems. Image Formation The hidden surface problem visibility determination steps
Image Rendering Rendering can be divided into three sub-problems Image Formation The hidden surface problem visibility determination steps Illumination Direct illumination Indirect illumination Shading
More information11/1/13. Basic Graphics Programming. Teaching Assistant. What is OpenGL. Course Producer. Where is OpenGL used. Graphics library (API)
CSCI 420 Computer Graphics Lecture 2 Basic Graphics Programming Teaching Assistant Yijing Li Office hours TBA Jernej Barbic University of Southern California Graphics Pipeline OpenGL API Primitives: Lines,
More informationLuiz Fernando Martha André Pereira
Computer Graphics for Engineering Numerical simulation in technical sciences Color / OpenGL Luiz Fernando Martha André Pereira Graz, Austria June 2014 To Remember Computer Graphics Data Processing Data
More informationAnnouncements OpenGL. Computer Graphics. Spring CS4815
Computer Graphics Spring 2017-2018 Outline 1 2 Tutes and Labs Tute02, vector review (see matrix) Week02 lab Lab Marking 10 labs in total each lab worth 3% of overall grade marked on attendance and completion
More informationAnnouncements OpenGL. Computer Graphics. Autumn 2009 CS4815
Computer Graphics Autumn 2009 Outline 1 Labs 2 Labs Outline 1 Labs 2 Labs Labs Week02 lab Marking 8 10 labs in total each lab worth 2 3% of overall grade marked on attendance and completion of lab completed
More information6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm
6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm In this assignment, you will add an interactive preview of the scene and solid
More informationAnnouncement. Homework 1 has been posted in dropbox and course website. Due: 1:15 pm, Monday, September 12
Announcement Homework 1 has been posted in dropbox and course website Due: 1:15 pm, Monday, September 12 Today s Agenda Primitives Programming with OpenGL OpenGL Primitives Polylines GL_POINTS GL_LINES
More informationComputer Viewing Computer Graphics I, Fall 2008
Computer Viewing 1 Objectives Introduce mathematics of projection Introduce OpenGL viewing functions Look at alternate viewing APIs 2 Computer Viewing Three aspects of viewing process All implemented in
More information3D Graphics and OpenGl. First Steps
3D Graphics and OpenGl First Steps Rendering of 3D Graphics Objects defined in (virtual/mathematical) 3D space. Rendering of 3D Graphics Objects defined in (virtual/mathematical) 3D space. We see surfaces
More information1 (Practice 1) Introduction to OpenGL
1 (Practice 1) Introduction to OpenGL This first practical is intended to get you used to OpenGL command. It is mostly a copy/paste work. Try to do it smartly by tweaking and messing around with parameters,
More informationComputer Graphics. Making Pictures. Computer Graphics CSC470 1
Computer Graphics Making Pictures Computer Graphics CSC470 1 Getting Started Making Pictures Graphics display: Entire screen (a); windows system (b); [both have usual screen coordinates, with y-axis y
More informationCS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008
CS559: Computer Graphics Lecture 12: OpenGL Li Zhang Spring 2008 Reading Redbook Ch 1 & 2 So far: 3D Geometry Pipeline Model Space (Object Space) Rotation Translation Resizing World Space M Rotation Translation
More informationCS 4731 Lecture 3: Introduction to OpenGL and GLUT: Part II. Emmanuel Agu
CS 4731 Lecture 3: Introduction to OpenGL and GLUT: Part II Emmanuel Agu Recall: OpenGL Skeleton void main(int argc, char** argv){ // First initialize toolkit, set display mode and create window glutinit(&argc,
More informationComputer Graphics 1 Computer Graphics 1
Projects: an example Developed by Nate Robbins Shapes Tutorial What is OpenGL? Graphics rendering API high-quality color images composed of geometric and image primitives window system independent operating
More informationComputer Graphics Programming
Computer Graphics Programming Graphics APIs Using MFC (Microsoft Foundation Class) in Visual C++ Programming in Visual C++ GLUT in Windows and Unix platform Overview and Application Graphics APIs Provide
More informationOpenGL Transformations
OpenGL Transformations R. J. Renka Department of Computer Science & Engineering University of North Texas 02/18/2014 Introduction The most essential aspect of OpenGL is the vertex pipeline described in
More informationCSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation
CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013 Announcements Project 2 due Friday, October 11
More information