-
Notifications
You must be signed in to change notification settings - Fork 103
GLCore
cjcliffe edited this page Oct 15, 2011
·
5 revisions
The GLCore is used to initialize CubicVR to a new Canvas3D/WebGL context, it also maintains state for several global constants.
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;
// ...
}
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
orfalse
to enable or disable Depth Alpha respectively. -
near
: the view NEAR clipping plane. -
far
: the view FAR clipping plane.
Returns:
none
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