I'm getting a bit confused with all this.

Let's put it simple: I'm writing a WebGL application through Emscripten 
(not doing any Javascript code at all, pure C++), and I want to use the 
fairly new WEBGL_draw_buffers WebGL extension that is available on my 
browser's version.

In theory WEBGL_draw_buffers extension, when written in pure javascript, 
needs to be fetched with a call gl.getExtension('WEBGL_draw_buffers'), 
which returns a function allowing us to do the same as native OpenGL ES 
glDrawBuffers function.

But when I include the GL headers found in the Emscripten folder, I do get 
the glDrawBuffers function, and I can call it in my C++ code, no link error 
either upon Emscripten compilation. I tried it and it *seems* to work, 
since in my fragment shader I can write to gl_FragData[i] as opposed to the 
usual gl_FragColor. It does require me to add #extension 
GL_EXT_draw_buffers : require in my fragment shader at the top to make sure 
the extension is supported, but it all *seems* to work?

Can anyone explain me what is happening under the hood because I'm a bit 
confused. Perhaps we don't need any change to Emscripten at all as it is?


On Tuesday, August 26, 2014 7:21:24 PM UTC-4, msc wrote:
>
>  On 2014/08/26 15:47, Alon Zakai wrote:
>  
>  Oh, so in normal non-WebGL GL, there isn't a method to enable an 
> extension? 
>  
> Correct.
>
>  They are all enabled by default?
>  
> Yes. 
>
>  Then yes, it sounds like we need to add an option to enable an 
> extension, emscripten_enable_webgl_ext(const char*) or such. I'm surprised 
> we didn't run into this before. I think emscripten might already be 
> enabling some extensions by default, that sounds familiar.
>
>   Yes I think this option is needed.
>
> In native OpenGL {,ES} the tokens are all defined in the .h files so can 
> be used in code without any additional checks. Function pointers are also 
> defined. To use an extension that does not add any functions, the 
> application simply uses it, preferably checking for its existence first. 
> For extensions that add functions, the app queries the function pointer 
> values setting those into the existence function pointer variables.
>
> In WebGL a call to getExtension, which is defined as "object? 
> getExtension(DOMString name", returns an object which contains any 
> constants or functions defined by the extension. This has to be reconciled 
> with the native OpenGL way of doing things.
>  
> Regards
>
>     -Mark
> -- 
>  注意:この電子メールには、株式会社エイチアイの機密情報が含まれている場合が有ります。正式なメール受信者では無い場合はメール複製、 
> 再配信または情報の使用を固く禁じております。エラー、手違いでこのメールを受け取られましたら削除を行い配信者にご連絡をお願いいたし ます. 
>
> NOTE: This electronic mail message may contain confidential and privileged 
> information from HI Corporation. If you are not the intended recipient, any 
> disclosure, photocopying, distribution or use of the contents of the 
> received information is prohibited. If you have received this e-mail in 
> error, please notify the sender immediately and permanently delete this 
> message and all related copies. 
>  

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to