Sky Sphere / Cube / Dome Render

Sky Sphere / Cube / Dome Render

Three blisteringly fast classes for rendering sky textures in 3D games: sphere, cube and dome

  • Language: C/C++
  • Released: Jun 14, 2012
    Last Update: Jun 14, 2012

A very large percentage of games use textures to fake 'stuff' on or over the horizon. Distant mountains, buildings, clouds, hills, stars, nebula, sun, moon, etc, can all be painted into textures rather than rendered with actual geometry.

However, there are several geometries and mapping methods that can be used, each with their own advantages and disadvantages. This application showcases 3 types of environment geometry: sphere, cube and dome. Which one you choose depends on your requirements and how it will be used:


  • Advantages: 1 texture, 1 draw call, only 1 seam, full 360 degree coverage
  • Disadvantages: texture singularity at poles
  • Example usage: racing game (no looking directly up)


  • Advantages: minimal texture distortion, full 360 degree coverage, only 12 triangles
  • Disadvantages: 6 textures, 6 draw calls, more seams
  • Example usage: space battle game (full rotation)


  • Advantages: 1 texture, 1 draw call, 0 seams, minimal texture distortion
  • Disadvantages: 50% coverage
  • Example usage: first-person shooter with fairly flat terrain

They all use vertex buffer objects and triangle strips for greatest speed. The code is clear, concise and optimized.

TIP: It is SOMETIMES a good idea to render your sky last. This is because the other geometry will have written to the depth buffer, and a large portion of the sky pixels will fail the z test and never be drawn. If you render the sky first, they will be drawn unnecessarily. Of course, this only works if you have no transparency in the scene.

Note: The example program uses freeglut for window creation but the Sky Geometry components themselves do not, so they are very portable.



How to use in your own application:

Create one of the objects:

SkySphere* _skysphere;
_skysphere = new SkySphere( SCALE, SLICES, STACKS, TEXTURE_HANDLE);


SCALE is the radius of the sky sphere
SLICES and STACKS are the number of horizontal and vertical tesslation divisions
TEXTURE_HANDLE is an opengl handle to a texture. Included is a function for reading TGA images but you'll probably want something better

Every frame simply use:


And finally, at the end, remember to clean up after yourself:

delete _skysphere;
You need to log-in or create an account
  • Create an account
  • Log-in
Please use your real name.
Activation link will be sent to this address.
Minimum 8 characters
Enter your password again

Clicking this button confirms you read and agreed to the terms of use and privacy policy.


Save your watchlist

Fill your details below to receive project updates from your watch list - including new versions, price changes and discounts.

I agree to the terms of use and privacy policy.

3 licenses, starting from From » FREE 14 day money-back guarantee View Licenses
or Get a quote

for customization or integration services

  • :)
    JM James McClymonds
    2 years ago, 0 comments
    Was this helpful?
Post a comment

Or enter your name and Email
  • N nagakontot 2 months ago
    how to get the free liciense?