User Submitted Code Samples - Page 9

High Dynamic Range Rendering (OpenGL - C++)
 

Author: Simon Flannery

This easy sample demonstrates how to introduce High Dynamic Range rendering, or HDR for short, into any scene. HDR is a lighting procedure designed to emulate, and capture, the increased lighting levels and contrast ratios experienced in the real world. Thus HDR involves the use of a wider dynamic range than usual. More simply, in HDR each pixel is not limited to the traditional range [0, 1]. However, since traditional display devices are still bounded by [0, 1] we use the concept of Tone Mapping to allow a HDR color to be mapped to a Low Dynamic Range in order to be displayed.

Relevant Keywords: glGenTextures, glBindTexture, glTexImage2D, glTexParameteri, glBindTexture, glGenRenderbuffersEXT, glBindRenderbufferEXT, glRenderbufferStorageEXT, glBindFramebufferEXT, glFramebufferTexture2DEXT, glFramebufferRenderbufferEXT, glCreateShaderObjectARB, glShaderSourceARB, glCompileShaderARB, glAttachObjectARB, glGetObjectParameterivARB, glGetInfoLogARB, glUseProgramObjectARB, glGetUniformLocationARB, glUniform3fvARB, glDeleteObjectARB, glDeleteTextures, glDeleteFramebuffersEXT, glViewport, glMatrixMode, glLoadIdentity, gluPerspective, glBegin, glTexCoord2i, glVertex2i, glEnd, glActiveTexture, glDisable.

 

Volumetric Lines (DirectX 9.0 - C++)
 

Author: Adel Amro

This sample demonstrates a technique for efficiently drawing what is often called volume lines. These are quads oriented and textured in such a way to be rendered as though they were thick lines. This sample is based on the OpenGL sample from Nvidia titled CG Volume Lines. It should work on low end cards.