OpenGL legacy emulation doesn't seem to work?

278 views
Skip to first unread message

Sasha Fonseca

unread,
Nov 19, 2013, 9:30:59 AM11/19/13
to emscripte...@googlegroups.com
Hello, I'm trying a few tests for a program I'm developing. I coded a few tests and tried to convert them to JavaScript with Emscripten. A few of those worked but some others did not. I looked around and found the option -s LEGACY_GL_EMULATION=1. I added this to the command but it didn't help. I'm not sure if this is simply missing in the converter or if I'm missing something myself. I'll attach two of the tests I'm failing to convert to JavaScript.

The command I'm running is: ./emcc <pathToFile>/<file>.c -s LEGACY_GL_EMULATION=1 -o test.html and my system runs Fedora 19 with and old ATi card (HD4000 series). Thank you for your time.


lesson4.c
lesson1-5teste.c

Alon Zakai

unread,
Nov 19, 2013, 1:44:14 PM11/19/13
to emscripte...@googlegroups.com
Do you get a compilation error, runtime error, invalid or unexpected output, or something else?

- Alon



On Tue, Nov 19, 2013 at 6:30 AM, Sasha Fonseca <sash...@gmail.com> wrote:
Hello, I'm trying a few tests for a program I'm developing. I coded a few tests and tried to convert them to JavaScript with Emscripten. A few of those worked but some others did not. I looked around and found the option -s LEGACY_GL_EMULATION=1. I added this to the command but it didn't help. I'm not sure if this is simply missing in the converter or if I'm missing something myself. I'll attach two of the tests I'm failing to convert to JavaScript.

The command I'm running is: ./emcc <pathToFile>/<file>.c -s LEGACY_GL_EMULATION=1 -o test.html and my system runs Fedora 19 with and old ATi card (HD4000 series). Thank you for your time.


--
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 emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Sasha Fonseca

unread,
Nov 19, 2013, 2:55:35 PM11/19/13
to emscripte...@googlegroups.com
No, it does everything just fine doesn't give any kind of output. I then run the generated .html file in Firefox. I get the correct background color like in the original program, but I don't get the objects rendered (or at least showing).

Thank you
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.

Alon Zakai

unread,
Nov 19, 2013, 4:17:50 PM11/19/13
to emscripte...@googlegroups.com
Running it, it shows some errors and exceptions in the web console:

"TODO: glShadeModel" a.html:61
uncaught exception: unsupported immediate mode 9

which I guess are current limitations of our GL emulation code.

An alternative is to use Regal GL emulation, at one point it was usable but recently I have heard it needs some fixing.

- Alon



To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.

Mark Callow

unread,
Nov 19, 2013, 9:12:54 PM11/19/13
to emscripte...@googlegroups.com

Speaking of legacy emulation, are OpenGL ES client-side arrays supposed to work? I had an app using them and I got WebGL errors from vertexAttribPointer no buffer objects were bound. I would expect these when using WebGL directly.

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.

Alon Zakai

unread,
Nov 19, 2013, 10:34:36 PM11/19/13
to emscripte...@googlegroups.com
- Alon



--

Sasha Fonseca

unread,
Nov 20, 2013, 11:08:29 AM11/20/13
to emscripte...@googlegroups.com
So Alon, would you say in order to get a running OpenGL interface in my program I should start looking into OpenGL 3.0+? Will it be guaranteed to work with Emscripten? Or should I start looking into OpenGL ES (which I really don't know anything about)?

Thanks

Jukka Jylänki

unread,
Nov 20, 2013, 11:40:47 AM11/20/13
to emscripte...@googlegroups.com
Hi Sasha,

OpenGL3.0+ is not supported in Emscripten. GL3 is much closer to GLES2 than old GL2 was, so you will be able to share a lot of the GL code when targeting GL3 or GLES2, but GL3 has generally more stuff than GLES2, and they both have different extension registryes (and WebGL has its own extension registry as well). Aside from the extra features and extensions, the differences between GLES2 and GL3 are small ones you can generally #ifdef around, so if you know GL3, you pretty much know GLES2 already.

WebGL is more or less equal to GLES2, except for these differences enumerated in the spec: http://www.khronos.org/registry/webgl/specs/latest/1.0/#6 . When you do GL in Emscripten, think of it as GLES2, but taking into account the restrictions in that link. The compiler option -s FULL_ES2=1 tries to overcome some of those restrictions, namely the lack of rendering from client-side memory, which of course has its performance implications.

Very roughly said (please don't nit on this), WebGL is a subset of GLES2, which in turn is a subset of GL3, so if you start writing a GL3 desktop codebase that only uses the features that are also present in GLES2 and takes into account the limitations in the link above, you'll have a single renderer codebase that quite well works on each of the three apis.

The big differences are in context creation and window management, and you'll have to write that separately for each platform you target. Currently Emscripten supports SDL, GLUT and EGL for that task. On desktop you'll use low-level GLX, WGL, EAGL or CoreGL for that task, or a high-level library like SDL, GLUT, GLEW, GLFW, or so on. If you are planning on targeting Android, using EGL might be preferred, since Android NDK has EGL as well.

   Jukka


2013/11/20 Sasha Fonseca <sash...@gmail.com>

--

Sasha Fonseca

unread,
Nov 20, 2013, 1:14:20 PM11/20/13
to emscripte...@googlegroups.com
Thank your for your answer Jukka. The program I'm writing is a logic game using a graph and the graphical interface is pretty much just to make it easier to play and visualize what is happening. I really don't need anything fancy or complicated just a simple 2D graph will do. So I guess this will be easy to achieve in OpenGL 3.0+ and Emscripten should convert it just fine with ES support?

Thank you


--
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/sxqOijBu5jU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages