Rendererjava

The Renderer interface tells the test harness what it intends to draw (see Listing 10-10). Any class that implements this protocol will be able to draw using OpenGL.

Listing 10-10. The Methods of the Renderer Protocol

//filename: Renderer.java public interface Renderer {

int[] getConfigSpec();

void surfaceCreated(GLl0 gl);

void sizeChanged(GLl0 gl, int width, int height);

void drawFrame(GL10 gl);

The getConfigSpec() method is responsible for returning the OpenGL configuration necessary to construct an EGL context. In the surfaceCreated() method, the implementer is responsible for unbinding and binding the EGL context to the surface or window. You will need to set the viewport and zoom in the sizeChanged method. drawFrame() is responsible for the actual OpenGL drawing of the model objects.

0 0

Post a comment