New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here


by: Vito Kilback

InteractiveComputerGraphics CS432

Marketplace > Drexel University > ComputerScienence > CS432 > InteractiveComputerGraphics
Vito Kilback
GPA 3.88


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in ComputerScienence

This 108 page Class Notes was uploaded by Vito Kilback on Wednesday September 23, 2015. The Class Notes belongs to CS432 at Drexel University taught by DavidBreen in Fall. Since its upload, it has received 17 views. For similar materials see /class/212448/cs432-drexel-university in ComputerScienence at Drexel University.

Similar to CS432 at Drexel

Popular in ComputerScienence


Reviews for InteractiveComputerGraphics


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/23/15
CS 432637 INTERACTIVE COMPUTER GRAPHICS Display Issues Week5 David Breen Department of Computer Science Drexel University Based on material from Ed Angel University of New Mexico Objectives Consider perceptual issues related to displays Introduce chromaticity space Color systems Color transformations Standard Color Systems Angel Interactive Computer Graphics 3E AddisonWesley 2002 Perception Review Light is the part of the electromagnetic spectrum between 350750 nm A color CO is a distribution of energies within this range The human visual system has three types of cones on the retina each with its own spectral sensitivies Consequently only three values the tristimuus values are seen by the brain Angel Interactive Computer Graphics BE 3 AddisonWesley 2002 Tristimulus Values The human visual center has three cones with sensitivity curves S100 820 and 33W For a color Ck the cones output the ri iml v tst uus aues CW T1 fS1ACAdA T2 szACAdL optic nerve gt T3 fS3 ACd Cones T12 T2 T3 Angel Interactive Computer Graphics BE 4 AddisonWesley 2002 Three Color Theory Any two colors with the same tristimulus values are perceived to be identical Thus a display CRT LCD film must only produce the correct tristimulus values to match a color Is this possible Not always Different primaries different sensitivity curves in different systems Angel Interactive Computer Graphics 3E AddisonWesley 2002 The Problem The sensitivity curves of the human are not the same as those of physical devices Human curves centered in blue green and greenyellow CRT RGB Print media CMY or CMYK Which colors can we match and if we cannot match how close can we come Angel Interactive Computer Graphics 3E AddisonWesley 2002 Representing Colors Consider a color CO It generates tristimulus values T1 T2 T3 Write C T1 T2 T3 Conventionallywe assume 12 T1 T2 T3 2 0 because there is a maximum brightness we can produce and energy is nonnegative C is a point in color solid 1 OC T2 T T 1 1 Angel Interactive Computer Graphics BE 7 AddisonWesley 2002 Producing Colors Consider a device such as a CRT with RGB primaries and sensitivity curves ag Tristimulus values T2 fGACAdA T1 fRACAW T3 fBACAdA an Gl RU Angel Interactive Computer Graphics 3E 8 AddisonWesley 2002 Matching This T1 T2 T3 is dependent on the particular device If we use another device we will get different values and these values will not match those of the human cone curves Need a way of matching and a way of normalizing Angel Interactive Computer Graphics 3E AddisonWesley 2002 Color Systems Various color systems are used Based on real primaries NTSC RGB UVW CMYK HLS Theoretical XYZ Prefer to separate brightness luminance from color chromatic information Reduce to two dimensions Angel Interactive Computer Graphics 3E AddisonWesley 2002 Producing Other Colors However colors producible on one system its color gamut is not necessarily producible on any other Note that if we produce all the pure spectral colors in the 350750 nm range we can produce all others by adding spectral colors With real systems CRT film we cannot produce the pure spectral colors We can project the color solid of each system into chromaticity space of some system to see how close we can get Angel Interactive Computer Graphics 3E 14 AddisonWesley 2002 Color Gamuts 600 nm spectral colors printer colors producible color on CRT but not on printer CRT colors unproducible O 750 nm producible color on both CRT and printer Angel Interactive Computer Graphics 3E 15 AddisonWesley 2002 350 nm XYZ Reference system in which 10 all visible pure spectral colors can be produced Theoretical systems as y there are no corresponding physical primaries Standard reference system 500 n spectral colors CRT colors 400 nm X 10 Angel Interactive Computer Graphics 3E 16 AddisonWesley 2002 Color models RGB model specify color by red green amp blue components additive model 8 bitscomponent 24 bits total per pixel in the end all others reduce to RGB fordisplay Color models HSV model hue saturation amp value easier for people to think about hue primary wavelength ie basic color saturation measure of how pure light is high is pure low means it is mixed w whitegray value intensity or brightness dark vs light direct conversion to RGB Color models CMY model represent in terms of mixtures of pigments gets color from light it absorbs amp doesn t reflect mix Cyan Magenta Yellow subtractive primaries cyan no red magenta no green yellow no blue used by printers and artists Color matching is quite difficult for printed output sometimes K Black needed for truer printing for shades of black Color Systems Most correspond to real primaries ational Ielevision ystems Qommittee NTSC RGB matches phosphors in CRTs Film both additive RGB and subtractive CMY for positive and negative film Print industry CMYK K black K used to produce sharp crisp blacks Example inkjet printers Angel Interactive Computer Graphics 3E AddisonWesley 2002 20 RGB CMY CMYK Assuming 1 is max of a primary C1 R M1 G Y1 B Convert CMY to CMYK by KminC MY C C K M M K Y YK Angel Interactive Computer Graphics 3E AddisonWesley 2002 22 Color Matrix Exists a 3 x 3 matrix to convert from representation in one system to representation in another T1 T1 T39z 1 T2 T3 T3 Example XYZ to NTSC RGB find in colorimetry references Can take a color in XYZ and find out if it is producible by transforming and then checking if resulting tristimulus values lie in 01 Angel Interactive Computer Graphics 3E 23 AddisonWesley 2002 YIQ NTSC Transmission Colors Here Y is the luminance Arose from need to separate brightness from chromatic information in TV broadcasting Y 0299 0587 0114 R I 0596 0275 0321 G Q 0212 0523 0311 B Note luminance shows high green sensitivity Angel Interactive Computer Graphics 3E AddisonWesley 2002 24 Gamma Intensity vs CRT voltage is nonlinear l CW Can use a lookup table to correct Human brightness response is logarithmic Equal steps in gray levels are not perceived equally Can use lookup table CRTs cannot produce a full black Limits contrast ratio Angel Interactive Computer Graphics 3E AddisonWesley 2002 26 Shading Objectives Learn to shade objects so their images appear threedimensional Introduce the types of lightmaterial interactions Build a simple reflection modelthe Phong model that can be used with real time graphics hardware Angel Interactive Computer Graphics 3E AddisonWesley 2002 28 Sca e ng Light strikes A Some scattered Some absorbed Some of scattered light strikes B Some scattered Some absorbed Some of this scattered light strikes A and so on Angel Interactive Computer Graphics 3E AddisonWesley 2002 Rendering Equation I m gx yex y I806 y ZIy Zdz Surf The infinite scattering and absorption of light can be described by the rendering equation Cannot be solved in general Ray tracing is a special case for perfectly reflecting surfaces Rendering equation is global and includes Shadows Multiple scattering from object to object Angel Interactive Computer Graphics 3E AddisonWesley 2002 Global Effects shadow multiple re ection translucent surface Angel Interactive Computer Graphics 3E 33 AddisonWesley 2002 Local vs Global Rendering Correct shading requires a global calculation involving all objects and light sources Incompatible with pipeline model which shades each polygon independently local rendering However in computer graphics especially real time graphics we are happy if things look right Exist many techniques for approximating global effects Angel Interactive Computer Graphics 3E AddisonWesley 2002 34 LightMaterial Interaction Light that strikes an object is partially absorbed and partially scattered reflected The amount reflected determines the color and brightness of the object A surface appears red under white light because the red component of the light is reflected and the rest is absorbed The reflected light is scattered in a manner that depends on the smoothness and orientation of the surface Angel Interactive Computer Graphics 3E 35 AddisonWesley 2002 Light Sources General light sources are difficult to work with because we must integrate light coming from all points on the source Angel Interactive Computer Graphics 3E 36 AddisonWesley 2002 Simple Light Sources Point source Model with position and color Distant source infinite distance away parallel Spotlight Restrict light from ideal point source Ambient light Same amount of light everywhere in scene Can model contribution of many sources and reflecting surfaces Angel Interactive Computer Graphics 3E AddisonWesley 2002 37 Surface Types The smoother a surface the more re ected light is concentrated in the direction a perfect mirror would re ected the light A very rough surface scatters light in all directions 3 quotl rough surface smooth surface Angel Interactive Computer Graphics 3E AddisonWesley 2002 A simple model that can be computed rapidly Phong Model Has three components Diffuse Specular Ambient Uses four vectors To source To viewer Normal Perfect re ector Angel Interactive Computer Graphics 3E AddisonWesley 2002 Ideal Reflector Normal is determined by local orientation Angle of incidence angle of reflection The three vectors must be coplanar r2lnnl Angel Interactive Computer Graphics 3E AddisonWesley 2002 40 Lambertian Surface Perfectly diffuse reflector Light scattered equally in all directions Amount of light reflected is proportional to the vertical component of incoming light reflected light cos Bi cos Bi l n if vectors normalized There are also three coefficients kr1ltbkg that show how much of each color component is reflected Angel Interactive Computer Graphics 3E 41 AddisonWesley 2002 Di 39use re ection The incident light is scattered equally in all directions incident light surface This is characteristic of dull matt surfaces such as paper bricks caipet 42 Lambert s Law for Diffuse Reflection Purely diffuse object resulting intensity light source intensity diffuse surface reflectance coefficien k E 01 angle between normal amp light direction Specular Surfaces Most surfaces are neither ideal diffusers nor perfectly specular ideal reflectors Smooth surfaces show specular highlights due to incoming light being reflected in directions concentrated close to the direction of a perfect reflection specular highlight Angel Interactive Computer Graphics 3E 44 AddisonWesley 2002 Specular reflection The reflcctcd light is concentrated around thc direction of mirror re ection and is spread outi mirror re ection direction incident light s url acc This can be used to model shiny surl acesi Modeling Specular Reflections Phong proposed using a term that dropped off as the angle between the viewer and the ideal reflection increased IIN ks I coso q 39 re ected shininess coef intensity incoming intensity absorption coef Angel Interactive Computer Graphics 3E 46 AddisonWesley 2002 The Shininess Coefficient Values of or between 100 and 200 correspond to metals Values between 5 and 10 give surface that look like plastic ama 90 90 Angel Interactive Computer Graphics 3E 47 AddisonWesley 2002 L R diffuse speculi7 diffuse H I Diffuse specular re ection Emit111121 V 1 7 7 4i Ambient Light Ambient light is the result of multiple interactions between large light sources and the objects in the environment Amount and color depend on both the color of the lights and the material properties of the object Add ka 1a to diffuse and specular terms re ectiOn COef intensity of ambient light Angel Interactive Computer Graphics 3E AddisonWesley 2002 49 Our Three Basic Components of Illumination Diffuse Specu ar Ambient Combined for the Final Result Distance Terms The light from a point source that reaches a surface is inversely proportional to the square of the distance between them We can add a factor of the form 1a bd cd2 to the diffuse and specular A terms The constant and linear terms soften the effect of the point source Angel Interactive Computer Graphics 3E 52 AddisonWesley 2002 Light Sources In the Phong Model we add the results from each light source Each light source has separate diffuse specular and ambient terms to allow for maximum flexibility even though this form does not have a physical justification Separate red green and blue components Hence 9 coefficients for each point source Idr1dg1 I I I I I 1 db sr sg sb ar ag ab Angel Interactive Computer Graphics 3E 53 AddisonWesley 2002 Material Properties Material properties match light source properties Nine absorbtion coefficients kdr kdg kdb k k ksb k sr sg k kab Shininess coefficient or art ag Angel Interactive Computer Graphics 3E AddisonWesley 2002 54 Adding up the Components For each light source and each color component the Phong model can be written without the distance terms as IkdIdlnkSISVr kaIa n I For each color component we add contributions from all sources Angel Interactive Computer Graphics 3E 55 AddisonWesley 2002 Example Only differences in these teapots are the parameters in the Phong model Angel Interactive Computer Graphics 3E AddisonWesley 2002 Shading in OpenGL Objectives Introduce the OpenGL shading func ons Discuss polygonal shading Flat Smooth Gouraud Angel Interactive Computer Graphics 3E AddisonWesley 2002 58 IhF ON Steps in OpenGL shading Enable shading and select model Specify normals Specify material properties Specify lights Angel Interactive Computer Graphics 3E 59 AddisonWesley 2002 Normals In OpenGL the normal vector is part of the state Set by glNormal glNormal3f x y Z glNormal3fv p Usually we want to set the normal to have unit length so cosine calculations are correct Length can be affected by transformations Note the scale does not preserved length glEnableGLNORMALIZE allows for autonormalization at a performance penalty Angel Interactive Computer Graphics 3E 60 AddisonWesley 2002 Normal for Triangle 1 plane npp00 P2 nP139P0XPz39P0 P1 normalizen lt nn p0 Note that righthand rule determines outward face Angel Interactive Computer Graphics 3E 61 AddisonWesley 2002 Enabling Shading Shading calculations are enabled by glEnable GLLIGHTING Once lighting is enabled glCoIor ignored Must enable each light source individually glEnable GLLIGHTi i01 Can choose light model parameters glLightModeli parameter GLTRUE GLLIGHTMODELLOCALVIEWER use simplifying distant viewer assumption in calculation GLLIGHTMODELTWOSIDED shades both sides of polygons independently GL LIGHT MODEL AMBIENT ambient only shading whEn no light sourc es are enabled Need to supply an ambient light color Angel Interactive Computer Graphics 3E AddisonWesley 2002 62 Defining a Point Light Source For each light source we can set an RGB for the diffuse specular and ambient parts and the position GL float diffuse010 00 00 10 GL float ambient010 0 0 0 0 1 0 GL float specular010 0 Glfloat light0pos10 2 glEnable GLLIGHTING glEnableGLLIGHTO glLightv GLLIGHTO GLPOSITION light0pos glLightv GLLIGHTO GLAMBIENT ambientO glLightv GLLIGHTO GLDIFFUSE diffuseO glLightvGLLIGHTO GLSPECULAR specularO Angel Interactive Computer Graphics 3E 63 AddisonWesley 2002 Distance and Direction The source colors are specified in RGBA The position is given in homogeneous coordinates Ifw 10 we are specifying a finite location Ifw 00 we are specifying a parallel source with the given direction vector Light s position is transformed by the model view matrix and stored in eye coordinates Angel Interactive Computer Graphics 3E 64 AddisonWesley 2002 Light Distance Dropoff Specular amp diffuse attenuation function 1a bd cd2 The coefficients in the distance terms are by default a10 constant terms bc00 linear and quadratic terms Change by a 080 glLightfGLLIGHTO GLCONSTANTATTENUATION a b 060 glLightfGLLIGHTO GLLINEARATTENUATION b C 120 glLightfGLLIGHTO GLQUADRATICATTENUATION 0 Angel Interactive Computer Graphics 3E 65 AddisonWesley 2002 Spotlights p Use glLightv to set Direction GLSPOTDIRECTION Cutoff GLSPOTCUTOFF Attenuation GLSPOTEXPONENT proportional to cosa Intensity Angel Interactive Computer Graphics 3E 66 AddisonWesley 2002 Global Ambient Light Ambient light depends on color of light sources A red light in a white room will cause a red ambient term that disappears when the light is turned off OpenGL allows a global ambient term that is often helpful glLightModelfvGLLIGHTMDDELAMBIENT globalambient Angel Interactive Computer Graphics 3E 67 AddisonWesley 2002 Moving Light Sources Light sources are geometric objects whose positions or directions are affected by the modelview matrix Position is transformed and set in eyecoords Depending on where we place the position direction setting function we can Move the light sources with the objects Fix the objects and move the light sources Fix the light sources and move the objects Move the light sources and objects independen y Angel Interactive Computer Graphics 3E 68 AddisonWesley 2002 Moving Light Sources Keeping light stationary Define light position after LookAt Move light independently Define after LookAt Surround with Push amp PopMatrix Define transformations and light position Move with camera Define position before LookAt Angel Interactive Computer Graphics 3E AddisonWesley 2002 69 Material Properties Material properties are also part of the OpenGL state and match the terms in the Phong model Set by glMaterialv GLfloat ambient GLfloat diffuse GLfloat specular GLfloat shine 1000 glMaterialf GLFRONT GLAMBIENT ambient glMaterialf GLFRONT GLDIFFUSE diffuse glMaterialfGLERONT GLSPECULAR specular glMaterialf GLFRONT GLSHININESS shine Angel Interactive Computer Graphics 3E 70 AddisonWesley 2002 Front and Back Faces The default is shade only front faces which works correct for convex objects If we set two sided lighting OpenGL will shaded both sides of a surface Each side can have its own properties which are set by using GLFRONT GLBACK or GLFRONTANDBACK in glMaterialf 6 back faces not visible back faces visible Angel Interactive Computer Graphics 3E AddisonWesley 2002 Emissive Term We can simulate a light source in OpenGL by giving a material an emissive component This color is unaffected by any sources or transformations GLfloat emission 00 03 03 10 glMaterialf GLFRONT GLEMISSION emission Angel Interactive Computer Graphics 3E AddisonWesley 2002 72 Transparency Material properties are specified as RGBA values The A value can be used to make the surface translucent The default is that all surfaces are opaque regardless of A Later we will enable blending and use this feature Angel Interactive Computer Graphics 3E 73 AddisonWesley 2002 Efficiency Because material properties are part of the state if we change materials for many surfaces we can affect performance We can make the code cleaner by defining a material structure and setting all materials during initialization typedef struct materialStruct GLfloat ambient4 GLfloat diffuse4 GLfloat specular4 GLfloat shineness MaterialStruct We can then select a material by a pointer Angel Interactive Computer Graphics 3E AddisonWesley 2002 74 Polygonal Shading Shading calculations are done for each vertex Vertex colors become vertex shades By default vertex colors are interpolated across the polygon nghadeModel GLSMOOTH If we use nghadeModel GLFLAT the color at the first vertex will determine the color of the whole polygon Angel Interactive Computer Graphics 3E 75 AddisonWesley 2002 Polygon Normals Polygons have a single normal Shades at the vertices as computed by the Phong model can be almost the same Identical for a distant viewer default or ifthere is no specular component i quot Consider model of sphere Want different normals at each vertex even though this concept is not quite correct mathematically Angel Interactive Computer Graphics 3E 76 AddisonWesley 2002 Smooth Shading We can set a new normal at each vertex Easy for sphere model If centered at origin 11 pp Now smooth shading works Note silhouette edge Angel Interactive Computer Graphics 3E AddisonWesley 2002 Mesh Shading The previous example is not general because we knew the normal at each vertex analytically For polygonal models Gouraud proposed we use the average of normals around a mesh n1n2n3n4 n1n2n3n4 I I Angel Interactive Computer Grapmcs JLI AddisonWesley 2002 78 Gouraud and Phong Shading Gouraud Shading Find average normal at each vertex vertex normals Apply Phong model at each vertex lnterpolate vertex shades across each polygon Phong shading Find vertex normals lnterpolate vertex normals across polygon Calculate shade with interpolated normal Angel Interactive Computer Graphics 3E 79 AddisonWesley 2002 CS 432637 INTERACTIVE COMPUTER GRAPHICS Vertex Buffer Objects and Transformations Week4 David Breen Department of Computer Science Drexel University Based on material from Ed Angel University of New Mexico and Manolya Eyiyurekli Drexel University Vertex Buffer Objects VBOs enhance the performance of OpenGL by providing the benefits of vertex arrays and display lists while avoiding downsides of their implementations allow vertex array data to be stored in high performance graphics memory on the server side and promotes efficient data transfer GLARBvertexbufferobject extension should be supported by your graphics card Why not use vertex arrays Advantage Using a vertex array can reduce the number of function calls and redundant usage of the shared vertices Disadvantage Vertex array functions are in the client state and the data in the arrays must be resent to the server each time it is referenced Why not use display lists Advantage Display list is a server side function so it does not suffer from overhead of data transfer Disadvantage Once a display list is compiled the data in the display list cannot be modified Why use VBOs Only Advantages Data in vertex buffer object can be read and updated by mapping the buffer into client39s memory space Shares the buffer objects with many clients like display lists and textures Since VBO is on the server39s side multiple clients will be able to access the same buffer with the corresponding identifier Next How to Create a VBO Draw a VBO Update a VBO Creating VBOs Generate a new buffer object with glGenBuffersARB Bind the buffer object with ngindBufferARBO Copy vertex data to the buffer object with ngufferDataARBO glGenBuffersARB creates buffer objects and returns the identifiers of the buffer objects void glGenBuffersARBGLsizei n GLuint ids n number of buffer objects to create ids the address of a GLuint variable or array to store a single ID or multiple IDs ngindBufferARB Once the buffer object has been created we need to hook the buffer object with the corresponding ID before using the buffer object void ngindBufferARBGLenum target GLuint id Target is either GLARRAYBUFFERARB Any vertex attributes such as vertex coordinates texture coordinates normals and color component arrays GLELEMENTARRAYBUFFERARB Index array which is used for ngrawRangeElements Once ngindBufferARB is first called VBO initializes the buffer with a zerosized memory buffer and set the initial VBO states such as usage and access properties ngufferDataARB You can copy the data into the buffer object with gBufferDataARB when the buffer has been initialized void gBufferDataARBGLenum target GLsizei size const void data GLenum usage target is either GLARRAYBUFFERARB or GLELEMENTARRAYBUFFERARB size is the number of bytes of data to transfer The third parameter is the pointer to the array of source data quotusagequot flag is a performance hint for VBO to provide how the buffer object is going to be used static dynamic or stream and read copy or draw 9 enumerated values for usage flags GLSTATICDRAWARB GLSTATICREADARB GLSTATICCOPYARB GLDYNAMCDRAWARB GLDYNAMCREADARB GLDYNAMCCOPYARB GLSTREAMDRAWARB GLSTREAMREADARB GLSTREAMCOPYARB Static data in VBO will not be changed Dynamic the data will be changed frequently Stream the data will be changed every frame Draw the data will be sent to GPU in order to draw Read the data will be read by the client39s application Copy the data will be used both drawing and reading gBufferSubDataARB void gBufferSubDataARBGLenum target GLint offset GLsizei size void data Like gBufferDataARB used to copy data into VBO It only replaces a range of data into the existing buffer starting from the given offset The total size of the buffer must be set by gBufferDataARB before using gBufferSubDataARB ngeleteBuffersARBo void glDeleteBuffersARBGLsizei n const GLuint ids You can delete a single VBO or multiple VBOs with ngeleteBuffersARB if they are not used anymore After a buffer object is deleted its contents will be lost Drawing VBO VBO sits on top of the existing vertex array implementation Rendering VBO is almost same as using vertex array The pointer to the vertex array is now an offset into a currently bound buffer object No additional APls are required to draw a VBO except ngindBufferARB Binding the buffer object with O switches off VBO operation It is a good idea to turn VBO off after use so normal vertex array operations with absolute pointers will be reactivated Example Code bind VBOs for vertex array and index array ngindBufferARBGLARRAYBUFFERARB vbold1 for vertex coords ngindBufferARBGLELEMENTARRAYBUFFERARB vbold2 for indices do same as vertex array except pointer glEnableCIientStateGLVERTEXARRAY activate vertex coords array glVertexPointer3 GLFLOAT 0 0 last param is offset not ptr draw 6 quads using offset of index array ngrawEIementsGLQUADS 24 GLUNSIGNEDBYTE 0 glDisableCIientStateGLVERTEXARRAY deactivate vertex array bind with 0 so switch back to normal pointer operation ngindBufferARBGLARRAYBUFFERARB 0 ngindBufferARBGLELEMENTARRAYBUFFERARB 0 Updating VBO Two ways to update Copy new data into the bound VBO with ngufferDataARB or ngufferSubDataARBo 2 copies of vertex data one in your application and the other in VBO Map the buffer object into client39s memory and the client can update data with the pointer to the mapped buffer glMapBufferARB map the buffer object into client39s memory returns pointer to buffer void glMapBufferARBGLenum target GLenum access target is either GLARRAYBUFFERARB or GLELEMENTARRAYBUFFERARB The second parameter access flag specifies what to do with the mapped data read write or both GLREADONLYARB GLWRITEONLYARB GLREADWRITEARB Causes a synchronizing issue If GPU is still working with the buffer object glMapBufferARB will not return until GPU finishes its job with the corresponding buffer object To avoid waiting idle you can call first ngufferDataARB with NULL pointer then call glMapBufferARB Valid only if you want to update entire data set glUnmapBufferARB GLboolean glUnmapBufferARBGLenum target After modifying the data of VBO buffer object must be unmapped from the client39s memory Returns GLTRUE if no problems with update Returns GLFALSE if contents were corrupted while buffer was mapped Transformations Objectives Introduce standard transformations Rotations Translation Scaling Shear Derive homogeneous coordinate transformation matrices Learn to build arbitrary transformation matrices from simple transformations Angel Interactive Computer Graphics 3E AddisonWesley 2002 20 General Transformations A transformation maps points to other points andor vectors to other vectors Angel Interactive Computer Graphics 3E Addiso nWesley 2002 Affine Transformations Line preserving Characteristic of many physically important transformations Rigid body transformations rotation translation Scaling shear Importance in graphics is that we need only transform endpoints of line segments and let implementation draw line segment between the transformed endpoints Angel Interactive Computer Graphics 3E AddisonWesley 2002 22 Pipeline Implementation T from application program i frame p Tp buffer transformation rasterizer gt q MD WI 0 T q q Tp P Tp verticcs vertices pixels Angel Interactive Computer Graphics 3E 23 AddisonWesley 2002 Notation We will be working with both coordinatefree representations of transformations and representations within a particular frame PQ R points in an affine space u v w vectors in an affine space or 3 y scalars p q r representations of points array of 4 scalars in homogeneous coordinates eg 10 23 04 1 u v w representations of vectors array of 4 scalars in homogeneous coordinates eg 28 15 09 0 Angel Interactive Computer Graphics 3E 24 AddisonWesley 2002 Translation Move translate displace a point to a new loca on OP Po Displacement determined by a vector d Three degrees of freedom P Pd Angel Interactive Computer Graphics 3E AddisonWesley 2002 25 How many ways Although we can move a point to a new location in infinite ways when we move many points there is usually only one way object translation every point displaced by same vector Angel Interactive Computer Graphics 3E 26 AddisonWesley 2002 Translation Using Representations Using the homogeneous coordinate representation in some frame p X y z 1T p x y z 1T ddX dy dz OT Hence p p d or 9 X Xdx note that th1s express1on 1s 1n y ydy four dimensions and expresses ZvZd that point vector point z Angel Interactive Computer Graphics 3E 27 AddisonWesley 2002 Translation Matrix We can also express translation using a 4 x 4 matrix T in homogeneous coordinates p Tp where 1 0 0 d 0 1 0 dy TTdxdydzgt 0 0 1 dz 0 0 0 1 This form is better for implementation because all affine transformations can be expressed this way and multiple transformations can be concatenated together Angel Interactive Computer Graphics 3E 28 AddisonWesley 2002 Rotation 20 Consider rotation about the origin by 6 degrees radius stays the same angle increases by 6 xrcos 9 y yrsin 9 x39y39 X Qi cos 9 y sin 9 X y y xsin9ycos9 X r cos I X y r sin I Angel Interactive Computer Graphics 3E 29 AddisonWesley 2002 Rotation about the z axis Rotation about 2 axis in three dimensions leaves all points with the same 2 Equivalent to rotation in two dimensions in planes of constant 2 X X cos 8 y sin 8 y xsin8ycos z z or in homogeneous coordinates p Rz9p Angel Interactive Computer Graphics 3E AddisonWesley 2002 30 Rotation Matrix cos B sin 6 O O R Z Rzm 2 sin 6 cos B O O O 1 O O O O 1 Angel Interactive Computer Graphics 3E AddisonWesley 2002 31 Rotation about X and y axes Same argument as for rotation about 2 axis For rotation aboutx axis x is unchanged For rotation abouty axis y is unchanged 391 0 0 039 0 cos 0 sin 0 0 R Rxw 0 sin 6 cos B 0 0 0 0 1 39 cos 0 0 sin 0 0 R Rye 0 1 O 0 sin 6 0 cos B 0 O O O 1 Angenteractive Computer Graphics 3E 32 AddisonWesley 2002 Scaling Expand or contract along each axis xed point of origin X SXX ya SyX Z SZX p Sp sx 0 0 sy s ssx sy sz 0 0 0 0 Angel Interactive Computer Graphics 3E 33 AddisonWesley 2002 Reflection corresponds to negative scale factors Y 5X 2 1 5y 1 1 original x sX1 sy1 1 szlsy1 5 it Angel Interactive Computer Graphics 3E 34 AddisonWesley 2002 Inverses Although we could compute inverse matrices by general formulas we can use simple geometric observations Translation T391dx dy dz TdX dy dz Rotation R391E RE Holds for any rotation matrix Note that since cosG 0036 and sinG sin6 1146 R To Scaling S391sX s S1sX lsy lsz Y SZ Angel Interactive Computer Graphics 3E AddisonWesley 2002 35


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Allison Fischer University of Alabama

"I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over $600 per month. I LOVE StudySoup!"

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.