Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

GLCore

cjcliffe edited this page · 5 revisions

CubicVR.GLCore

The GLCore is used to initialize CubicVR to a new Canvas3D/WebGL context, it also maintains state for several global constants.

Methods:

init( gl_in, vs_in, fs_in )

Initialize CubicVR.

Parameters:

  • gl_in : (optional) An existing Canvas3D/WebGL context, a CANVAS element itself or the ID of CANVAS already in the DOM. If not provided, a full-screen canvas is created.
  • vs_in : (optional) A path to the core vertex shader or the ID of a SCRIPT element with src or content already in the DOM. Default: CubicVR_Core.vs.
  • fs_in : (optional) A path to the core fragment shader or the ID of a SCRIPT element with src or content already in the DOM. Default: CubicVR_Core.fs.

Returns:

WebGL context if successful, null if not.

Typical Usage:

function webGLStart() {
   var gl = CubicVR.init();
   var canvas = CubicVR.getCanvas();  

   if (!gl) return;  
   // ...  
}  

Advanced Methods:

setDepthAlpha( state, near, far ) alias: CubicVR.setGlobalDepthAlpha()

Enable/Disable and update the near/far linear depth for using Depth Alpha. When Depth Alpha is enabled the resulting Alpha channel after rendering will contain the depth component in linear form 0.0->1.0 representing near/far planes. This is typically used in conjunction with post-process shaders to provide depth information to Depth-of-Field (DOF), Screen-Space Ambient Occlusion (SSAO) or other effects.

Parameters:

  • state : true or false to enable or disable Depth Alpha respectively.
  • near : the view NEAR clipping plane.
  • far : the view FAR clipping plane.

Returns:

none

setDefaultFilter( filterType ) alias: CubicVR.setDefaultFilter()

Set the default texturing filter type for loading textures.

Parameters:

  • filterType : One of the following CubicVR.enums:
    • CubicVR.enums.texture.filter.LINEAR
    • CubicVR.enums.texture.filter.LINEAR_MIP
    • CubicVR.enums.texture.filter.NEAREST
    • CubicVR.enums.texture.filter.NEAREST_MIP

Returns:

none

Something went wrong with that request. Please try again.