libgpac
Documentation of the core library of GPAC
WebGLContext Interface Reference

import"webgl.idl";

+ Inheritance diagram for WebGLContext:
+ Collaboration diagram for WebGLContext:

Public Member Functions

 WebGLContext (unsigned long width, unsigned long height, WebGLContextAttributes context_attributes)
 
 WebGLContext (Object canvas_obj, WebGLContextAttributes context_attributes)
 
void activate (boolean activate)
 
void resize (unsigned long width, unsigned long height)
 
void texImage2D (GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, Texture source)
 
void texImage2D (GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, FilterPacket source)
 
NamedTexture createTexture (DOMString name, optional VideoColorConfig vcfg=null)
 
void bindTexture (GLenum target, NamedTexture texture)
 
DOMString textureName (NamedTexture texture)
 
sequence< DOMString > getSupportedExtensions (optional boolean use_gl_exts=false)
 

Detailed Description

Extensions for GPAC WebGL

Constructor & Destructor Documentation

◆ WebGLContext() [1/2]

WebGLContext::WebGLContext ( unsigned long  width,
unsigned long  height,
WebGLContextAttributes  context_attributes 
)

creates a new WebGL context

Parameters
widththe target width in pixels of the drawing buffer
heightthe target height in pixels of the drawing buffer
context_attributesthe context attributes as defined by WebGL (see https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.2)

◆ WebGLContext() [2/2]

WebGLContext::WebGLContext ( Object  canvas_obj,
WebGLContextAttributes  context_attributes 
)

creates a new WebGL context (mainly defined for future canvas simulation)

Parameters
canvas_objan object exposing "width" and "height" properties
context_attributesthe context attributes as defined by WebGL (see https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.2)

Member Function Documentation

◆ activate()

void WebGLContext::activate ( boolean  activate)

activate or deactivate a WebGL context

Parameters
activateif true, binds the associated frame buffer. If false, unbinds it

◆ resize()

void WebGLContext::resize ( unsigned long  width,
unsigned long  height 
)

resize the underlying frame buffer to the indicated size

Parameters
widthnew width in pixels
heightnew height in pixels

◆ texImage2D() [1/2]

void WebGLContext::texImage2D ( GLenum  target,
GLint  level,
GLint  internalformat,
GLenum  format,
GLenum  type,
Texture  source 
)

uploads the content of the EVG Texture to the bound texture. The bound texture can be a WebGLTexture or a NamedTexture

Parameters
targetignored, default to gl.TEXTURE_2D
leveltarget same as regular texImage2D
internalformatignored, overloaded during upload based on input data
formatignored, overloaded during upload based on input data
typeignored, overloaded during upload based on input data
sourcethe source Texture to use

◆ texImage2D() [2/2]

void WebGLContext::texImage2D ( GLenum  target,
GLint  level,
GLint  internalformat,
GLenum  format,
GLenum  type,
FilterPacket  source 
)

uploads the content of the FilterPacket to the bound texture. The bound texture shall be a NamedTexture

Parameters
targetignored, default to gl.TEXTURE_2D
leveltarget same as regular texImage2D
internalformatignored, overloaded during upload based on input data
formatignored, overloaded during upload based on input data
typeignored, overloaded during upload based on input data
sourcethe source FilterPacket to use

◆ createTexture()

NamedTexture WebGLContext::createTexture ( DOMString  name,
optional VideoColorConfig  vcfg = null 
)

creates a named texture

Parameters
namethe name of the texture - if null, generates name
vcfgvideo config options - if null, default are assumed (everything unspecified, no full range)
Returns
a new named texture

◆ bindTexture()

void WebGLContext::bindTexture ( GLenum  target,
NamedTexture  texture 
)
Parameters
targetignored, default to gl.TEXTURE_2D
texturethe named texture to bind, or null to unbind textures

◆ textureName()

DOMString WebGLContext::textureName ( NamedTexture  texture)

get the name of a named texture

Parameters
texturetarget named texture
Returns
name of texture

◆ getSupportedExtensions()

sequence<DOMString> WebGLContext::getSupportedExtensions ( optional boolean  use_gl_exts = false)
Parameters
use_gl_extsif true, queries all extensions supported by the underlying OpenGL implementation. Otherwise, queries only supported WebGL extensions (none at the moment)
Returns
an array of strings, each entry being the name of a supported extension