a3dAPI
Class a3dGL4J

a3dAPI.a3dGL4J
All Implemented Interfaces:
a3dRender

public class a3dGL4J
implements a3dRender

This is the hardware gl4java render please note that you can remove this class from the distribution in case you only need the software driver

Author:
Andrea Fasce

Constructor Summary
a3dGL4J()
           
 
Method Summary
 void beginScene()
          call this metodh before starting to send faces
 int createTexture()
          create a new texture
 void deleteTexture(int ID)
          delete texture
 void destroyDevice()
          destroy the device and frees all allocated datas
 void display()
           
 void drawFace(float[] v0, float[] v1, float[] v2, int clip)
          draw a face given it's vertices and clipvalue
 void endScene()
          call this method when you've sent all faces
 java.awt.Component getComponent()
           
 int getHeight()
          returns the height of the screen
 int getWidth()
          returns the width of the rendering screen
 int[][][] grow(int[][][] start)
           
 void init()
           
 void preInit()
           
 void resetDevice()
          reset this device deleting all textures and temporary datas
 void reshape(int width, int height)
           
 void setBackgroundColor(float r, float g, float b)
          sets the background color
 void setBackgroundImage(int[] pix, int width, int height)
          sets the background image
 void setBilinear(boolean bilinear)
           
 void setFilter(int filter)
           
 void setFogActive(boolean flag)
          switch fog on/off
 void setFogLinear(float near, float far, float r, float g, float b)
          switch fog on and create a linear for
 void setKeyCode(java.lang.String key)
          sets the registartion code
 void setPerspective(float fov2, float fov, float near, float far)
          sets the values used by the camera
 void setRenderState(int textureID, boolean gouraud, float rAlpha)
          sets the render state for the rendering of all the next faces
 void setTextureBilinear(int ID, boolean bilinear)
          sets bilinear filtering of a texture
 void setTextureImage(int ID, int[] pix, int width, int height)
          sets the image of a texture
 void update()
           
 

Constructor Detail

a3dGL4J

public a3dGL4J()
Method Detail

getComponent

public java.awt.Component getComponent()

setBackgroundColor

public void setBackgroundColor(float r,
                               float g,
                               float b)
Description copied from interface: a3dRender
sets the background color
Specified by:
setBackgroundColor in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Parameters:
r - red component
g - green component
b - blue component

setBackgroundImage

public void setBackgroundImage(int[] pix,
                               int width,
                               int height)
Description copied from interface: a3dRender
sets the background image
Specified by:
setBackgroundImage in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Parameters:
pix - an array of 0xrrggbb values
width - width of the array
height - height of the array

createTexture

public int createTexture()
Description copied from interface: a3dRender
create a new texture
Specified by:
createTexture in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Returns:
the new id of the texture created

deleteTexture

public void deleteTexture(int ID)
Description copied from interface: a3dRender
delete texture
Specified by:
deleteTexture in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Parameters:
ID - texture ID to delete

setTextureImage

public void setTextureImage(int ID,
                            int[] pix,
                            int width,
                            int height)
Description copied from interface: a3dRender
sets the image of a texture
Specified by:
setTextureImage in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Parameters:
ID - the ID of the texture to modify
pix - an array of 0xrrggbb values
width - width of the array
height - height of the array

setTextureBilinear

public void setTextureBilinear(int ID,
                               boolean bilinear)
Description copied from interface: a3dRender
sets bilinear filtering of a texture
Specified by:
setTextureBilinear in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Parameters:
ID - the ID of the texture
bilinear - true/false to switch bilinear filtering on/off for that texture

setBilinear

public void setBilinear(boolean bilinear)
Specified by:
setBilinear in interface a3dRender

beginScene

public void beginScene()
Description copied from interface: a3dRender
call this metodh before starting to send faces
Specified by:
beginScene in interface a3dRender

endScene

public void endScene()
Description copied from interface: a3dRender
call this method when you've sent all faces
Specified by:
endScene in interface a3dRender

setFilter

public void setFilter(int filter)
Specified by:
setFilter in interface a3dRender

resetDevice

public void resetDevice()
Description copied from interface: a3dRender
reset this device deleting all textures and temporary datas
Specified by:
resetDevice in interface a3dRender

getWidth

public int getWidth()
Description copied from interface: a3dRender
returns the width of the rendering screen
Specified by:
getWidth in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Returns:
width of the screen

getHeight

public int getHeight()
Description copied from interface: a3dRender
returns the height of the screen
Specified by:
getHeight in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Returns:
height of the screen

setFogActive

public void setFogActive(boolean flag)
Description copied from interface: a3dRender
switch fog on/off
Specified by:
setFogActive in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Parameters:
flag - true/false fog on/off

setFogLinear

public void setFogLinear(float near,
                         float far,
                         float r,
                         float g,
                         float b)
Description copied from interface: a3dRender
switch fog on and create a linear for
Specified by:
setFogLinear in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Parameters:
near - near fog plane
far - far fog plane
r - fog red component
g - fog green component
b - fog blue component

setPerspective

public void setPerspective(float fov2,
                           float fov,
                           float near,
                           float far)
Description copied from interface: a3dRender
sets the values used by the camera
Specified by:
setPerspective in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Parameters:
fov - fov of the camera
near - near camera plane
far - far camera plane

setKeyCode

public final void setKeyCode(java.lang.String key)
Description copied from interface: a3dRender
sets the registartion code
Specified by:
setKeyCode in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Parameters:
key - the license code

setRenderState

public void setRenderState(int textureID,
                           boolean gouraud,
                           float rAlpha)
Description copied from interface: a3dRender
sets the render state for the rendering of all the next faces
Specified by:
setRenderState in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Parameters:
textureID - ID of the texture to use or -1 if no texture is used
gouraud - true if the vertices contains color per vertex informations
rAlpha - a float in the range 0-1 to specify the alpha value

drawFace

public void drawFace(float[] v0,
                     float[] v1,
                     float[] v2,
                     int clip)
Description copied from interface: a3dRender
draw a face given it's vertices and clipvalue
Specified by:
drawFace in interface a3dRender
Following copied from interface: a3dAPI.a3dRender
Parameters:
v0 - an array that contains: v0[0],v0[1],v0[2] = x,y,z of the vertices v0[3],v0[4],v0[5] = xr,yr,zr in screen coords v0[6],v0[7],v0[8] = r,g,b for the vertices v0[9],v0[10] = u,v for the vertices

grow

public int[][][] grow(int[][][] start)

preInit

public void preInit()

init

public void init()

reshape

public void reshape(int width,
                    int height)

destroyDevice

public void destroyDevice()
Description copied from interface: a3dRender
destroy the device and frees all allocated datas
Specified by:
destroyDevice in interface a3dRender

update

public void update()

display

public void display()


(C)2000 by Andrea Fasce