Platform/GFX/WebGL/Contribute/Extensions: Difference between revisions

Jump to navigation Jump to search
Line 59: Line 59:


===Exposing the Extension===
===Exposing the Extension===
Files to be modified in this section:
* {{moz-central|content/canvas/src/WebGLContext.cpp}}
* {{moz-central|content/canvas/src/WebGLContext.h}}
These files may also have to be modified:
* {{moz-central|gfx/gl/GLContext.h}}
* {{moz-central|gfx/gl/GLContext.cpp}}


Now let's do the work to actually expose this extension, in WebGL <code>getExtension</code> and <code>getSupportedExtensions</code> methods.
Now let's do the work to actually expose this extension, in WebGL <code>getExtension</code> and <code>getSupportedExtensions</code> methods.
Line 65: Line 73:
The functions exposed to scripts are <code>WebGLContext::GetExtension</code> and <code>WebGLContext::GetSupportedExtensions</code>. They call another internal function that you'll have to edit as well: <code>WebGLContext::IsExtensionSupported</code>. That's where you'll have to decide whether this extension is supported or not by the client. If you have to query the <code>GL_EXTENSIONS</code> string of the underlying OpenGL context, call <code>gl->IsExtensionSupported(enum value)</code>. Indeed, we are checking for a list of extensions when we create a OpenGL context, so that subsequent checking for them is really fast. If the OpenGL extensions you need to check for haven't yet been added to the list that we check for, you'll have to edit these files in a straightforward way (search for <code>IsExtensionSupported</code>):
The functions exposed to scripts are <code>WebGLContext::GetExtension</code> and <code>WebGLContext::GetSupportedExtensions</code>. They call another internal function that you'll have to edit as well: <code>WebGLContext::IsExtensionSupported</code>. That's where you'll have to decide whether this extension is supported or not by the client. If you have to query the <code>GL_EXTENSIONS</code> string of the underlying OpenGL context, call <code>gl->IsExtensionSupported(enum value)</code>. Indeed, we are checking for a list of extensions when we create a OpenGL context, so that subsequent checking for them is really fast. If the OpenGL extensions you need to check for haven't yet been added to the list that we check for, you'll have to edit these files in a straightforward way (search for <code>IsExtensionSupported</code>):


*{{moz-central|gfx/gl/GLContext.h}}
* {{moz-central|gfx/gl/GLContext.h}}
*{{moz-central|gfx/gl/GLContext.cpp}}
* {{moz-central|gfx/gl/GLContext.cpp}}


===Implementing the Extension===
===Implementing the Extension===
Confirmed users
753

edits

Navigation menu