edu.mines.jtk.opengl
Interface GlPainter


public interface GlPainter

An OpenGL painter. Paints via an OpenGL context locked for the current thread. A painter draws on an OpenGL target, which may be an AWT canvas, an SWT canvas, an AWT image, and so on. The painter is therefore independent of the type of OpenGL target on which it paints. For example, the same painter may be used to paint either an SWT or AWT canvas.

Version:
2004.12.02
Author:
Dave Hale, Colorado School of Mines

Method Summary
 void glInit()
          Initializes OpenGL state when the target is first painted.
 void glPaint()
          Paints the target via OpenGL.
 void glResize(int width, int height, int widthBefore, int heightBefore)
          Modifies OpenGL state when this canvas has been resized.
 

Method Detail

glInit

void glInit()
Initializes OpenGL state when the target is first painted. This method is called before the methods glResize(int,int,int,int) and glPaint() when (1) the target must be painted and (2) it has never been painted before.

Implementations of this method use the OpenGL context that has been locked for the current thread.


glResize

void glResize(int width,
              int height,
              int widthBefore,
              int heightBefore)
Modifies OpenGL state when this canvas has been resized. This method is called before the method glPaint() when (1) the target must be painted and (2) its width or height have changed since it was last painted or it has never been painted.

Implementations of this method use the OpenGL context that has been locked for the current thread.

Parameters:
width - the current width.
height - the current height.
widthBefore - the width before resizing.
heightBefore - the height before resizing.

glPaint

void glPaint()
Paints the target via OpenGL.

Implementations of this method use the OpenGL context that has been locked for the current thread.