Yage3D.net
 

yage.system.graphics.graphics

Authors:
Eric Poggel

License:
LGPL v3

This is a work-in-progress wrapper around a systems-level graphics API (Currently only OpenGL) which adds the following features:
  • Transparently creates separate virtual contexts for each calling thread.
  • Checks errors and throws exceptions
  • Aggregates operations instead of performing them instantly.
  • Allows easily pushing and popping the entire state.
  • "Infinite" stack depth (matrices, etc.)
  • Allows easily swapping out OpenGL for another graphics system, if ever needed.
For ease of implementation, only calls and states that are used by Yage are wrapped. For ease of use, function and parameter names are very similar to OpenGL. See: http://opengl.org/sdk/docs/man

alias Graphics ;
Use OpenGL for graphics API calls. This allows easily swapping out OpenGL for another graphics wrapper if ever needed.

Example:
 Graphics.color([1, 1, 1, 1]); // is the same as:
 OpenGL.color([1, 1, 1, 1]);


class OpenGL ;
Wrapper around a systems-level graphics API (Currently only OpenGL ) It is currently unfinished and has bugs.

this();
Construct and create an initial state on the state stack.

static void alphaFunc (uint func, float value);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glAlphaFunc.xml

static void bindBuffer (uint target, uint buffer);
See:


http:
//opengl.org/sdk/docs/man/xhtml/glBindBuffer.xml

static void bindTexture (uint target, uint texture, uint textureUnit = 33984u);
See:


http:
//opengl.org/sdk/docs/man/xhtml/glBindTexture.xml, http://opengl.org/sdk/docs/man/xhtml/glActiveTexture.xml

TODO:
textureUnit

static void blendFunc (uint sfactor, uint dfactor);
See:


http:
//opengl.org/sdk/docs/man/xhtml/glBlendFunc.xml

static void bufferData (uint target, void[] data, uint usage = 35044u);
See:


http:
//opengl.org/sdk/docs/man/xhtml/glBufferData.xml

static void clear (uint mask);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glClear.xml

static void color (float[] value);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glColor.xml

static void cullFace (uint mode);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glCullFace.xml

static void deleteBuffer (uint buffer);
See:


http:
//opengl.org/sdk/docs/man/xhtml/glDeleteBuffers.xml

static void deleteTexture (uint texture);
See:


http:
//opengl.org/sdk/docs/man/xhtml/glDeleteTextures.xml

static void depthMask (bool flag);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glDepthMask.xml

static void disable (uint cap);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glDisable.xml

static void disableClientState (uint cap);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glDisableClientState.xml

static void enable (uint cap);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glEnable.xml

static void enableClientState (uint cap);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glEnableClientState.xml

static uint genBuffer ();
See:


http:
//opengl.org/sdk/docs/man/xhtml/glGenBuffers.xml

static uint genTexture ();
See:


http:
//opengl.org/sdk/docs/man/xhtml/glGenTextures.xml

static void lineWidth (float width);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glLineWidth.xml

static void loadIdentity ();
static void loadIdentityTexture ();
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glLoadIdentity.xml

static void loadMatrix (Matrix m);
static void loadTextureMatrix (Matrix m);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glLoadMatrix.xml

static void material (uint face, uint pname, float[] param);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glMaterial.xml

static void multMatrix (Matrix m);
static void multTextureMatrix (Matrix m);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glMultMatrix.xml

static void pointSize (float size);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glPointSize.xml

static void polygonMode (uint face, uint mode);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glPolygonMode.xml

static void popMatrix ();
static void popTextureMatrix ();
See:


http:
//opengl.org/sdk/docs/man/xhtml/glPopMatrix.xml

static void pushMatrix ();
static void pushTextureMatrix ();
See:


http:
//opengl.org/sdk/docs/man/xhtml/glPushMatrix.xml

static void popState ();
Pop all OpenGL state from the stack. This is equivalent of glPopAttrib() and glPopClientAttrib()

static void pushState ();
Push all OpenGL state onto a stack. This is equivalent of glPushAttrib() and glPushClientAttrib()

static void rotate (float angle, float x, float y, float z);
static void rotateTexture (float angle, float x, float y, float z);
See:


http:
//opengl.org/sdk/docs/man/xhtml/glRotate.xml

static void scale (float x, float y, float z);
static void scaleTexture (float x, float y, float z);
See:


http:
//opengl.org/sdk/docs/man/xhtml/glScale.xml

static void texEnv (uint target, uint pname, int param);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glTexEnv.xml

static void texImage2D (uint target, int level, int internalFormat, int width, int height, int border, uint format, uint type, void[] data);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glTexImage2D.xml

static void texParameter (uint target, uint pname, int param);
See:


http:
//www.opengl.org/sdk/docs/man/xhtml/glTexParameter.xml

static void translate (float x, float y, float z);
static void translateTexture (float x, float y, float z);
See:


http:
//opengl.org/sdk/docs/man/xhtml/glTranslate.xml

static int applyState ();
Apply the current OpenGL state

Returns:
the number of necessary OpenGL calls.

class GraphicsException : yage.core.object2.YageException;
Exception thrown on a Graphics error.

Yage and all source files © 2005-2009 Eric Poggel
Documentation generated with CandyDoc on Sun Sep 20 01:37:10 2009