User Submitted Code Samples - Page 6

Shader based Sky-dome (OpenGL - C++)
 

Author: Simon Flannery

This sample demonstrates how to render a shader based sky-dome using GLSlang.

 
Post Processing with a Sobel Edge Detection Shader (DirectX 9.0 - C++)
 

Author: Michael Guerrero

This sample demonstrates how to easily render off-screen, apply post processing effects and render the finished image onscreen. As a demonstration, the sample uses a Sobel edge detection shader to render a post-processed version a textured quad.

 
Shadow Mapping with a FBO (OpenGL - C++)
 

Author: Tristan Dean

This sample modifies the 'frame_buffer_object' sample to handle simple, compatible shadow mapping. The main 2 differences between this sample and Kevin's 'Shadow_mapping_nv' sample is firstly using FBO's over pBuffers, But more importantly storing the depth of the fragment in RGBA format instead of DEPTH_COMPONENT This is for both compatibility (non-nv extensions) and so we can store the depth in a linear format, not the non-linear 'DEPTH_COMPONENT'.

Relevant Keywords: glIsRenderbufferEXT, glBindRenderbufferEXT, glDeleteRenderbuffersEXT, glGenRenderbuffersEXT, glRenderbufferStorageEXT, glGetRenderbufferParameterivEXT, glIsFramebufferEXT, glBindFramebufferEXT, glDeleteFramebuffersEXT, glGenFramebuffersEXT, glCheckFramebufferStatusEXT, glFramebufferTexture1DEXT, glFramebufferTexture2DEXT, glFramebufferTexture3DEXT, glFramebufferRenderbufferEXT, glGetFramebufferAttachmentParameterivEXT, glGenerateMipmapEXT, PFNGLISRENDERBUFFEREXTPROC, PFNGLBINDRENDERBUFFEREXTPROC, PFNGLDELETERENDERBUFFERSEXTPROC, PFNGLGENRENDERBUFFERSEXTPROC, PFNGLRENDERBUFFERSTORAGEEXTPROC, PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC, PFNGLISFRAMEBUFFEREXTPROC, PFNGLBINDFRAMEBUFFEREXTPROC, PFNGLDELETEFRAMEBUFFERSEXTPROC, PFNGLGENFRAMEBUFFERSEXTPROC, PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC, PFNGLFRAMEBUFFERTEXTURE1DEXTPROC, PFNGLFRAMEBUFFERTEXTURE2DEXTPROC, PFNGLFRAMEBUFFERTEXTURE3DEXTPROC, PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC, PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC, PFNGLGENERATEMIPMAPEXTPROC, GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, GL_FRAMEBUFFER_EXT, GL_FRAMEBUFFER_COMPLETE_EXT, GL_FRAMEBUFFER_UNSUPPORTED_EXT, GL_COLOR_ATTACHMENT0_EXT, and GL_DEPTH_ATTACHMENT_EXT.

 
Texture Loading with FreeImage (OpenGL - C++)
 

Author: Tristan Dean

This sample demonstrates how to demonstrate how to load texture files using the FreeImage library.

Relevant Keywords: FreeImage_GetFileType, FREE_IMAGE_FORMAT, FreeImage_ConvertTo24Bits, FreeImage_GetWidth, FreeImage_GetHeight, FreeImage_GetBits, and FreeImage_Unload.

 
Texture Projection (OpenGL - C++)
 

Author: Steve Butrimas

This program demonstrates how one would go about doing a projected texture.
The sample here shows how a projected texture technique can be used to produce a light map. The point is that even though you have very few vertices available for the fixed function pipeline lighting solution, you can achieve nice per pixel lighting even though the surface has only a handful of vertices. This sample draws a cube, only allowing the inside being visible via culling front facing polys, and then projects the light map texture on the second texture stage all through the programmable pipeline. The left mouse button will move the cube around and the right mouse button will move the projected light map around.