OpenGL pixel shader: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
No edit summary
Line 7: Line 7:
Optional: after updating the opengl rendering target but before rendering the triangle, query the opengl implementation to determine which versions of shaders are supported by the rendering target, list the tested shaders and the available shaders and then use a supported shader.
Optional: after updating the opengl rendering target but before rendering the triangle, query the opengl implementation to determine which versions of shaders are supported by the rendering target, list the tested shaders and the available shaders and then use a supported shader.


See also: [http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/introduction-to-shader-programming-part-iii-fun-r1820 gamedev's introduction to pixel shaders], and [http://www.opengl.org/documentation/glsl/ opengl.org's gl shader language documentation], and [http://www.lighthouse3d.com/tutorials/glsl-tutorial/ lighthouse3d.com's glsl tutorial].
See also: [http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/introduction-to-shader-programming-part-iii-fun-r1820 gamedev's introduction to pixel shaders] (which does not touch on OpenGL but which can provide useful background context), and [http://www.opengl.org/documentation/glsl/ opengl.org's gl shader language documentation], and [http://www.lighthouse3d.com/tutorials/glsl-tutorial/ lighthouse3d.com's glsl tutorial].

Revision as of 18:25, 25 October 2011

OpenGL pixel shader is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Using the triangle geometry from OpenGL. But instead of using a mechanism such as glColor3d, use a pixel shader for each pixel in the triangle. The pixel shader should pick a random RGB color for each pixel.

Optional: provide an update mechanism, to repeatedly re-render the triangle. (Possibilities include a mouse event handler, a timer event handler or an infinite loop.)

Optional: after updating the opengl rendering target but before rendering the triangle, query the opengl implementation to determine which versions of shaders are supported by the rendering target, list the tested shaders and the available shaders and then use a supported shader.

See also: gamedev's introduction to pixel shaders (which does not touch on OpenGL but which can provide useful background context), and opengl.org's gl shader language documentation, and lighthouse3d.com's glsl tutorial.