OpenGL

Sprite animations can be rendered in various ways. More commonly used techniques use 2D textures and discretely display one frame at a time (for example on a quad). This is usually done by loading each frame of the animation into a seperate 2D texture and binding them as required, or by putting all frames into a single 2D texture and moving texture coordinates. Smooth animations require a high number of frames this way.

Alternatively, you can use a 3D texture, which gives you linear filtering between frames, i.e. frames are blended into each other. A 3D texture can increase visual quality and create smooth animations with fewer frames. The following describes the idea and shows a few examples.

This is a shader written in the OpenGL Shading Language (GLSL). It implements bump mapping using a normal map. In order to achieve more realistic lighting and more interesting material properties, this shader also does specular mapping. Below you will find the GLSL source code, as well as instructions on how it can be used.




Version 1.2.4

Description

Space Folds is a take on the classic asteroid-shooter genre. The player's ship has been trapped in a small area of space. Unfortunately a plethora of asteroids has found its way there, too. The only way out is to destroy all asteroids.



Space Folds was mainly an OpenGL and GLSL exercise. It is written in Java and uses the LWJGL to access OpenGL for graphics and OpenAL for sound. It features several advanced rendering techniques, e.g. GLSL shaders for bloom, normal mapping and distortion effects.

Play now (via Java Web Start)


The GlGetQuerier is a small utility to query the current OpenGL state with all constants that are listed in http://www.opengl.org/sdk/docs/man/xhtml/glGet.xml. Returned results are printed to the console. Writing them to a file is optional. A packaged version (from 2008-10-29) of glGet.xml is used to compile a list of constant names. Values that require glGetString (not in glGet.xml) are also queried. The output is sorted alphabetically by the constants' names.

GlGetQuerier is written in Java 5 and uses the LWJGL 2 for OpenGL access.

"The Lightweight Java Game Library (LWJGL) [...] provides developers access to high performance crossplatform libraries such as OpenGL (Open Graphics Library) [...]"
- The LWJGL homepage

In order to use OpenGL in Java wrappers, like the Lightweight Java Gaming Library (LWJGL), you obviously have to learn how to use both first. The de facto standard beginner book for OpenGL is the Redbook, the OpenGL Programming Guide. However, its examples are written in C. While I was learning from the book, I implemented its examples with the LWJGL in Java. These rewritten and ported examples are published here.