Download - OpenGL 3.0 Texture Arrays

Transcript
Page 1: OpenGL 3.0 Texture Arrays

OpenGL 3.0OpenGL 3.0Texture ArraysTexture Arrays

Presentation: Olivia Terrell, Dec. 4, 2008Presentation: Olivia Terrell, Dec. 4, 2008

Page 2: OpenGL 3.0 Texture Arrays

OpenGL 3.0OpenGL 3.0

History of History of OpenGL 3.0OpenGL 3.0

How OpenGL 3.0 How OpenGL 3.0 DiffersDiffers

OpenGL 3.0 OpenGL 3.0 Texture arraysTexture arrays

Page 3: OpenGL 3.0 Texture Arrays

History of OpenGL 3.0History of OpenGL 3.0““When one door closes another door When one door closes another door

opens; but we so often look so long and opens; but we so often look so long and so regretfully upon the closed door, that so regretfully upon the closed door, that we do not see the ones which open for we do not see the ones which open for

us.”,us.”,

Alexander Graham BellAlexander Graham Bell

Page 4: OpenGL 3.0 Texture Arrays

Evolved from IrisGL (Integrated Evolved from IrisGL (Integrated Raster Imaging Systems Graphic Raster Imaging Systems Graphic

Library)Library)

IrisGL was specific to IRIX Silicon IrisGL was specific to IRIX Silicon stations stations

OpenGL created by Mark Segal and OpenGL created by Mark Segal and Kurt AkeleyKurt Akeley

Page 5: OpenGL 3.0 Texture Arrays

• First releaseFirst release

• OpenGL1.0 OpenGL1.0

lacked texture lacked texture objects, thus objects, thus glBindTexture glBindTexture was added to was added to OpenGL1.1. OpenGL1.1.

• Release Release versions:versions:

OpenGL1.2OpenGL1.2 OpenGL1.2.1OpenGL1.2.1 OpenGL1.3OpenGL1.3 OpenGL1.4OpenGL1.4 OpenGL1.5OpenGL1.5 OpenGL2.0OpenGL2.0 OpenGL2.1OpenGL2.1 OpenGL3.0OpenGL3.0

Page 6: OpenGL 3.0 Texture Arrays

Block Diagram of OpenGLBlock Diagram of OpenGL

Page 7: OpenGL 3.0 Texture Arrays
Page 8: OpenGL 3.0 Texture Arrays

How OpenGL 3.0 How OpenGL 3.0 DiffersDiffers

““He who rejects change is the architect He who rejects change is the architect of decay...”of decay...”

Harold WilsonHarold Wilson

Page 9: OpenGL 3.0 Texture Arrays

OpenGL 3.0 featuresOpenGL 3.0 features

• Vertex array objectsVertex array objects

• Direct access to Direct access to vertex buffer vertex buffer objectsobjects

• Framebuffer object Framebuffer object variability for buffer variability for buffer size and format size and format during renderingduring rendering

• 32-bit floating 32-bit floating point texture and point texture and render buffersrender buffers

• Occlusion Occlusion renderingrendering

• Half-float vertex Half-float vertex & pixel data & pixel data

Page 10: OpenGL 3.0 Texture Arrays

OpenGL 3.0 featuresOpenGL 3.0 features

• Transform feedback Transform feedback to capture to capture geometry data into geometry data into a buffer for further a buffer for further computationcomputation

• 4 new texture 4 new texture compressions for 1 compressions for 1 and 2 channel and 2 channel texturetexture

• Rendering in Rendering in sRGB sRGB framebuffersframebuffers

• 32-bit floating 32-bit floating point depth point depth buffer supportbuffer support

• Texture arrays.Texture arrays.....

Page 11: OpenGL 3.0 Texture Arrays

OpenGL 3.0 featuresOpenGL 3.0 features• API support for the new texture API support for the new texture

lookup capabilities of the OpenGL lookup capabilities of the OpenGL Shading Language 1.30 Shading Language 1.30 specification (GL EXT gpu specification (GL EXT gpu shader4).shader4).

• Conditional rendering (GL NV Conditional rendering (GL NV conditional render).conditional render).

• Fine control over mapping buffer Fine control over mapping buffer subranges into client space and subranges into client space and flushingflushing

• modified data.modified data.• Floating-point color and depth Floating-point color and depth

internal formats for textures and internal formats for textures and renderbuffers (GL ARB color renderbuffers (GL ARB color buffer float, GL NV depth buffer buffer float, GL NV depth buffer float, 455 GL ARB texture float, float, 455 GL ARB texture float, GL EXT packed float, and GL EXT GL EXT packed float, and GL EXT texture shared exponent).texture shared exponent).

• Framebuffer objects (GL EXT Framebuffer objects (GL EXT framebuffer object).framebuffer object).

• Half-float (16-bit) vertex array Half-float (16-bit) vertex array and pixel data formats (GL NV and pixel data formats (GL NV half float and GL ARB half float half float and GL ARB half float pixel).pixel).

• Multisample stretch blit Multisample stretch blit functionality (GL EXT functionality (GL EXT framebuffer multisample and framebuffer multisample and GL EXT framebuffer blit).GL EXT framebuffer blit).

• Non-normalized integer color Non-normalized integer color internal formats for textures internal formats for textures and renderbuffers (GL EXT and renderbuffers (GL EXT texture integer).texture integer).

Page 12: OpenGL 3.0 Texture Arrays

OpenGL 3.0 featuresOpenGL 3.0 features• One- and two-dimensional layered One- and two-dimensional layered

texture targetstexture targets (GL EXT texture array).(GL EXT texture array).• Packed depth/stencil internal formats Packed depth/stencil internal formats

for combined depth+stencil textures for combined depth+stencil textures and renderbuffers (GL EXT packed depth and renderbuffers (GL EXT packed depth stencil).stencil).

• Per-color-attachment blend enables and Per-color-attachment blend enables and color writemasks (GL EXT draw color writemasks (GL EXT draw buffers2).buffers2).

• RGTC specific internal compressed RGTC specific internal compressed formats (GL EXT texture compression formats (GL EXT texture compression rgtc).rgtc).

• Single- and double-channel (R and RG) Single- and double-channel (R and RG) internal formats for textures and internal formats for textures and renderbuffers.renderbuffers.

• Transform feedback (GL EXT transform Transform feedback (GL EXT transform feedback).feedback).

• Vertex array objects (GL APPLE vertex Vertex array objects (GL APPLE vertex array object).array object).

• sRGB framebuffer mode (GL EXT sRGB framebuffer mode (GL EXT framebuffer sRGB)framebuffer sRGB)

Page 13: OpenGL 3.0 Texture Arrays

Changed Token NamesChanged Token Names

• COMPARE_REF_TO_TEXTURECOMPARE_REF_TO_TEXTURE

• MAX_VARYING_COMPONENTSMAX_VARYING_COMPONENTS

• MAX_CLIP_DISTANCESMAX_CLIP_DISTANCES

• CLIP_DISTANCESCLIP_DISTANCES

• COMPARE_R_TO_TECOMPARE_R_TO_TEXTUREXTURE

• MAX_VARYING_FLOMAX_VARYING_FLOATSATS

• MAX_CLIP_PLANESMAX_CLIP_PLANES

• CLIP_PLANESCLIP_PLANES

Page 14: OpenGL 3.0 Texture Arrays

Supported Shading Supported Shading LanguagesLanguages

• GLSL1.10GLSL1.10

• GLSL1.20GLSL1.20

• GLSL1.30GLSL1.30

Page 15: OpenGL 3.0 Texture Arrays

OpenGL 3.0 Texture OpenGL 3.0 Texture ArraysArrays

““It is the eye of ignorance that assigns It is the eye of ignorance that assigns a fixed and unchangeable color to a fixed and unchangeable color to

every object...”every object...”

Paul GauguinPaul Gauguin

Page 16: OpenGL 3.0 Texture Arrays

EXT_texture_arrayEXT_texture_array

• Created August 7, 2008Created August 7, 2008

• Enteracts with eitherEnteracts with either

NV_geometry_program4NV_geometry_program4NV_gpu_program4NV_gpu_program4OpenGL Shading Language (GLSL 3.0)OpenGL Shading Language (GLSL 3.0)

Page 17: OpenGL 3.0 Texture Arrays

EXT_texture_arrayEXT_texture_array

• What it is:What it is:

Array of textures equal in size and Array of textures equal in size and format, arranged in layersformat, arranged in layers

Height (1D) or depth (2D) are the Height (1D) or depth (2D) are the number of layersnumber of layers

Page 18: OpenGL 3.0 Texture Arrays

EXT_texture_arrayEXT_texture_array

• Specifications:Specifications:

1D array: TexImage2D1D array: TexImage2D2D array: TexImage3D2D array: TexImage3D

Page 19: OpenGL 3.0 Texture Arrays

• TexImage2D(enum target, int level, TexImage2D(enum target, int level, int internalformat, sizei width, sizei int internalformat, sizei width, sizei height, int border, enum format, height, int border, enum format, enum type, void *data)enum type, void *data)

• Target is a 2D textureTarget is a 2D texture• Level is level of detailLevel is level of detail• Internalformat is storage of textureInternalformat is storage of texture• Width, height and border are Width, height and border are

boundaries of the textureboundaries of the texture• Format is current format of textureFormat is current format of texture• *data is pointer to internal data type*data is pointer to internal data type

Page 20: OpenGL 3.0 Texture Arrays

EXT_texture_arrayEXT_texture_array

• How it WorksHow it WorksTexture array is seen as a unit in the shaderTexture array is seen as a unit in the shaderAccess is through single coordinate vectorAccess is through single coordinate vector1 layer of array is selected as 1D or 2D texture1 layer of array is selected as 1D or 2D textureCoordinate of layer is in [0, n-1], where n is Coordinate of layer is in [0, n-1], where n is

the total number of textures in the arraythe total number of textures in the arrayArray textures are rendered by binding them Array textures are rendered by binding them

to a framebuffer (EXT_framebuffer_object)to a framebuffer (EXT_framebuffer_object)Can bind whole array, or single layer Can bind whole array, or single layer

Page 21: OpenGL 3.0 Texture Arrays

EXT_texture_arrayEXT_texture_array

• 6 different textures are possible as 6 different textures are possible as input to the array. Each texture is itself input to the array. Each texture is itself a 1D, 2D, or 3D array of images.a 1D, 2D, or 3D array of images.

• Each image element is called a texel. Each image element is called a texel.

• Each image is comprised of 1 to n layersEach image is comprised of 1 to n layers

Page 22: OpenGL 3.0 Texture Arrays
Page 23: OpenGL 3.0 Texture Arrays

Vs. The Old way... Vs. The Old way...

• Basic problem: Texture animationBasic problem: Texture animation

• Create separate image file per frame of Create separate image file per frame of animationanimation

• Load every frame as part of user array: Load every frame as part of user array: texture[index]=LoadTextureRAW(“text1.raw”, 256, texture[index]=LoadTextureRAW(“text1.raw”, 256, 256);256);

• Set the texture to the coordinate: Set the texture to the coordinate: glBindTexture(GL_TEXTURE_2D,texture[frame]); //where glBindTexture(GL_TEXTURE_2D,texture[frame]); //where frame is some intframe is some int

• Go to next frame of texture array and Go to next frame of texture array and repeatrepeat

Page 24: OpenGL 3.0 Texture Arrays

EXT_texture_arrayEXT_texture_array

• One use of texture animation to a One use of texture animation to a shape is the Beryl Desktop, a 3D shape is the Beryl Desktop, a 3D cube where each side is a separate cube where each side is a separate desktop, for example. desktop, for example.

Page 25: OpenGL 3.0 Texture Arrays

Application: Beryl Desktop Application: Beryl Desktop

• *image compliments of Corporal J VanDyke, *image compliments of Corporal J VanDyke, Auraria PDAuraria PD

Page 26: OpenGL 3.0 Texture Arrays

Questions?Questions?

Page 27: OpenGL 3.0 Texture Arrays

This Presentation OnlineThis Presentation Online

http://ouray.cudenver.edu/~oeterrel/http://ouray.cudenver.edu/~oeterrel/Open_GL.htmlOpen_GL.html