Regal GL

220 views
Skip to first unread message

caiiiycuk

unread,
Jan 25, 2017, 10:45:35 AM1/25/17
to emscripten-discuss
Hi! I want to try build project against regal gl. I does not found any success story how to do this. I successfully build project against Regal in native environment. After that I compile regal with emscripten without any problem. So, for now I have static libraries libRegalGLUT.a libRegallib.a. I can`t understand how I can disable build in opengl support.

And I have linking errors:
warning: unresolved symbol: glColor4ub
warning: unresolved symbol: glClipPlanef
warning: unresolved symbol: glPopMatrix
warning: unresolved symbol: glFogf
warning: unresolved symbol: glScalef
warning: unresolved symbol: glPointParameterfv
warning: unresolved symbol: glLoadMatrixf
warning: unresolved symbol: glTranslatef
warning: unresolved symbol: glFrustumf
warning: unresolved symbol: glDisableClientState
warning: unresolved symbol: glPointParameterf
warning: unresolved symbol: glAlphaFunc
warning: unresolved symbol: glFogfv
warning: unresolved symbol: glTexCoordPointer
warning: unresolved symbol: glColor4f
warning: unresolved symbol: glMultMatrixf
warning: unresolved symbol: glPointSize
warning: unresolved symbol: glTexEnvf
warning: unresolved symbol: glTexEnvi
warning: unresolved symbol: glEnableClientState
warning: unresolved symbol: glClientActiveTexture
warning: unresolved symbol: glColorPointer
warning: unresolved symbol: glPushMatrix

But I already added libRegallib.a to build stage, and as I can see this static lib contains at least glTexEnvf:

>> llvm-nm libRegallib.a | grep glTexEnvf

00000000000085f0 T glTexEnvf
0000000000008680 T glTexEnvfv
                 U glTexEnvf
                 U glTexEnvfv
0000000000007070 T plugin_glTexEnvf
00000000000070f0 T plugin_glTexEnvfv

So, I can`t understand why glTexEnvf is unresolver

caiiiycuk

unread,
Jan 25, 2017, 10:46:40 AM1/25/17
to emscripten-discuss
*  I can`t understand how I can disable built in opengl support.

Jukka Jylänki

unread,
Jan 25, 2017, 1:54:02 PM1/25/17
to emscripte...@googlegroups.com
You don't want to disable built-in OpenGL when building with Regal, because Regal will tack on top of OpenGL ES 2.0. But you should build code without -s LEGACY_GL_EMULATION=1 linker flag, because when using Regal, Emscripten provided legacy GL emulation features are not needed. It could be the case that Regal needs more complete GLES2 options, in which case try building with -s FULL_ES2=1.

Try checking the link order of the -l items for Regal (or try using a link group). The order of the link items matters on command line, and this looks like perhaps they were specified in the wrong order. It is possible to specify items multiple times, so you can try duplicating the link files twice, i.e. try passing -lyourcode -lRegalGLUT -lRegallib -lyourcode -lRegalGLUT -lRegallib.

2017-01-25 17:46 GMT+02:00 caiiiycuk <caii...@gmail.com>:
*  I can`t understand how I can disable built in opengl support.

--
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-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

caiiiycuk

unread,
Jan 26, 2017, 7:26:21 AM1/26/17
to emscripten-discuss
Ok, I found where problem is. Regal should be compiled to emscripten with special options, I use this command:

emmake make -f Makefile SYSTEM=emscripten

After that, in lib folder of Regal you can find static libs for emscripten. This libs contains rgl* methods that replace original opengl api. So, I add GL/Regal.h and compile my project again. Project was builded without any error. But when I run it in browser I does not see anything, just black screen and no errors. This project renders graphics correctly without regal on LEGACY_GL_EMULATION=1, so I think that project code is fine and problem is in integration of regal into emscripten.

I try to use all flags LEGACY_GL_EMULATION=1 | FULL_ES2=1 | FULL_ES3 = 1 results are same - black screen. Funny thing that Regal use  LEGACY_GL_EMULATION=1 to build itself. I can`t understand how I can found where problem is. Any ideas?

Also I try to build project without linking Regal libs, only with headers, and when I run program then I have this errors:

xception thrown: ReferenceError: GL is not defined,ReferenceError: GL is not defined
    at Object.createContext
    at _glutCreateWindow
    at Object._main
    at Object.callMain
    at doRun

Александр Гурьянов

unread,
Jan 27, 2017, 5:56:39 AM1/27/17
to emscripte...@googlegroups.com
Finally, I integrate regal gl into emscripten. You should call RegalMakeCurrent((RegalSystemContext)1); to associate emscripten gl context with regal gl context. Like this:

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowPosition(0, 0);
    glutInitWindowSize(width, height);
    glutCreateWindow("app");

    RegalMakeCurrent((RegalSystemContext)1);

    glutDisplayFunc(draw);

Now in logs I see that regal gl do the job, it is rendering the game scenes. However, I don`t see anything, I think it is because this errors:

    [.Offscreen-For-WebGL-0x3d6b0c429c00]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 0

Also regal report about non supported features:

    warning  | Regal does not support glClientActiveTexture for ES 2.0 - skipping.
    warning  | glDisable does not support GL_POINT_SPRITE for ES 2.0.
    warning  | Regal does not support glClientActiveTexture for ES 2.0 - skipping.

More over I build myproject+regal in native enviroment in force ES2.0 mode, and I see many graphical artifacts in rendering.

Regarding to emscripten docs:

    You can consider building the codebase against the Regal Desktop OpenGL emulation library. That project offers a more complete set of emulated Desktop OpenGL features on top of OpenGL ES 2.0. 

I think that this statement is incorrect, built-in LEGACY_GL_EMULATION is much better that emulation from regal. At least it works.


--
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-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
С уважением, Гурьянов Александр

Alon Zakai

unread,
Jan 27, 2017, 7:17:06 PM1/27/17
to emscripten-discuss
Thanks for the update. I edited those docs now to be less optimistic about regal. Too bad it doesn't work better. Sadly the regal repo doesn't show much activity in recent years either (unless development moved somewhere else?).

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

For more options, visit https://groups.google.com/d/optout.
--
С уважением, Гурьянов Александр

Jukka Jylänki

unread,
Jan 27, 2017, 10:52:04 PM1/27/17
to emscripte...@googlegroups.com
Vlad Vukicevic worked on getting Regal working some years ago, as did Chad Austin. Their forks can be found at https://github.com/vvuk/regal/commits/master and https://github.com/chadaustin/regal/commits/master. I do remember running some simple working demos from both of them. Chad had ported some AngelCode GL tutorials iirc. Perhaps one of those repos might have fixes that are needed. Regarding the error, I think it might be necessary to link with -s FULL_ES2=1, because Regal might expect to be able to render from client side arrays.

Sad to see about the Regal nonsupported features though, perhaps it's not that complete as we thought. 
Reply all
Reply to author
Forward
0 new messages