My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
jsgraphics  
jsgraphics module
doc
Updated May 31, 2009 by sou...@gmail.com

If something seems wrong or incomplete, please enter a comment at the bottom of this page.



- source - main - QA -

jsgraphics module


class jsgraphics::Ogl

- top - revision -

Static functions

GetBoolean

boolean GetBoolean( pname )
arguments:
  1. GLenum pname
return value:
value of a selected parameter.
OpenGL API:
glGetBooleanv

GetInteger

integer | Array GetInteger( pname [, count] )
arguments:
  1. GLenum pname
  2. integer count: is the number of expected values. If count is defined, the function will returns an array of values, else it returns a single value.
return value:
A value or an array of values of a selected parameter.
OpenGL API:
glGetIntegerv

GetDouble

real | Array GetDouble( pname [, count] )
arguments:
  1. GLenum pname
  2. integer count: is the number of expected values. If count is defined, the function will returns an array of values, else a single value.
return value:
A single value or an Array of values of the selected parameter.
OpenGL API:
glGetDoublev

Accum

void Accum( op, value )
arguments:
  1. GLenum op
  2. real value
OpenGL API:
glAccum

AlphaFunc

void AlphaFunc( func, ref )
arguments:
  1. GLenum op
  2. real ref
OpenGL API:
glAlphaFunc

Flush

void Flush()
OpenGL API:
glFlush

Finish

void Finish()
OpenGL API:
glFinish

Fog

void Fog( pname, params )
arguments:
  1. GLenum pname
  2. value params: is either a number or an array of numbers.
OpenGL API:
glFogi, glFogf, glFogfv

Hint

void Hint( target, mode )
arguments:
  1. GLenum target
  2. GLenum mode
OpenGL API:
glHint

Vertex

void Vertex( x, y [, z] )
arguments:
  1. real x
  2. real y
  3. real z
OpenGL API:
glVertex3d, glVertex2d

Color

void Color( red, green, blue [, alpha] )
arguments:
  1. real red
  2. real green
  3. real blue
  4. real alpha
OpenGL API:
glColor4d, glColor3d

Normal

void Normal( nx, ny, nz )
arguments:
  1. real nx
  2. real ny
  3. real nz
OpenGL API:
glNormal3d

TexCoord

void TexCoord( s [, t [, r]] )
arguments:
  1. real s
  2. real t
  3. real r
OpenGL API:
glTexCoord1d, glTexCoord2d, glTexCoord3d

TexParameter

void TexParameter( target, pname, params )
arguments:
  1. GLenum target
  2. GLenum pname
  3. value params: is either a number or an array of numbers.
OpenGL API:
glTexParameteri, glTexParameterf, glTexParameterfv

TexEnv

void TexEnv( target, pname, params )
arguments:
  1. GLenum target
  2. GLenum pname
  3. value params: is either a number or an array of numbers.
OpenGL API:
glTexEnvi, glTexEnvf, glTexEnvfv

LightModel

void LightModel( pname, params )
arguments:
  1. GLenum pname
  2. value params: is either a number or an array of numbers.
OpenGL API:
glLightModeli, glLightModelf, glLightModelfv

Light

void Light( light, pname, params )
arguments:
  1. GLenum light
  2. GLenum pname
  3. value params: is either a number or an array of numbers.
OpenGL API:
glLighti, glLightf, glLightfv

Material

void Material( face, pname, params )
arguments:
  1. GLenum face
  2. GLenum pname
  3. value params: is either a number or an array of numbers.
OpenGL API:
glMateriali, glMaterialf, glMaterialfv

Enable

void Enable( cap )
arguments:
  1. GLenum cap
OpenGL API:
glEnable

Disable

void Disable( cap )
arguments:
  1. GLenum cap
OpenGL API:
glDisable

PointSize

void PointSize( size )
arguments:
  1. real size
OpenGL API:
glPointSize

LineWidth

void LineWidth( width )
arguments:
  1. real width
OpenGL API:
glLineWidth

ShadeModel

void ShadeModel( mode )
arguments:
  1. GLenum mode
OpenGL API:
glShadeModel

BlendFunc

void BlendFunc( fFactor, dFactor )
arguments:
  1. GLenum fFactor
  2. GLenum dFactor
OpenGL API:
glBlendFunc

DepthFunc

void DepthFunc( func )
arguments:
  1. GLenum func
OpenGL API:
glDepthFunc

DepthRange

void DepthRange( zNear, zFar )
arguments:
  1. real zNear
  2. real zFar
OpenGL API:
glDepthRange

CullFace

void CullFace( mode )
arguments:
  1. GLenum mode
OpenGL API:
glCullFace

FrontFace

void FrontFace( mode )
arguments:
  1. GLenum mode
OpenGL API:
glFrontFace

ClearStencil

void ClearStencil( s )
arguments:
  1. integer s
OpenGL API:
glClearStencil

ClearDepth

void ClearDepth( depth )
arguments:
  1. real depth
OpenGL API:
glClearDepth

ClearColor

void ClearColor( red, green, blue, alpha )
arguments:
  1. real red
  2. real green
  3. real blue
  4. real alpha
OpenGL API:
glClearColor

ClearAccum

void ClearAccum( red, green, blue, alpha )
arguments:
  1. real red
  2. real green
  3. real blue
  4. real alpha
OpenGL API:
glClearAccum

Clear

void Clear( mask )
arguments:
  1. GLbitfield mask
OpenGL API:
glClear

ClipPlane

void ClipPlane( plane, equation )
arguments:
  1. GLenum plane
  2. Array equation: array of real
OpenGL API:
glClipPlane

Viewport

void Viewport( x, y, width, height )
arguments:
  1. integer x
  2. integer y
  3. integer width
  4. integer height
OpenGL API:
glViewport

Frustum

void Frustum( left, right, bottom, top, zNear, zFar )
arguments:
  1. real left
  2. real right
  3. real bottom
  4. real top
  5. real zNear
  6. real zFar
OpenGL API:
glFrustum

Ortho

void Ortho( left, right, bottom, top, zNear, zFar )
arguments:
  1. real left
  2. real right
  3. real bottom
  4. real top
  5. real zNear
  6. real zFar
OpenGL API:
glOrtho

Perspective

void Perspective( fovy, zNear, zFar )
Set up a perspective projection matrix.
arguments:
  1. real fovy
  2. real zNear
  3. real zFar
note:
This is not an OpenGL API function.
OpenGL API:
glGetIntegerv, glFrustum

MatrixMode

void MatrixMode( mode )
arguments:
  1. GLenum mode
OpenGL API:
glMatrixMode

LoadIdentity

void LoadIdentity()
OpenGL API:
glLoadIdentity

PushMatrix

void PushMatrix()
OpenGL API:
glPushMatrix

PopMatrix

void PopMatrix()
OpenGL API:
glPopMatrix

LoadMatrix

void LoadMatrix( matrix )
arguments:
  1. value matrix: either a matrix object or an Array
OpenGL API:
glLoadMatrixf

Rotate

void Rotate( angle, x, y, z )
arguments:
  1. real angle
  2. real x
  3. real y
  4. real z
OpenGL API:
glRotated

Translate

void Translate( x, y [, z = 0] )
arguments:
  1. real x
  2. real y
  3. real z
OpenGL API:
glTranslated

Scale

void Scale( x, y [, z = 1] )
arguments:
  1. real x
  2. real y
  3. real z
OpenGL API:
glScaled

NewList

integer NewList()
Returns a new display-list.
OpenGL API:
glNewList

DeleteList

void DeleteList( list )
Deletes a display-list.
arguments:
  1. integer list
OpenGL API:
glDeleteLists

EndList

void EndList()
OpenGL API:
glEndList

CallList

void CallList( lists )
Calls one or more display-list.
arguments:
  1. value lists: is a single list name or an Array of list name.
OpenGL API:
glCallList, glCallLists

Begin

void Begin( mode )
arguments:
  1. GLenum mode
OpenGL API:
glBegin

End

void End()
OpenGL API:
glEnd

PushAttrib

void PushAttrib( mask )
arguments:
  1. GLbitfield mask
OpenGL API:
glPushAttrib

PopAttrib

void PopAttrib()
OpenGL API:
glPopAttrib

GenTexture

integer GenTexture()
Returns a new texture name.
OpenGL API:
glGenTextures

BindTexture

void BindTexture( target, texture )
arguments:
  1. GLenum target
  2. integer texture
OpenGL API:
glBindTexture

DeleteTexture

void DeleteTexture( texture )
Deletes the given texture.
arguments:
  1. integer texture
OpenGL API:
glDeleteTextures

CopyTexImage2D

void CopyTexImage2D( level, internalFormat, x, y, width, height, [ border ] )
arguments:
  1. integer level
  2. integer internalFormat
  3. integer x
  4. integer y
  5. integer width
  6. integer height
  7. integer border
note:
The target is always a GL_TEXTURE_2D
OpenGL API:
glCopyTexImage2D

GenBuffer

integer GenBuffer()
Returns a new buffer.
OpenGL API:
glGenBuffersARB

BindBuffer

void BindBuffer( target, buffer )
arguments:
  1. GLenum target
  2. integer buffer
OpenGL API:
glBindBufferARB

PointParameter

void PointParameter( pname, params )
arguments:
  1. GLenum pname
  2. value params: is a real or an Array of real.
OpenGL API:
glPointParameterf, glPointParameterfv

ActiveTexture

void ActiveTexture( texture )
arguments:
  1. GLenum texture
OpenGL API:
glActiveTextureARB

ClientActiveTexture

void ClientActiveTexture( texture )
arguments:
  1. GLenum texture
OpenGL API:
glClientActiveTextureARB

MultiTexCoord

void MultiTexCoord( target, s [, t [, r]] )
arguments:
  1. GLenum target
  2. real s
  3. real t
  4. real r
OpenGL API:
glMultiTexCoord1d, glMultiTexCoord2d, glMultiTexCoord3d

LoadTrimesh

void LoadTrimesh( trimesh )

DrawTrimesh

void DrawTrimesh()
OpenGL API:
glVertexPointer

DefineTextureImage

void DefineTextureImage( target, [internalformat], texture )
arguments:
  1. GLenum target
  2. integer internalformat: is the internal PixelFormat. If undefined, the function will use the format of texture.
  3. value texture: either a Texture object or an image object.
note:
This is not an OpenGL API function.
OpenGL API:
glPixelStorei, glTexImage2D

RenderToImage

image RenderToImage()
Returns the current contain of the viewport.
arguments:
  1. GLenum target
  2. integer internalformat: is the internal PixelFormat. If undefined, the function will use the format of texture.
  3. value texture: either a Texture object or an image object.
return value:
An image object.
note:
This is not an OpenGL API function.
OpenGL API:
glGenTextures, glBindTexture, glGetIntegerv, glCopyTexImage2D, glGetTexLevelParameteriv, glGetTexImage, glDeleteTextures

Static properties

error

integer error
OpenGL API:
glGetError

Native Interface

  • NIMatrix44Read
  • the current OpenGL matrix. See MatrixMode() to specifiy which matrix stack is the target forsubsequent matrix operations.

more information

OpenGL API Documentation

class jsgraphics::Transformation

- top - revision -

constructor

constructor( [initToIdentity] )
Creates a new Transformation object. If initToIdentity is given and true, the transformation is initialized to identity. Else the transformation is not initialized.

Clear

this Clear()
Reset the current transformation (set to identity).

ClearRotation

this ClearRotation()
Clear the rotation part of the current transformation.

ClearTranslation

this ClearTranslation()
Clear the translation part of the current transformation.

Load

this Load( matrix )
Load a 4x4 matrix as the current transformation.
arguments:
  1. value matrix: an Array or an object that supports NIMatrix44Read native interface.

LoadRotation

this LoadRotation( matrix )
Load the rotation part of another matrix to the current matrix.
arguments:
  1. value matrix: an Array or an object that supports NIMatrix44Read native interface.

LoadTranslation

this LoadTranslation( matrix )
Load the translation part of another matrix to the current matrix.
arguments:
  1. value matrix: an Array or an object that supports NIMatrix44Read native interface.

Translation

this Translation( x, y, z )
Sets the translation part of the current transformation.
arguments:
  1. real x
  2. real y
  3. real z

Translate

this Translate( x, y, z )
Apply a translation to the current ransformation.
arguments:
  1. real x
  2. real y
  3. real z

RotationFromQuaternion

this RotationFromQuaternion( w, x, y, z )
Sets the rotation part from a quaternion.
arguments:
  1. real w
  2. real x
  3. real y
  4. real z

TaitBryanRotation

this TaitBryanRotation( roll, pitch, yaw )
Sets the Tait-Bryan rotation.
arguments:
  1. real roll
  2. real pitch
  3. real yaw

Rotation

this Rotation( angle, x, y, z )
Sets the rotation part of the current transformation.
arguments:
  1. real angle in degres
  2. real x
  3. real y
  4. real z

Rotate

this Rotate( angle, x, y, z )
Apply a rotation to the current ransformation.
arguments:
  1. real angle in degres
  2. real x
  3. real y
  4. real z

RotationX

this RotationX( angle )
Set the rotation around the X axis.
arguments:
  1. real angle in degres

RotationY

this RotationY( angle )
Set the rotation around the Y axis.
arguments:
  1. real angle in degres

RotationZ

this RotationZ( angle )
Set the rotation around the Z axis.
arguments:
  1. real angle in degres

LookAt

this LookAt( x, y, z )
unavailable: need to be fixed.
arguments:
  1. real x
  2. real y
  3. real z

RotateToVector

this RotateToVector( x, y, z )
Apply the (0,0,1)-(x,y,z) angle to the current transformation.

Invert

this Invert()
invert the current transformation.

Product

this Product( newTransformation )
Apply a newTransformation to the current transformation. this = this . new
arguments:
  1. value newTransformation: an Array or an object that supports NIMatrix44Read native interface.

ReverseProduct

this ReverseProduct( otherTransformation )
Apply the current transformation to the otherTransformation and stores the result to the current transformation. this = new . this
arguments:
  1. value otherTransformation: an Array or an object that supports NIMatrix44Read native interface.

TransformVector

void TransformVector( vector )
Transforms the 3D or 4D vector by the current transformation.
arguments:
  1. Array vector

Properties

N operator

real N operator
Get or set a element of the current transformation matrix.
example:
  var t = new Transformation();
  t.Clear();
  t[3] = 1;
  t[7] = 2;
  t[11] = 3;

Native Interface

  • NIMatrix44Read
  • The current transformation matrix.

- top - main -


Sign in to add a comment
Powered by Google Project Hosting