cp411 computer graphics pipeline and graphics software # 1 lecture 3 graphics pipeline and graphics...

40
CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1. Graphics pipeline 2. Coordinate systems 3. Graphics software Specific-purpose graphics packages Computer-Graphics Application Programming Interface (CG API) OpenGL 4. OpenGL example and testing CG demo

Upload: jarrett-tingle

Post on 14-Dec-2015

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 1

Lecture 3 Graphics Pipeline and Graphics Software

1. Graphics pipeline

2. Coordinate systems

3. Graphics software– Specific-purpose graphics packages– Computer-Graphics Application Programming Interface

(CG API)– OpenGL

4. OpenGL example and testing

CG demo

Page 2: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

Answer Questions1. What are the four major parts of a typical raster graphics system?

2. A raster system has a resolution of 1280 by 1024. If the color depth is 24 bits per pixel. What size frame buffer (in bytes) is needed for this system?

3. How long would it take to load a 1280 by 1024 frame buffer with 16 bits per pixel if 64*106 bits can be transferred per second?

4. A raster system has a resolution of 1280 by 1024. How many pixels could be accessed per second by a display controller that refreshes the screen at a rate of 60 frames per second?

CP411 Computer Graphics Graphics Hardware # 2

Page 3: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 3

Rendering 3D Scenes

Model and view

Transform

Illuminate

Transform

Clip

Project

Rasterize

Rendering Frame buffer Display

Page 4: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 4

Rendering Steps

ModelingTransforms

Scene graphObject geometry

LightingCalculations

ViewingTransform

Clipping

ProjectionTransform

Mapping to Display

Page 5: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 5

Graphics pipeline

Page 6: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 6

Graphics pipeline• Scenes are composed of models in two or three-

dimensional space

• Models are composed of primitives (such as vertex, line, triangle, polygons) supported by the rendering system

• Models are entered by hands or created by programs.

• The image is drawn on monitor, printed on laser printer, or written to a raster in memory or a file. Rendering is the conversion from a scene to an image

• Graphics pipeline is the finer steps of conversion from model to scene and to image

Page 7: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 7

Coordinate systems in the pipeline

1. Modeling Coordinate System (MCS), local coordinate or master coordinate

2. World Coordinate System (WCS)

3. Viewer Coordinate System (VCS)

4. Normalized Device Coordinate System (NDCS)

5. Device Coordinate System or equivalently the Screen Coordinate System (DCS or SCS)

Page 8: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 8

Transformations

• Modeling transforms (models to world)– position, scale, rotation

• Viewing transforms (world to viewer’s world)– Position of camera (eye).

• Projection transforms (viewer’s world to viewer’s plane)– Project the objects into a plane

• Display transformation (view plane to display)– Mapping the view portion to display window

Page 9: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

Transformations

CP411 Computer Graphics Fall 2006 Wilfrid Laurier University Pipeline and graphics software # 9

Page 10: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 10

Projection

• Projection transforms primitives in 3D to 2D

• Parallel projection

• Perspective project

Page 11: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 11

Illumination and Shading

• Lighting (derived information) – The color and intensity of primitives may be added in the

rendering process according to the light source and reflection of features of the objects

– Often, determine the color intensity of vertices of a primitive

• Determine the color intensity of each pixel of a primitive– Using the vertex color or a texture and shading models

Page 12: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 12

Culling and Clipping

• Culling is to remove hidden primitives– No need to render primitives covered by other primitive, so they

may be removed and save computing time

• Clipping– To remove or modify primitives if they are not within the view

portion

Page 13: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 13

Primitives

• Models are composed of/converted to geometric primitives.

• Typical rendering primitives directly supported in hardware:– Points (single pixels)– Line segments– Polygons (perhaps only convex polygons or triangles).– Modeling primitives also include– Piecewise polynomial (spline) curves– Piecewise polynomial (spline) surfaces– Implicit surfaces (quadrics, bobbies, etc)

Page 14: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 14

Rendering Primitives

• Algorithms are used to implement primitives. Such algorithms are called scan conversion algorithms.

• Scan conversion algorithms are implemented in either software or hardware.

• Hardware implementation is usually in GPU.

• Software implementation can ran in CPU, or GPU if it is programmable.

Page 15: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 15

Graphics algorithms• Basic algorithms

– Transformation: Convert representations of models/primitives from one coordinate system to another.

– Culling and clipping: Remove primitives and parts of primitives that are not visible on the display.

– Rasterization: Convert a projected screen-space primitive to a set of pixels.

• Advanced algorithms:– Picking: Select a 3D object by clicking an input device over a

pixel location.– Shading and Illumination: Simulate the interaction of light with

a scene.– Animation: Simulate movement by rendering a sequence of

frames.

Page 16: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 16

Graphics software• A graphics software is a package consisting of implementation of

the graphics algorithms

• Special purpose packages– For non-programmers – Generate pictures, graphs, in some application area– Use menus and button and input device to create – No need to worry about the graphic procedure– Examples

• General programming graphics packages– Provide library of graphics functions that can be used in a

programming language through API calls– Graphics functions include straight lines, polygons, sphere, and some

other simple geometric shapes

Page 17: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Pipeline and graphics software # 17

CG API standard specification

• A standard CG API specification by an institute that followed by CG hardware and software venders for their products

• Example: OpenGL is CG API specification

– It has C/C++ implementation, hardware implementation, and Java implementation

• Direct3D is another standard by Microsoft

Page 18: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

OpenGL

1. Introduction to OpenGL

2. OpenGL related library

3. OpenGL program structure

4. OpenGL routines for drawing primitives

5. Work with I/O devices

6. OpenGL installation and configuration

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 18

Page 19: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Wilfrid Laurier University Pipeline and graphics software # 19

Figure 22-3 The OpenGL fixed-function pipeline.

Page 20: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 20

1. Introduction to OpenGL• What is OpenGL (Open Graphics Library) ?

Provide a standard specification defining a cross-platform API for writing applications that produce 3D computer graphics (and 2D computer graphics as well).

– Mid-level, device-independent, portable graphics subroutine package

– Developed primarily by SGI in early of 1990’s. – Does not include low-level I/O management– Basis for higher-level libraries/toolkits, GLU, GLUT– OpenGL provides a standard implementation for graphics

pipeline and scan conversion algorithms for fundamental primitives.

Page 21: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 21

A brief history of OpenGL• OpenGL 1.0

– released in 1992, by OpenGL architectural review board (OpenGL ARB), by Mark Segal and Kurt Akeley

• OpenGL 2.0– Released on September 7, 2004. Support Shader language

GLSL• OpenGL 3.0

– Released on July 11, 2008.• OpenGL 4.0

– Released on March 11, 2010

• Current OpenGL 4.2– Released on 8 August 201

Check more on textbook Appendix C or Wiki

Page 22: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 22

OpenGL Design Goals• SGI’s design goals for OpenGL:

– High-performance (hardware-accelerated) graphics API– Some hardware independence – Natural, terse API with some built-in extensibility

• To add new functions to adapt to new hardware features

• Why has OpenGL become a CG standard?– It doesn’t try to do too much

• Only renders the image, doesn’t manage windows, etc.• No high-level animation, modeling, sound (!), etc.

– It does enough• Useful rendering effects + high performance

– It was promoted by SGI (and Microsoft), is now promoted/supported by NVIDIA, ATI, etc.

– It doesn’t change every year

• Work with Network environment– Client: ran programs and issue OpenGL drawing command– Server: receive commands and perform the drawing

Page 23: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 23

• OpenGL does the rendering pipeline:– Transform geometry (object ->world ->eye->device-> frame buffer)– Calculate surface lighting– Apply perspective projection (eye ->screen)– Clip– Perform visible-surface processing– Scan conversion/rasterization of primitives

– Core functions/routines, for transformation, and rasteriziation for primitives for 2D/3D graphics, and many others.

• GL functions have a prefix gl

OpenGL

Page 24: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 24

2. Related Libraries• OpenGL utility library (GLU)

– It consists of a number of functions that use the base OpenGL library to provide higher-level drawing routines from the more primitive routines that OpenGL provides.

– It is usually distributed with the base OpenGL package– Functions in GLU are basically built up by routines from GL

• Features including• Setting up viewing and projection• Describing complex objects with line and polygon approximaiton• Display quadrics and B-splines using approximaition• It also provides additional primitives for use in OpenGL

applications, including spheres, cylinders and disks • Generally in more human-friendly terms than the routines

presented by OpenGL.

Page 25: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 25

GLUT• OpenGL Utility Toolkit (GLUT) was written by Mark J. Kilgard

– A library of utilities for OpenGL programs, which primarily perform system-level I/O with the host operating system.

– Functions performed include window definition, window control, and monitoring of keyboard and mouse input: including setting up windows, window size, position, keyboard, mouse, etc.

– Functions with prefix: glut, see glut reference

• Features– Routines for drawing a number of geometric primitives (both in solid

and wireframe mode), including cubes, spheres, and the teapot – GLUT has some limited support for creating pop-up menus

• Note that there special extension for each platform– GLX for X window system– Apple GL (AGL)– WGL (Windows-to-OpenGL)

Page 26: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 26

GLUI

• GLUI is a GLUT-based C++ user interface library(was written by Paul Rademacher) – It provides controls such as buttons, checkboxes, radio

buttons, and spinners to OpenGL applications

– It is window- and operating system independent, relying on GLUT to handle all system-dependent issues, such as window and mouse management

– GLUI can be installed by updating from Dev-C++

Page 27: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 27

OpenGL: Conventions

• Functions in OpenGL start with gl– Most functions just gl (e.g., glColor()) – Functions starting with glu are utility functions (e.g., gluLookAt())

– Functions starting with glx are for interfacing with the X Windows system (e.g., in gfx.c)

See OpenGL example, textbook chapter 3, page 46.

Page 28: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

#include <GL/glut.h> // (or others, depending on the system in use)

void init (void)

{

glClearColor (1.0, 1.0, 1.0, 0.0); // Set display-window color to white.

glMatrixMode (GL_PROJECTION); // Set projection parameters.

gluOrtho2D (0.0, 200.0, 0.0, 150.0);

}

void lineSegment (void)

{

glClear (GL_COLOR_BUFFER_BIT); // Clear display window.

glColor3f (0.0, 0.0, 1.0); // Set line segment color to red.

glBegin (GL_LINES);

glVertex2i (180, 15); // Specify line-segment geometry.

glVertex2i (10, 145);

glEnd ( );

glFlush ( ); // Process all OpenGL routines as quickly as possible.

}

CP411 Computer Graphics Wilfrid Laurier University Pipeline and graphics software # 28

Page 29: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

int main (int argc, char** argv)

{

glutInit (&argc, argv); // Initialize GLUT.

glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); // Set display mode.

glutInitWindowPosition (50, 100); // Set top-left display-window position.

glutInitWindowSize (400, 300); // Set display-window width and height.

glutCreateWindow ("An Example OpenGL Program"); // Create display window.

init ( ); // Execute initialization procedure.

glutDisplayFunc (lineSegment); // Send graphics to display window.

glutMainLoop ( ); // Display everything and wait.

}

CP411 Computer Graphics Wilfrid Laurier University Pipeline and graphics software # 29

Page 30: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 30

3. OpenGL Program StructureBasic program structure: C/C++ with function call to OpenGL functions

– Header– Global variables and data structures for controls and modeling– Self-defined functions (C/C++, gl, glu, glui, function calls are involved) – Main function (glut functions calls are involved)

• Header files #include <windows.h> #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> #include <GL/glui.h> // if GLUI is installed

– If glut.h is included, no need to include gl.h and glu.h– Libraries links (on Windows platform) for the project

-lopengl32 -lglu32 -lglut32 -lwinmm– May include other C/C++ headers, such as stdio.h, stdlib.h, math.h, etc.

Page 31: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 31

• main() function– Main() includes glut functions

1. GLUT initialization

2. Create a window and attach OpenGL to it

3. Set camera parameters

Setup lighting, if any

4. Register callback functions– Key press, mouse movement, screen resize

5. Main rendering loop– OpenGL controls execution from this point forward

Page 32: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 32

1. GLUT initialization

glutInit(&argc, argv);– argc and argv potentially used by glutInit and preserved

glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE );

– Red, green, blue, and alpha (transparency), double buffer, and depth buffered

glutInitWindowSize(400, 300); // default 400 by 300

glutInitWindowPosition(50, 100);

2. Create a windowglutCreateWindow(“An example of OpenGL grogram”);

Page 33: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 33

3. Define viewport, project, matrixmod (defined in init() )

glClearColor (1.0, 1.0, 1.0, 0.0); // Set display-window color to white.

glMatrixMode (GL_PROJECTION); // Set projection parameters.

gluOrtho2D (0.0, 200.0, 0.0, 150.0);

• More glViewport(0, 0, width, height);

– Viewport is the portion of the window on the project plane you want to render

Page 34: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 34

5. Register callback fucntionsexecuted upon interrupt caused by user or by OpenGL main loop

glutDisplayFunc(lineSegment);lineSegment() does the rendering, send graphics to display window, redisplay

• More register funcitons

glutReshapeFunc(resize_scene);resize_screen() is executed upon startup and upon window resize

glutKeyboardFunc(key_press);key_press() is executed when a key is pressed

glutMouseFunc(handle_mouse_click);handle_mouse_click() is executed when a mouse button pressed

glutMotionFunc(mouse_motion);mouse_motion() is executed when key clicked and mouse moved

6. Initiate main rendering loopglutMainLoop();

Your program never regains explicit control

Page 35: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

Error handling#include <stdio.h>

GLenum errorCheck ()

{

GLenum code;

const GLubyte *string;

code = glGetError ();

if (code != GL_NO_ERROR)

{

string = gluErrorString (code);

fprintf( stderr, "OpenGL error: %s\n", string );

}

return code;

}

CP411 Computer Graphics Fall 2006 Wilfrid Laurier University Pipeline and graphics software # 35

Page 36: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 36

4. OpenGL routines to draw primitivesvoid lineSegment (void){ glClear (GL_COLOR_BUFFER_BIT);

// Clear display window.

glColor3f (0.0, 0.0, 1.0);// Set line segment color to red.

glBegin (GL_LINES);

glVertex2i (180, 15); // Specify line-segment geometry. glVertex2i (10, 145); glEnd ( );

glFlush ( ); // Clean buffers, make the processing routines fast

}

Page 37: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 37

Specifying Geometry• Simple case first: object vertices already in world

coordinates• Geometry in OpenGL consists of a list of vertices in

between calls to glBegin() and glEnd()A simple example: telling GL to render a triangle

glBegin (GL_POLYGON); glVertex2i (80, 10); glVertex2i (30, 100); glVertex2i (120, 50); glEnd ( );

– Usage: glBegin(geomtype) where geomtype is:points, lines, polygons, triangles, quadrilaterals, etc...

Page 38: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 38

OpenGL: Triangle Strips

• An OpenGL triangle strip primitive reduces this redundancy by sharing vertices:glBegin(GL_TRIANGLE_STRIP);

glVertex3fv(v0);glVertex3fv(v1);glVertex3fv(v2);glVertex3fv(v3);glVertex3fv(v4);glVertex3fv(v5);

glEnd();

– triangle 0 is v0, v1, v2– triangle 1 is v2, v1, v3– triangle 2 is v2, v3, v4– triangle 3 is v4, v3, v5 (again, not v3, v4, v5)

v0v2

v1v3

v4

v5

Page 39: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 39

• Function names indicate argument type and number– Functions ending with f take floats– Functions ending with i take ints– Functions ending with b take bytes– Functions ending with ub take unsigned bytes– Functions that end with v take an array.– Examples

glColor3f() takes 3 floats

glColor4fv() takes an array of 4 floats

Page 40: CP411 Computer Graphics Pipeline and graphics software # 1 Lecture 3 Graphics Pipeline and Graphics Software 1.Graphics pipeline 2.Coordinate systems 3.Graphics

CP411 Computer Graphics Lecture 4 Introduction to OpenGL 40

5. Working with I/O Devices

1. Key board. See example

2. Mouse. See example

3. Menu and submenu: See example