POGL Tips and Tutorials

Please Submit sample code and code snippets to the POGL team for possible inclusion on this site.

Full Screen Mode

Game developers often use Full Screen mode to gain control of the user's entire display. GLUT provides a portable mechanism to switch POGL to Full Screen mode:

Calling glutFullScreen(); anytime outside of the rendering cycle will switch your OpenGL window to Full Screen mode.

Calling glutReshapeWindow($width,$height); resets to normal mode.

Special Notes:

  • On Windows, glutReshapeWindow puts the OpenGL Window frame outside of the user's desktop area; you need to call glutPostitionWindow($x,$y); to offset the window.

  • On some X11 window managers, glutFullScreen(); does not hide the window frame; instead, call glutReshapeWindow and glutPostitionWindow to place the frame outside the desktop.

glpOpenWindow supports a Full Screen Game Mode on some platforms - however, glpOpenWindow is not yet fully portable (fails on Windows and MacOS). The POGL team plans to make glpOpenWindow fully portable in a future release, and will add a glpRestoreWindow API.

Frame Buffer Objects

The GL_framebuffer_object extension provides support for hardware offscreen rendering. This allows a program to instruct the GPU to render to GPU memory, which can then be used as a texture, or other data. This provides dramatically enhanced performance over systems that render to offscreen system memory.

Vertex and Fragment Programs

The Vertext Program extension allows you to load assembly-like instructions to your GPU to dynamically modify vertex data. This allows you to animate or reshape your vertices/objects. Similarly, the Fragment Program extension alows you to load assembly-like instructions to your GPU to dynamically modify fragment data. You can think of fragments as virtual pixels - data that has not yet been resolved to a device pixel.

OpenGL provides a pipeline where a model is composed of objects, which are constructed of facet primitives (meshes, polygons, strips, quads, triagles), that are defined by vertices.

These vertices are passed through a Vertex Program/Shader, which may manipulate attributes associated with the vertices, and sets up attributes that may later be used by the Fragment Program/Shader.

OpenGL steps through all your facets, passing their vertices to your Vertex Program, then rasterizes the fragments contained by the transformed facet, and passes this on to the Fragment Program, which then calculates the final pixel value.

Vertex Program Example:

Fragment Program Example:

Note: the MOV result.texcoord[0], vertex.texcoord; in the Vertex Program is passed into the Fragment Program: MUL color, fragment.texcoord[0].y, 2;.

Using Vertex and Fragment Programs together: