Frame Buffer Object - Lecture Overview Frame Buffer Object...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Frame Buffer Object Bed ř ich Beneš, Ph.D. Purdue University Department of Computer Graphics © Bedrich Benes Lecture Overview Arrays Multiple Render Target Frame Buffer Objects Case study: Motion blur using FBO © Bedrich Benes Arrays Arrays on the CPU are in the main memory float a[200][200]; //static float *b; b=new float[1024]; //dynamic etc… © Bedrich Benes Arrays Arrays on the GPU are textures glGenTextures(1,&tId);//texture id glBindTexture(GL_TEXTURE_2D,tId); //binding glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_REPEAT); glTexImage2D(GL_TEXTURE_2D,0,GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE,0);//assigned 0 memory
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© Bedrich Benes Why do we want GPU arrays? Store data over multiple frames to minimize CPU-GPU communication Less data transferred over PCIe Reduce dependency on slow computer RAM. Increasing Speed! © Bedrich Benes Texture Target OpenGL has two different 2D texture targets GL_TEXTURE_2D uses normalized texture coordinates <0,1> GL_TEXTURE_RECTANGLE uses normalized texture coordinates <0,1> AND integer texture coordinates (0,1,…,width-1) © Bedrich Benes GPU arrays concept glGenTextures(1 );//texture id Assigning a “pointer” or “identifier” to a block of GPU memory GL_TEXTURE_2D 1 GL_TEXTURE_RE CTANGLE_ARB 1 GL_TEXTURE_2D 2 GL_TEXTURE_2D 3 GPU Memory © Bedrich Benes GPU arrays concept OpenGL and Cg then use these identifiers to retrieve data from its own memory glBindTexture(GL_TEXTURE_2D, ID) cgGLSetTextureParameter(param , ID) cgGLEnableTextureParameter(param)
Background image of page 2
© Bedrich Benes Reading from GPU arrays Reading from textures/arrays is easy… Uniform sampler2D myTexture; vpEntry( … usual parameters … iTexCoord : TEXCOORD0 ) { float4 texColor=tex2D(myTexture,iTexCoord); } © Bedrich Benes Writing to GPU arrays Writing is more difficult There is no tex2DWrite() function We need to pass output from a shader into a texture somehow… © Bedrich Benes Motivation for the FBOs The “normal” rendering target is the frame buffer (FB) FBO is rendering into something “else” FBO is a container of (multiple) renderable object(s) (MRT) The main usage is a) off-screen rendering b) GPGPU ping-pong © Bedrich Benes FBO rendering Targets Terminology: Render to texture Image of a texture in FBO is the target Off-screen Rendering Image of a renderbuffer in FBO is the target
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© Bedrich Benes FBO The default FB is created by the windowing system FBO is application created (by you) FBO Supports: color, depth, and stencil FBO can use floating point values (!) © Bedrich Benes Motivation FBO Extension Overview OpenGL Frame Buffer Frame Buffer Object 0 Texture m Texture 0 RenderBuffer Object p RenderBuffer Object 0 Frame Buffer Object n Texture m Texture 0 RenderBuffer Object p RenderBuffer Object 0
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/19/2012 for the course CGT 411 taught by Professor Staff during the Spring '08 term at Purdue University-West Lafayette.

Page1 / 15

Frame Buffer Object - Lecture Overview Frame Buffer Object...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online