This guide should serve as an introduction to 3D graphics programming, including introducing the 3D pipeline and how to use the Cogl API to submit drawing commands to your GPU. It provides an introduction to 3D transformations and working with different coordinate systems and covers intermediate topics such as texture mapping, blending, creating offscreen framebuffers, lighting and shaders.
Call for help!
I don't think this is going to be easy to provide with just one person working on it, so everyone please feel free to contribute to this programming guide. Especially if you are new to graphics programming your input will be invaluable for us!
Anyone who has a copy of the OpenGL Programming Guide should have a pretty good idea of the range of topics we want to cover in this document and I'd be happy to see us follow a very similar layout. Obviously; please don't copy verbatim text but you may find it is a good meta guide to start with.
Contents
- Introduction to Cogl
- Gives a taster of what Cogl is for and introduces the basic 3D graphics pipeline. It also introduces the basics of the Cogl API which other chapters build on.
- Viewing transformations
- Describes how geometry is transformed between different coordinate spaces until it finally reaches the display. Cogl lets you control these transformations at each stage to affect the final view of your models.
- Create an onscreen framebuffer
- Explains the principles of the CoglRenderer, CoglDisplay and CoglOnscreen data types and how they can be configured and allocated to create a framebuffer for drawing on.
- Controlling the pipeline
- Explains the principles of creating and managing
CoglMaterialCoglPipeline objects.
- Submitting geometry
- Explains how vertex arrays are allocated and how to describe vertex attributes which can be used to submit geometry to the GPU.
- Texturing
- Describes the principles of the CoglTexture abstract type and how each of the 2D, Sliced, Atlas, Sub, 3D and PixmapX11 texture types can be allocated. It also explains how to associate textures with a pipeline and the principles of texture filtering. Finally it covers how texture coordinates and combine-functions can be used to affect how textures are mapped to geometry.
- Blending
- Describes the last stage of the pipeline; blending. Blending can be used to draw transparent objects and Cogl lets you control the different factors that affect how geometry is blended with the framebuffer to achieve a range of effects.
- Shaders
- Introduces GLSL and the shader snippet framework provided by Cogl. Shaders expose the fully programmable parts of most modern GPUs so this chapter discusses how Cogl makes it easy to augment the pipeline with small fragments of code or even completely replace major stages of the pipeline with your own shader code.