Game Development Reference
In-Depth Information
private IntBuffer mVertexBuffer;
private IntBuffer mColorBuffer;
private ByteBuffer mIndexBuffer;
}
Figure 3-8 shows the sample in action. In the next section, you'll see how portions of this
code can be implemented natively.
Figure 3-8. Tumbling cubes from the Java sample
So you have seen one way of tackling OpenGL rendering purely using Java. However, you
can build the same example using the combination of a thin Java wrapper and a native
renderer. Both are equally valid and can achieve the same results. However, the latter works
better if you already have large portions of OpenGL code written in C and you wish to reuse
them. The former is the way to go if you plan to write your code entirely in Java. Choosing
the right rendering technique is difficult but not the only challenge you will face when creating
your game. Video scaling is another difficult subject, and you'll tackle it in the next section.
Scaling Video Buffers with Hybrid OpenGL ES
One of the trickiest parts of working with software-based games is scaling the video buffer
to fit the display size. It is even more troublesome when you have a multitude of resolutions,
such as in an open environment such as Android. As a developer, you must try to achieve
 
Search WWH ::




Custom Search