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

Jump to navigation Jump to search
Line 75: Line 75:


===Implementing the Extension===
===Implementing the Extension===
Files that will typically have to be modified in this section (this depends on the extension):
* {{moz-central|content/canvas/src/WebGLContextGL.cpp}}
* {{moz-central|content/canvas/src/WebGLContextGLValidate.cpp}}
* {{moz-central|gfx/gl/GLDefs.h}}
* Any of the above .cpp or .h files
Finally, let's implement what this extension actually does. The spec describes that.
Finally, let's implement what this extension actually does. The spec describes that.
The file you have to edit to do that, is {{moz-central|content/canvas/src/WebGLContextGL.cpp}}, though you might also need to make some more edits to <code>GLContext</code>, or elsewhere in <code>WebGLContext</code>.


Sometimes, what this extension does is modify the behavior of some existing methods, it should be straightforward to see what to do there. The only thing is that you'll need to use these new symbolic constants, like <code>TEXTURE_MAX_ANISOTROPY</code>. Rather than trying to use the constants from the extension class, add #defines for them in {{moz-central|gfx/gl/GLDefs.h}}.
If the extension modifies the behavior of one of the standard WebGL context methods, you will probably have to modify {{moz-central|content/canvas/src/WebGLContextGL.cpp}} as that is where these methods are implemented. You might also need to make some more edits to {{moz-central|content/canvas/src/WebGLContextGLValidate.cpp}}, or to other files in this directory, or to <code>gfx/gl/GLContext.*</code>.
(Notice we use <code>LOCAL_GL_</code> prefixes there to avoid some conflicts)
 
Sometimes, while implementing a WebGL extension, you need a new GL symbolic constant, like <code>TEXTURE_MAX_ANISOTROPY</code>. To achieve this, add #defines for them in {{moz-central|gfx/gl/GLDefs.h}}. Notice we use <code>LOCAL_GL_</code> prefixes there to avoid some conflicts.


===Adding Tests===
===Adding Tests===
Confirmed users
753

edits

Navigation menu