Confirmed users
753
edits
No edit summary |
|||
Line 37: | Line 37: | ||
===Exposing the Extension=== | ===Exposing the Extension=== | ||
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. | ||
The file to edit is {{moz-central|content/canvas/src/WebGLContext.cpp}} | The file to edit is {{moz-central|content/canvas/src/WebGLContext.cpp}}. You will also need to add an enum value in WebGLExtensionID in {{moz-central|content/canvas/src/WebGLContext.h}}. | ||
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>): |