Evolution of Graphics API: Sujal Bista CMSC 828V
Evolution of Graphics API: Sujal Bista CMSC 828V
Graphics API
Sujal Bista
CMSC 828V
Outline
Introduction to OpenGL
Evolution of OpenGL
Recent advances in OpenGL API ver 3.2
New features of DirectX 11
Conclusion
OpenGL
OpenGL 1.x
Features
Fixed function (no shaders)
OpenGL state machine
Draw basic primitives (lines, triangles )
OpenGL 2.x
Features
Shading language (GLSL)
Multiple rendering targets
Non-power of two textures
Automatic mipmap generation
Texture access in vertex shaders
OpenGL 3.x
Features
Geometry shader
Vertex Array Objects(collection of state)
Texture Arrays
OpenGL 3.x
Features continued..
OpenCL helper functions (CopyBuffers)
Costume texture filter
Increased multi-sample rendering quality
o fragment shader per sample instead of per pixel
Depth clamp
o Near/Far plane Clipping
OpenGL 3.x
Need for Change
15+ old API difficult to maintain
Some functions do not scale well
o Bindings required for every little modifications
OpenGL 3.x
Deprecation Model
Allows API to mature without breaking backward
compatibility
Deprecation feature marked for removal
Old, slow and redundant functions are removed
Streamline the API
OpenGL 3.x
Deprecation Model in Action
OpenGL 3.0 marked some features as deprecated
OpenGL 3.1 removed these deprecated features
To support market need ARB_compatibility
extension is created to provide support for
deprecated feature. (Optional for vendors to
implement)
OpenGL 3.x
Opengl 3.2 ARB created two profiles
Core profile : Supports streamlined features. No
deprecated features.
Compatibility profile : Supports all the features.
OpenGL 3.x
Life of OpenGL function/features
Extension path
Vendor/Ext
ARB
Core
ARB
Vendor/EXT
Deprecation path
Core
OpenGL 3.x
Deprecated Functions/Features
Fixed Function vertex and fragment processing (eg.
glMultMatrix, glRotate etc.)
Color index mode
GLSL 1.10 and 1.20
Alpha test
Accumulation buffers
OpenGL 3.x
Deprecated Functions/Features Continued
Intermediate mode (tortures the video card)
o
o
o
o
OpenGL 3.x
Deprecated Functions/Features Continued
Automatic mipmap generation
Selection and feedback mode (PushName,
LoadName)
Display lists
Attribute stacks
//SHADER SETUP
glBindAttribLocation(shaderID,0,"in_Position");
glBindAttribLocation(shaderID,1,"in_Color");
//SIMPLE VERTEX SHADER
in vec3 in_Position;
in vec3 in_Color;
out vec3 ex_Color;
void main(void)
{
gl_Position = vec4(in_Position, 1.0);
ex_Color = in_Color;
}
//RENDER
// select first VAO
glBindVertexArray(m_vaoID[0]);
// draw first object
glDrawArrays(GL_TRIANGLES, 0, 3);
// select second VAO
glBindVertexArray(m_vaoID[1]);
// set constant color attribute
glVertexAttrib3f((GLuint)1, 1.0, 0.0, 0.0);
// draw second object
glDrawArrays(GL_TRIANGLES, 0, 3);
//VERTEX SHADER
#version 150
in vec3 in_Position;
in vec3 in_Color;
//modelview projection
uniform mat4 mvpmatrix;
out vec3 ex_Color;
void main(void) {
// Multiply the mvp matrix by the vertex to obtain our final
vertex position
gl_Position = mvpmatrix * vec4(in_Position, 1.0);
ex_Color = in_Color;
}
//FRAGMENT SHADER
#version 150
precision highp float;
in vec3 ex_Color;
out vec4 gl_FragColor;
void main(void) {
gl_FragColor = vec4(ex_Color,1.0);
}
Interesting New
Extensions
Direct state access
Edit object by name
Similar to Direct3D API
Still Vendor specific Nvidia with collaboration with
ID, S3, Blizzard etc.
Interesting New
Extensions
Direct state access
Command
Old
New
Uniformly scaling
modelview matrix
by 2
GLenum savedMatrixMode;
glGetIntegerv(GL_MATRIX_MODE,
&savedMatrixMode);
glMatrixMode(GL_MODELVIEW);
glScaleMatrixf(2,2,2);
glMatrixMode(savedMatrixMode);
glMatrixScalefEXT(GL_MODELVIE
W, 2,2,2);
Binding textures
to texture units
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texobj);
glBindMultiTexture(GL_TEXTURE
5,GL_TEXTURE_2D,texobj);
Updating a
uniform or
program
parameter
glBindProgramARB(GL_VERTEX_PROGR
AM, vp);
glProgramLocalParameter4fARB(index,
x,y,z,w);
glUseProgram(glslprog);
glUniform4f(location, x,y,z,w);
glNamedProgramLocalParameter4f
EXT(vp,index, x,y,z,w);
glProgramUniform4fEXT(glslprog,
location, x,y,z,w);
Interesting New
Extensions
Bindless Graphics
Binding different buffers are very costly
Use GPU address rather than by name
Driver no longer has to fetch GPU address from
system memory
Measurements have shown that bindless graphics
can result in more than 7x speedup (NVIDIA)
DirectX11
New Features
Hull shader Takes patches and control point and
outputs data on how to configure tessellator
Tessellator Takes coarse shapes and breaks them
into small parts based on the input from hull shader
o Fixed function but high speed
o Geometry shader vs Tessellation steps(flexibility vs speed)
DirectX11
New Features Continued
Compute shader
Multi-thread API using deferred contexts
Conclusion
Fundamental changes
Optimized and stronger API
Intels Larrabee might add features/changes
Higher initial barrier for the starters
Sources
http://http.download.nvidia.com/developer/Papers/2005/OpenGL_2.0/NVIDIA_OpenGL
_2.0_Support.pdf
http://ubuntuforums.org/archive/index.php/t-816081.html
http://developer.download.nvidia.com/presentations/2008/NVISION/NVISION08_opengl_
mjk_web.pdf
http://www.khronos.org/developers/library/2009_siggraph_bof_opengl/OpenGL-BOFOpenGL-3.2-Overview-Siggraph-Aug09.pdf
http://www.gaming-zone.net/wp-content/uploads/2008/08/larahist.gif
http://www.opengl.org/registry/doc/glspec32.compatibility.20090803.pdf
http://www.anandtech.com/printarticle.aspx?i=3507
http://www.opengl.org/registry/doc/glspec32.core.20090803.pdf
http://sites.google.com/site/opengltutorialsbyaks/introduction-to-opengl-3-1---tutorial-01
http://www.slideshare.net/Mark_Kilgard/opengl-32-and-more
http://www.opengl.org/wiki/Tutorial3:_Rendering_3D_Objects_(C_/SDL)
http://developer.download.nvidia.com/opengl/tutorials/bindless_graphics.pdf
Questions??