Page 6 PROCESSOR PROCESSOR FRAGMENT FRAGMENT. texy[1] texx. texy[1] texx. texy[0] texy[0]
|
|
- Vincent Stone
- 6 years ago
- Views:
Transcription
1 This lecture is based on GPGPU::Basic Math Tutorial, Dominik Goeddeke, Winter 2009 CMPE A linear algebra application GPGPU: SAXPY stands for (single-precision) Scalar Alpha X Plus Y. A linear algebra application: saxpy() We want to perform many iterations, as in 15 3 CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas y i+1 = ff x + y i ffl A linear algebra application: saxpy() ffl ffl Floating-point precision on the GPU 15 1 CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas A linear algebra application: saxpy() Where x and y are two vectors. y = ffx + y Page 1 Page 1 Page 2
2 PACK, LINPACK). is part of BLAS, the Basic Linear SAXPY Subprograms. First published in Algebra 1979, are used to build larger packages (LA- file saxpy.f file daxpy.f for y = a*x + y for y = a*x + y for y = a*x + y Reading and writing textures ffl Unlike the CPU, the GPU cannot perform a read-modify-write operation ffl Need two Y textures: an old" one to read from, and a new" one to write ffl For multiple iterations, their role switches every time CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas A linear algebra application: saxpy() BLAS prec single prec double file caxpy.f prec complex file zaxpy.f for y = a*x + y prec doublecomplex 15 4 CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas GPU concept: we cannot use the same texture for reading Important writing at the same time. and that will update vector Y. to. Page 3 Page 2 Page 4
3 Ping-pong technique GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT1_EXT GL_COLOR_ATTACHMENT2_EXT GL_COLOR_ATTACHMENT3_EXT writetex = 0 readtex = 1 GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT1_EXT GL_COLOR_ATTACHMENT2_EXT GL_COLOR_ATTACHMENT3_EXT writetex = 1 readtex = 0 texy[0] texy[1] texx texy[0] texy[1] texx FRAGMENT PROCESSOR α x + y FRAGMENT PROCESSOR α x + y 1. Input parameters, set input variables: texsize, alpha, datax, datay, 5. For iterations times perform the main loop 4. Load and bind the Cg program 7. Read back the values from the GPU 8. Compare the performance and the values Program structure 6. Perform the same computation on the CPU for comparison 2. Setup OpenGL and GPU: initialize GLUT, GLEW, FBO, and CG. 3. Generate three textures: texx, texy[0], and texy[1]. texy[0] and 15 7 CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas datayold, dataynew, and iterations CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas texy[1] will switch the role of new" Y (writetex) and old" Y, (readtex). 9. Clean up Page 5 Page 3 Page 6
4 Structure of the main loop iterations times: For Set the render destination (the write" texture) ffl Set the source destination (the read" texture) ffl Draw a quad to perform the computation ffl Swap the texture read/write roles ffl Input parameters create vector Ynew test data and initialize it (GPU only) input alpha create vector X test data and initialize it printf(" n*** out of memory allocating datax *** n"); NOTE: the amount of data is texsize * texsize * 4 if((datax = (float*)malloc(4*texsize*texsize*sizeof(float))) == NULL) 15 9 CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas input texsize input iterations for(i = 0; i < texsize*texsize*4; i++) create vector Y test data and initialize it (used by CPU only) create vector Yold test data and initialize it like the CPU's (GPU only) 15 8 CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas return(2); datax[i] = (float)i; Page 7 Page 4 Page 8
5 Setup OpenGL and GPU int err; glewinit return value void initglut(int ac, char *av[]) void initglew() glutinit(&ac, av); CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas /* */ initglut and initglew printf((char *)glewgeterrorstring(err)); glutcreatewindow("saxpy on GPU with Ping-Pong (D. Goeddeke, ADB)"); init GLEW, obtain function pointers. NOTE that it doesn't check if all the extensions used are actually available. the functions' entry points will be NULL if unavailable. = glewinit(); err!= GLEW_OK) if(err initglut(ac, av); initglew(); initfbo(); initcg(); CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas exit(3); Page 9 Page 5 Page 10
6 void initfbo() GLint param; glgenframebuffersext(1, &fb); glmatrixmode(gl_projection); generate FBO (offscreen buffer) and bind it fb); glbindframebufferext(gl_framebuffer_ext, set viewport for 1:1 pixel to texel mapping gluortho2d(0.0, (float)texsize, 0.0, (float)texsize); the FBO is incomplete at this time: misses attachment void initcg() fragmentprogram = cgcreateprogramfromfile(mycgcontext, register error callback right away set optimal implicit compiler options cgglsetoptimaloptions(fragmentprofile); CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas assert(fragmentprofile!= CG_PROFILE_UNKNOWN); check that profiles are detected properly fragmentprofile = cgglgetlatestprofile(cg_gl_fragment); reports both compiler and runtime errors cgseterrorcallback(myerrorcallback); create cg context and get profiles = cgcreatecontext(); mycgcontext initfbo glloadidentity(); glmatrixmode(gl_modelview); glloadidentity(); glviewport(0, 0, texsize, texsize); CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas initcg create fragment program CG_SOURCE, cgfragprogfile, fragmentprofile, "saxpygpupp", NULL); Page 11 Page 6 Page 12
7 Generate texture X (1/2) GL_TEXTURE_WRAP_T, GL_CLAMP); gltexparameteri(gl_texture_rectangle_arb, set texenv to replace instead of default modulate A texture environment specifies how texture values are gltexenvi(gl_texture_env, GL_TEXTURE_ENV_MODE, GL_REPLACE); interpreted when a fragment is texture Generate texture X (2/2) glteximage2d(gl_texture_rectangle_arb, gltexsubimage2d(gl_texture_rectangle_arb, CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas GL_RGBA, internal format Note: texture X doesn't need to be attached to an FBO since it's never rendered to. GL_FLOAT, format of data coming from the CPU 0); allocate only, do not initialize glgentextures(1, &texx); glbindtexture(gl_texture_rectangle_arb, texx); turn off filtering and set wrap mode gltexparameteri(gl_texture_rectangle_arb, GL_TEXTURE_MIN_FILTER, GL_NEAREST); gltexparameteri(gl_texture_rectangle_arb, GL_TEXTURE_MAG_FILTER, GL_NEAREST); gltexparameteri(gl_texture_rectangle_arb, GL_TEXTURE_WRAP_S, GL_CLAMP); CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas allocate graphics memory 0, mipmap level GL_RGBA32F_ARB, format texsize, texsize, size 0, no border transfer the data to the texture 0, 0, 0, mipmap level, x and y offset texsize, texsize, size of sub-image GL_RGBA, internal format GL_FLOAT, CPU data format datax); pointer to start of data Page 13 Page 7 Page 14
8 Same for both texy[0] and texy[1], as for texx. Generate the two Y textures (1/2) GL_TEXTURE_WRAP_T, GL_CLAMP); gltexparameteri(gl_texture_rectangle_arb, set texenv to replace instead of default modulate A texture environment specifies how texture values are gltexenvi(gl_texture_env, GL_TEXTURE_ENV_MODE, GL_REPLACE); interpreted when a fragment is textured Generate the two Y textures (2/2) CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas Same for both texy[0] and texy[1], as for texx. gltexsubimage2d(gl_texture_rectangle_arb, GL_RGBA, internal format GL_FLOAT, format of data coming from the CPU allocate graphics memory and transfer the data to the texture 0); allocate only, do not initialize dataynew); pointer to start of data <-- NOTE generate the two Y textures glgentextures(2, texy); bind the texture glbindtexture(gl_texture_rectangle_arb, texy[0]); turn off filtering and set wrap mode gltexparameteri(gl_texture_rectangle_arb, GL_TEXTURE_MIN_FILTER, GL_NEAREST); gltexparameteri(gl_texture_rectangle_arb, GL_TEXTURE_MAG_FILTER, GL_NEAREST); gltexparameteri(gl_texture_rectangle_arb, GL_TEXTURE_WRAP_S, GL_CLAMP); CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas glteximage2d(gl_texture_rectangle_arb, 0, mipmap level GL_RGBA32F_ARB, format texsize, texsize, size 0, no border 0, 0, 0, mipmap level, x and y offset texsize, texsize, size of sub-image GL_RGBA, internal format GL_FLOAT, CPU data format Page 15 Page 8 Page 16
9 Attach the two Y textures to the FBO glframebuffertexture2dext(gl_framebuffer_ext, glframebuffertexture2dext(gl_framebuffer_ext, printf(" nmain: Checking framebuffer status... "); attach both textures to different color attachments of the same FBO Loading and binding the Cg program CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas attachmentpoints[writetex], GL_TEXTURE_RECTANGLE_ARB, texy[writetex], texture 0); mipmap level attachmentpoints[readtex], GL_TEXTURE_RECTANGLE_ARB, texy[readtex], texture 0); mipmap level checkframebufferstatus(); CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas loadcgfragprog(); Page 17 Page 9 Page 18
10 void loadcgfragprog(void) Loading and binding the Cg program load and bind program if(fragmentprogram!= NULL) enable texture X (read-only) cgglloadprogram(fragmentprogram); enable scalar alpha cgglenabletextureparameter(xparam); cgsetparameter1f(alphaparam, alpha); yparam = cggetnamedparameter(fragmentprogram, "texturey"); xparam = cggetnamedparameter(fragmentprogram, "texturex"); alphaparam = cggetnamedparameter(fragmentprogram, "alpha"); cgglsettextureparameter(xparam, texx); float4 saxpygpupp( CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas cggetnamedparameter(fragmentprogram, "texturey"); cgglsettextureparameter(xparam, texx); cgsetparameter1f(alphaparam, alpha); If texture: cgglenabletextureparameter(xparam); cgglenableprofile(fragmentprofile); cgglbindprogram(fragmentprogram); get parameter handles by name CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas uniform parameters Cg program: Cg float2 coords: TEXCOORD0, uniform samplerrect texturey, uniform samplerrect texturex, uniform float alpha): COLOR [...] If scalar: C program: CGparameter alphaparam; CGparameter xparam; CGparameter yparam; float alpha; GLuint texx; GLuint texy[2]; Page 19 Page 10 Page 20
11 int i; The fragment shader float4 saxpygpupp( uniform samplerrect texturey, uniform samplerrect texturex, uniform float alpha): COLOR result = y + alpha * x; float4 y = texrect(texturey, coords); float4 x = texrect(texturex, coords); Using non-power-of-2 textures requires using samplerrect for the sampler and texrect for the lookup function. Advanced texture lookup CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas float4 result; return(result); float2 coords: TEXCOORD0, CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas Page 21 Page 11 Page 22
12 Main loop computation on the GPU for(i = 0; i < iterations; ++i) set render destination gltexcoord2f(0.0, (float)texsize); glvertex2f(0.0, (float)texsize); gltexcoord2f((float)texsize, 0.0); glvertex2f((float)texsize, 0.0); mode that can be GL POINT, GL LINE, or GL FILL (default) Example: set glpolygonmode(gl BACK, GL LINE) in rotsquare.c The glpolygonmode() function selects the polygon rasterization mode. The two parameters are: face that can be GL FRONT, GL BACK, or GL FRONT AND BACK (default) CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas gldrawbuffer(attachmentpoints[writetex]); set source Y cgglsettextureparameter(yparam, texy[readtex]); cgglenabletextureparameter(yparam); glpolygonmode(gl_front, GL_FILL); glbegin(gl_quads); gltexcoord2f(0.0, 0.0); glvertex2f(0.0, 0.0); gltexcoord2f((float)texsize, (float)texsize); glend(); swaptex(); glvertex2f((float)texsize, (float)texsize); CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas Polygon mode Page 23 Page 12 Page 24
13 Swapping texture roles void swaptex() = clock(); clkstart = 0; i < iterations; ++i) for(i clkend = clock(); Performing the same computation on the CPU cputime += ((double)clkend - (double)clkstart)/(double)clocks_per_sec; CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas if(readtex == 0) else readtex = 1; writetex = 0; readtex = 0; writetex = 1; CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas for(j = 0; j < texsize*texsize*4; ++j) datay[j] = alpha * datax[j] + datay[j]; Page 25 Page 13 Page 26
14 glreadbuffer(attachmentpoints[readtex]); Read back from the GPU Note: pixels are read back by rows, bottom to top and left to right: y 0,0 glreadpixels(0, 0, windows corrds of LL pixel to start reading fro texsize, texsize, width and height of pixel rectangle to read bac GL_RGBA, format of pixel data GL_FLOAT, type of pixel data dataynew); pointer to memory destination... row 1 row 0 x Compare the performance for (i = 0; i < (texsize*texsize*4); ++i) printf(" n n "); CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas printf(" n max error = %13.6lf", maxerror); avgerror /= (double)(texsize*texsize*4); printf(" n avg error = %13.6lf", avgerror); printf(" n n"); double diff, sum; sum = (datay[i] + dataynew[i])/2.0; diff = fabs(datay[i]-dataynew[i]); CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas if(diff > maxerror) maxerror = diff; avgerror += diff; [...] Page 27 Page 14 Page 28
15 15 31 CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas Output CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas Clean up free(datax); free(datayold); free(dataynew); gldeleteframebuffersext(1,&fb); gldeletetextures(1,&texx); gldeletetextures(2,texy); cgdestroycontext(mycgcontext); Page 29 Page 15 Page 30
16 Floating-point precision on the GPU Floating-point precision on the GPU 1. Rounding 2. Denormals 3. NaNs CMPE220 Advanced Parallel Processing, Winter 2009 Andrea Di Blas Page 31 Page 16
Graphics. Texture Mapping 고려대학교컴퓨터그래픽스연구실.
Graphics Texture Mapping 고려대학교컴퓨터그래픽스연구실 3D Rendering Pipeline 3D Primitives 3D Modeling Coordinates Model Transformation 3D World Coordinates Lighting 3D World Coordinates Viewing Transformation 3D Viewing
More informationLecture 19: OpenGL Texture Mapping. CITS3003 Graphics & Animation
Lecture 19: OpenGL Texture Mapping CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL texture functions and options
More informationLecture 22 Sections 8.8, 8.9, Wed, Oct 28, 2009
s The s Lecture 22 Sections 8.8, 8.9, 8.10 Hampden-Sydney College Wed, Oct 28, 2009 Outline s The 1 2 3 4 5 The 6 7 8 Outline s The 1 2 3 4 5 The 6 7 8 Creating Images s The To create a texture image internally,
More informationCS 432 Interactive Computer Graphics
CS 432 Interactive Computer Graphics Lecture 7 Part 2 Texture Mapping in OpenGL Matt Burlick - Drexel University - CS 432 1 Topics Texture Mapping in OpenGL Matt Burlick - Drexel University - CS 432 2
More informationTextures. Texture Mapping. Bitmap Textures. Basic Texture Techniques
Texture Mapping Textures The realism of an image is greatly enhanced by adding surface textures to the various faces of a mesh object. In part a) images have been pasted onto each face of a box. Part b)
More informationLecture 07: Buffers and Textures
Lecture 07: Buffers and Textures CSE 40166 Computer Graphics Peter Bui University of Notre Dame, IN, USA October 26, 2010 OpenGL Pipeline Today s Focus Pixel Buffers: read and write image data to and from
More informationTexture Mapping. Mike Bailey.
Texture Mapping 1 Mike Bailey mjb@cs.oregonstate.edu This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International License TextureMapping.pptx The Basic Idea
More informationarxiv:hep-lat/ v1 21 Nov 2006
Lattice QCD as a video game Győző I. Egri a, Zoltán Fodor abc, Christian Hoelbling b, Sándor D. Katz ab, Dániel Nógrádi b and Kálmán K. Szabó b arxiv:hep-lat/0611022 v1 21 Nov 2006 a Institute for Theoretical
More informationInformation Coding / Computer Graphics, ISY, LiTH GLSL. OpenGL Shading Language. Language with syntax similar to C
GLSL OpenGL Shading Language Language with syntax similar to C Syntax somewhere between C och C++ No classes. Straight ans simple code. Remarkably understandable and obvious! Avoids most of the bad things
More informationBuffers. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015
Buffers 1 Objectives Introduce additional WebGL buffers Reading and writing buffers Buffers and Images 2 Buffer Define a buffer by its spatial resolution (n x m) and its depth (or precision) k, the number
More informationCISC 3620 Lecture 7 Lighting and shading. Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping
CISC 3620 Lecture 7 Lighting and shading Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping Exam results Grade distribution 12 Min: 26 10 Mean: 74 8 Median:
More informationGeneral Purpose computation on GPUs. Liangjun Zhang 2/23/2005
General Purpose computation on GPUs Liangjun Zhang 2/23/2005 Outline Interpretation of GPGPU GPU Programmable interfaces GPU programming sample: Hello, GPGPU More complex programming GPU essentials, opportunity
More informationThe Problem: Difficult To Use. Motivation: The Potential of GPGPU CGC & FXC. GPGPU Languages
Course Introduction GeneralGeneral-Purpose Computation on Graphics Hardware Motivation: Computational Power The GPU on commodity video cards has evolved into an extremely flexible and powerful processor
More informationVGP352 Week March-2008
VGP352 Week 10 Agenda: Texture rectangles Post-processing effects Filter kernels Simple blur Edge detection Separable filter kernels Gaussian blur Depth-of-field Texture Rectangle Cousin to 2D textures
More informationCS452/552; EE465/505. Image Processing Frame Buffer Objects
CS452/552; EE465/505 Image Processing Frame Buffer Objects 3-12 15 Outline! Image Processing: Examples! Render to Texture Read: Angel, Chapter 7, 7.10-7.13 Lab3 new due date: Friday, Mar. 13 th Project#1
More informationTexture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science
Texture Mapping CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce Mapping Methods - Texture Mapping - Environment Mapping - Bump Mapping Consider
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 informationGrafica Computazionale
Grafica Computazionale lezione36 Informatica e Automazione, "Roma Tre" June 3, 2010 Grafica Computazionale: Lezione 33 Textures Introduction Steps in Texture Mapping A Sample Program Texturing algorithms
More informationLighting and Texturing
Lighting and Texturing Michael Tao Michael Tao Lighting and Texturing 1 / 1 Fixed Function OpenGL Lighting Need to enable lighting Need to configure lights Need to configure triangle material properties
More informationOpenCL / OpenGL Texture Interoperability: An Image Blurring Case Study
1 OpenCL / OpenGL Texture Interoperability: An Image Blurring Case Study Mike Bailey mjb@cs.oregonstate.edu opencl.opengl.rendertexture.pptx OpenCL / OpenGL Texture Interoperability: The Basic Idea 2 Application
More informationCS179: GPU Programming
CS179: GPU Programming Lecture 4: Textures Original Slides by Luke Durant, Russel McClellan, Tamas Szalay Today Recap Textures What are textures? Traditional uses Alternative uses Recap Our data so far:
More informationOpenGL & Visualization
OpenGL & Visualization Martin Ilčík Institute of Computer Graphics and Algorithms Vienna University of Technology Motivation What is OpenGL How to use OpenGL Slices with OpenGL GPU raycasting Martin Ilčík
More informationGRAFIKA KOMPUTER. ~ M. Ali Fauzi
GRAFIKA KOMPUTER ~ M. Ali Fauzi Texture Mapping WHY TEXTURE? Imagine a Chess Floor Or a Brick Wall How to Draw? If you want to draw a chess floor, each tile must be drawn as a separate quad. A large flat
More informationDiscussion 3. PPM loading Texture rendering in OpenGL
Discussion 3 PPM loading Texture rendering in OpenGL PPM Loading - Portable PixMap format 1. 2. Code for loadppm(): http://ivl.calit2.net/wiki/images/0/09/loadppm.txt ppm file format: Header: 1. P6: byte
More informationMotivation Hardware Overview Programming model. GPU computing. Part 1: General introduction. Ch. Hoelbling. Wuppertal University
Part 1: General introduction Ch. Hoelbling Wuppertal University Lattice Practices 2011 Outline 1 Motivation 2 Hardware Overview History Present Capabilities 3 Programming model Past: OpenGL Present: CUDA
More informationAssignment #5: Scalar Field Visualization 3D: Direct Volume Rendering
Assignment #5: Scalar Field Visualization 3D: Direct Volume Rendering Goals: Due October 4 th, before midnight This is the continuation of Assignment 4. The goal is to implement a simple DVR -- 2D texture-based
More informationCS335 Graphics and Multimedia. Slides adopted from OpenGL Tutorial
CS335 Graphics and Multimedia Slides adopted from OpenGL Tutorial Texture Poly. Per Vertex Mapping CPU DL Texture Raster Frag FB Pixel Apply a 1D, 2D, or 3D image to geometric primitives Uses of Texturing
More informationCS452/552; EE465/505. Texture Mapping in WebGL
CS452/552; EE465/505 Texture Mapping in WebGL 2-26 15 Outline! Texture Mapping in WebGL Read: Angel, Chapter 7, 7.3-7.5 LearningWebGL lesson 5: http://learningwebgl.com/blog/?p=507 Lab3 due: Monday, 3/2
More informationTexture Mapping. Texture Mapping. Map textures to surfaces. Trompe L Oeil ( Deceive the Eye ) The texture. Texture map
CSCI 42 Computer Graphic Lecture 2 Texture Mapping A way of adding urface detail Texture Mapping Jernej Barbic Univerity of Southern California Texture Mapping + Shading Filtering and Mipmap Non-color
More informationOpenGL refresher. Advanced Computer Graphics 2012
Advanced Computer Graphics 2012 What you will see today Outline General OpenGL introduction Setting up: GLUT and GLEW Elementary rendering Transformations in OpenGL Texture mapping Programmable shading
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 Texture Mapping 2 Texture Poly. Per Vertex Mapping CPU DL Pixel Texture Raster Frag FB Apply a 1D, 2D,
More informationCS212. OpenGL Texture Mapping and Related
CS212 OpenGL Texture Mapping and Related Basic Strategy Three steps to applying a texture 1. specify the texture read or generate image assign to texture enable texturing 2. assign texture coordinates
More informationINF Utilizing Ubiquitous Commodity Graphics Hardware for Scientific Computing. Bjørn-Hugo Nilsen. October 2007
INF-3981 DIPLOMA THESIS IN COMPUTER SCIENCE Utilizing Ubiquitous Commodity Graphics Hardware for Scientific Computing Bjørn-Hugo Nilsen October 2007 FACULTY OF SCIENCE Department of Computer Science University
More informationThe GPGPU Programming Model
The Programming Model Institute for Data Analysis and Visualization University of California, Davis Overview Data-parallel programming basics The GPU as a data-parallel computer Hello World Example Programming
More informationCT5510: Computer Graphics. Texture Mapping
CT5510: Computer Graphics Texture Mapping BOCHANG MOON Texture Mapping Simulate spatially varying surface properties Phong illumination model is coupled with a material (e.g., color) Add small polygons
More information三維繪圖程式設計 3D Graphics Programming Design 第七章基礎材質張貼技術嘉大資工系盧天麒
三維繪圖程式設計 3D Graphics Programming Design 第七章基礎材質張貼技術嘉大資工系盧天麒 1 In this chapter, you will learn The basics of texture mapping Texture coordinates Texture objects and texture binding Texture specification
More informationCS4621/5621 Fall Basics of OpenGL/GLSL Textures Basics
CS4621/5621 Fall 2015 Basics of OpenGL/GLSL Textures Basics Professor: Kavita Bala Instructor: Nicolas Savva with slides from Balazs Kovacs, Eston Schweickart, Daniel Schroeder, Jiang Huang and Pramook
More informationCSE 167: Introduction to Computer Graphics Lecture #7: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018
CSE 167: Introduction to Computer Graphics Lecture #7: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018 Announcements Project 2 due this Friday at 2pm Grading in
More informationCS475/CS675 - Computer Graphics. OpenGL Drawing
CS475/CS675 - Computer Graphics OpenGL Drawing What is OpenGL? Open Graphics Library API to specify geometric objects in 2D/3D and to control how they are rendered into the framebuffer. A software interface
More informationCMSC 425: Lecture 12 Texture Mapping Thursday, Mar 14, 2013
CMSC 425: Lecture 12 Texture Mapping Thursday, Mar 14, 2013 Surface Detail: We have discussed the use of lighting as a method of producing more realistic images. This is fine for smooth surfaces of uniform
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 informationก ก ก.
418382 ก ก ก ก 5 pramook@gmail.com TEXTURE MAPPING Textures Texture Object An OpenGL data type that keeps textures resident in memory and provides identifiers
More informationX. GPU Programming. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter X 1
X. GPU Programming 320491: Advanced Graphics - Chapter X 1 X.1 GPU Architecture 320491: Advanced Graphics - Chapter X 2 GPU Graphics Processing Unit Parallelized SIMD Architecture 112 processing cores
More informationIntroduction. - C-like language for programming vertex and fragment shaders
Introduction to Cg Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico Introduction Cg = C for graphics
More informationFramebuffer Objects. Emil Persson ATI Technologies, Inc.
Framebuffer Objects Emil Persson ATI Technologies, Inc. epersson@ati.com Introduction Render-to-texture is one of the most important techniques in real-time rendering. In OpenGL this was traditionally
More informationIntroduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL Ed Angel The Mandelbrot Set Fractals Fractal (fractional geometry) objects generate some of the most complex and beautiful graphics - The mathematics describing
More informationPoint-Based rendering on GPU hardware. Advanced Computer Graphics 2008
Point-Based rendering on GPU hardware Advanced Computer Graphics 2008 Outline Why use the GPU? Splat rasterization Image-aligned squares Perspective correct rasterization Splat shading Flat shading Gouroud
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 informationDrawing and Coordinate Systems
Drawing and Coordinate Systems Coordinate Systems Screen Coordinate system World Coordinate system World window Viewport Window to viewport mapping Screen Coordinate System Glut OpenGL (0,0) Screen Coordinate
More informationFAKULTI TEKNOLOGI MAKLUMAT DAN KOMUNIKASI BITM INTERACTIVE COMPUTER GRAPHICS LAB SESSION 4. C++ - OpenGL
FAKULTI TEKNOLOGI MAKLUMAT DAN KOMUNIKASI BITM 3213 - INTERACTIVE COMPUTER GRAPHICS LAB SESSION 4 C++ - OpenGL Part 1- C++ - Texture Mapping 1. Download texture file and put it into your current folder
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 informationCG Programming: 3D Texturing
CG Programming: 3D Texturing 3D texturing is used as image based rendering Applications 3D texture mapping for complicate geometric objects It generates highly natural visual effects in which objects appear
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 informationTexture Mapping CSCI 4229/5229 Computer Graphics Fall 2016
Texture Mapping CSCI 4229/5229 Computer Graphics Fall 2016 What are texture maps? Bitmap images used to assign fine texture to displayed surfaces Used to make surfaces appear more realistic Must move with
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 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 informationIntroduction to OpenGL
Introduction to OpenGL Banafsheh Azari http://www.uni-weimar.de/cms/medien/cg.html What You ll See Today What is OpenGL? Related Libraries OpenGL Command Syntax B. Azari http://www.uni-weimar.de/cms/medien/cg.html
More informationCSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017
CSE 167: Introduction to Computer Graphics Lecture #8: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017 Announcements Project 2 is due this Friday at 2pm Next Tuesday
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 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 informationTexture Mapping and Sampling
Texture Mapping and Sampling CPSC 314 Wolfgang Heidrich The Rendering Pipeline Geometry Processing Geometry Database Model/View Transform. Lighting Perspective Transform. Clipping Scan Conversion Depth
More informationSHADER PROGRAMMING. Based on Jian Huang s lecture on Shader Programming
SHADER PROGRAMMING Based on Jian Huang s lecture on Shader Programming What OpenGL 15 years ago could do http://www.neilturner.me.uk/shots/opengl-big.jpg What OpenGL can do now What s Changed? 15 years
More informationlast time put back pipeline figure today will be very codey OpenGL API library of routines to control graphics calls to compile and load shaders
last time put back pipeline figure today will be very codey OpenGL API library of routines to control graphics calls to compile and load shaders calls to load vertex data to vertex buffers calls to load
More informationCSE 167: Lecture #17: Volume Rendering. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012
CSE 167: Introduction to Computer Graphics Lecture #17: Volume Rendering Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Thursday, Dec 13: Final project presentations
More informationMost device that are used to produce images are. dots (pixels) to display the image. This includes CRT monitors, LCDs, laser and dot-matrix
Scan Conversion of Lines Raster devices Most device that are used to produce images are raster devices, that is, use rectangular arrays of dots (pixels) to display the image. This includes CRT monitors,
More information+ = Texturing: Glue n-dimensional images onto geometrical objects. Texturing. Texture magnification. Texture coordinates. Bilinear interpolation
Texturing Slides done bytomas Akenine-Möller and Ulf Assarsson Chalmers University of Technology Texturing: Glue n-dimensional images onto geometrical objects Purpose: more realism, and this is a cheap
More informationAPI Background. Prof. George Wolberg Dept. of Computer Science City College of New York
API Background Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Graphics API history OpenGL API OpenGL function format Immediate Mode vs Retained Mode Examples The Programmer
More informationCSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016
CSE 167: Introduction to Computer Graphics Lecture #8: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 Announcements Project 2 due this Friday Midterm next Tuesday
More informationCS 432 Interactive Computer Graphics
CS 432 Interactive Computer Graphics Lecture 2 Part 1 Primitives and Buffers Matt Burlick - Drexel University - CS 432 1 Rendering in OpenGL Ok, so now we want to actually draw stuff! OpenGL (like most
More informationCS 179 GPU Programming
CS179: GPU Programming Lecture 7: Render to Texture Lecture originally by Luke Durant, Russell McClellan, Tamas Szalay 1 Today: Render to Texture Render to texture in OpenGL Framebuffers and renderbuffers
More informationFog example. Fog is atmospheric effect. Better realism, helps determine distances
Fog example Fog is atmospheric effect Better realism, helps determine distances Fog Fog was part of OpenGL fixed function pipeline Programming fixed function fog Parameters: Choose fog color, fog model
More informationAssignment #3: Scalar Field Visualization 3D: Cutting Plane, Wireframe Iso-surfacing, and Direct Volume Rendering
Assignment #3: Scalar Field Visualization 3D: Cutting Plane, Wireframe Iso-surfacing, and Direct Volume Rendering Goals: Due October 9 th, before midnight With the results from your assignement#2, the
More informationMULTI-PASS VS SINGLE-PASS CUBEMAP
Sogang University Computer Graphics Lab. MULTI-PASS VS SINGLE-PASS CUBEMAP 2008.4 1 Contents Purpose Multi-Pass Cubemap Single-Pass Cubemap Reflection Mapping Test Result Conclusion 2 Purpose Implement
More informationOpenGL Texture Mapping. Objectives Introduce the OpenGL texture functions and options
OpenGL Texture Mapping Objectives Introduce the OpenGL texture functions and options 1 Basic Strategy Three steps to applying a texture 1. 2. 3. specify the texture read or generate image assign to texture
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 informationGPGPU: Parallel Reduction and Scan
Administrivia GPGPU: Parallel Reduction and Patrick Cozzi University of Pennsylvania CIS 565 - Spring 2011 Assignment 3 due Wednesday 11:59pm on Blackboard Assignment 4 handed out Monday, 02/14 Final Wednesday
More informationLSU EE Homework 3 Solution Due: 12 October 2015
LSU EE 4702 1 Homework 3 Solution Due: 12 October 2015 Problem 0: Follow the instruction on the http://www.ece.lsu.edu/koppel/gpup/proc.html page for account setup and programming homework work flow. Compile
More informationObjectives. Texture Mapping and NURBS Week 7. The Limits of Geometric Modeling. Modeling an Orange. Three Types of Mapping. Modeling an Orange (2)
CS 480/680 INTERACTIVE COMPUTER GRAPHICS Texture Mapping and NURBS Week 7 David Breen Department of Computer Science Drexel University Objectives Introduce Mapping Methods Texture Mapping Environmental
More informationOUTLINE. Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction
TEXTURE MAPPING 1 OUTLINE Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction 2 BASIC STRAGEGY Three steps to applying a texture 1. specify the texture
More information-=Catmull's Texturing=1974. Part I of Texturing
-=Catmull's Texturing=1974 but with shaders Part I of Texturing Anton Gerdelan Textures Edwin Catmull's PhD thesis Computer display of curved surfaces, 1974 U.Utah Also invented the z-buffer / depth buffer
More informationDrawing and Coordinate Systems
Drawing and Coordinate Systems Coordinate Systems World Coordinate system World window Screen Coordinate system Viewport Window to viewport mapping Screen Coordinate System Glut OpenGL (0,0) 0) Screen
More informationComputer Graphics Course 2005
Computer Graphics Course 2005 Introduction to GLUT, GLU and OpenGL Administrative Stuff Teaching Assistant: Rony Goldenthal Reception Hour: Wed. 18:00 19:00 Room 31 (Ross 1) Questions: E-mail: cg@cs Newsgroups:
More informationComputational Strategies
Computational Strategies How can the basic ingredients be combined: Image Order Ray casting (many options) Object Order (in world coordinate) splatting, texture mapping Combination (neither) Shear warp,
More informationINTRODUCTION TO OPENGL PIPELINE
CS580: Computer Graphics Min H. Kim KAIST School of Computing Foundations of Computer Graphics INTRODUCTION TO OPENGL PIPELINE 2 1 What is OpenGL? OpenGL = Open Graphics Library An open industry-standard
More informationGPU Memory Model. Adapted from:
GPU Memory Model Adapted from: Aaron Lefohn University of California, Davis With updates from slides by Suresh Venkatasubramanian, University of Pennsylvania Updates performed by Gary J. Katz, University
More informationOpenGL Performances and Flexibility
OpenGL Performances and Flexibility Marco Di Benedetto Visual Computing Laboratory ISTI CNR, Italy OpenGL Roadmap 1.0 - Jan 1992 - First Version 1.1 - Jan 1997 - Vertex Arrays, Texture Objects 1.2 - Mar
More informationLecture 3. Understanding of OPenGL programming
Lecture 3 Understanding of OPenGL programming What is OpenGL GL: stands for Graphic Library Software interface for rendering purposes for 2D or 3D geometric data objects. Various Pieces gl: The basic libraries.
More informationSUMMARY. CS380: Introduction to Computer Graphics Texture Mapping Chapter 15. Min H. Kim KAIST School of Computing 18/05/03.
CS380: Introduction to Computer Graphics Texture Mapping Chapter 15 Min H. Kim KAIST School of Computing Materials SUMMARY 2 1 Light blob from PVC plastic Recall: Given any vector w (not necessarily of
More informationCg 2.0. Mark Kilgard
Cg 2.0 Mark Kilgard What is Cg? Cg is a GPU shading language C/C++ like language Write vertex-, geometry-, and fragmentprocessing kernels that execute on massively parallel GPUs Productivity through a
More informationCS 4204 Computer Graphics
CS 4204 Computer Graphics GLUT (Continue) More Interactions Yong Cao Virginia Tech References: Interactive Computer Graphics, Fourth Edition, Ed Angle Orthographical Projection Synthetic camera model View
More informationTexture Mapping. Computer Graphics, 2015 Lecture 9. Johan Nysjö Centre for Image analysis Uppsala University
Texture Mapping Computer Graphics, 2015 Lecture 9 Johan Nysjö Centre for Image analysis Uppsala University What we have rendered so far: Looks OK, but how do we add more details (and colors)? Texture mapping
More informationImaging and Raster Primitives
Realtime 3D Computer Graphics & Virtual Reality Bitmaps and Textures Imaging and Raster Primitives Vicki Shreiner Imaging and Raster Primitives Describe OpenGL s raster primitives: bitmaps and image rectangles
More informationCS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J.
CS 380 Introduction to Computer Graphics LAB (1) : OpenGL Tutorial 2018. 03. 05 Reference : Foundations of 3D Computer Graphics, Steven J. Gortler Goals Understand OpenGL pipeline Practice basic OpenGL
More informationGraphics Hardware. Instructor Stephen J. Guy
Instructor Stephen J. Guy Overview What is a GPU Evolution of GPU GPU Design Modern Features Programmability! Programming Examples Overview What is a GPU Evolution of GPU GPU Design Modern Features Programmability!
More informationCS193P - Lecture 19. iphone Application Development. OpenGL ES
CS193P - Lecture 19 iphone Application Development OpenGL ES 1 Announcements Final projects due in 7 days Tuesday, March 16th 11:59 pm Submit: Code Power-point/Keynote slides ReadMe file Final project
More informationImage Processing Tricks in OpenGL. Simon Green NVIDIA Corporation
Image Processing Tricks in OpenGL Simon Green NVIDIA Corporation Overview Image Processing in Games Histograms Recursive filters JPEG Discrete Cosine Transform Image Processing in Games Image processing
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 informationQUESTION 1 [10] 2 COS340-A October/November 2009
2 COS340-A QUESTION 1 [10] a) OpenGL uses z-buffering for hidden surface removal. Explain how the z-buffer algorithm works and give one advantage of using this method. (5) Answer: OpenGL uses a hidden-surface
More informationMethodology for Lecture
Basic Geometry Setup Methodology for Lecture Make mytest1 more ambitious Sequence of steps Demo Review of Last Demo Changed floor to all white, added global for teapot and teapotloc, moved geometry to
More informationTexturing. Slides done bytomas Akenine-Möller and Ulf Assarsson Department of Computer Engineering Chalmers University of Technology
Texturing Slides done bytomas Akenine-Möller and Ulf Assarsson Department of Computer Engineering Chalmers University of Technology 1 Texturing: Glue n-dimensional images onto geometrical objects l Purpose:
More information