Hi, I'm trying to get the basics of creating a GL context working by using
GLFW to setup windows etc.
However, when I run the code generated by emcc (1.30.0), I get the
following exception errors:
"exception thrown: ReferenceError: GL is not
> defined,Browser.createContext@file:///Users/igloomedialtd/emsdk_portable/emscripten/1.30.0/glfwTest.js:6389:11
>
> GLFW.createWindow@file:///Users/igloomedialtd/emsdk_portable/emscripten/1.30.0/glfwTest.js:5960:24
>
> _glfwOpenWindow@file:///Users/igloomedialtd/emsdk_portable/emscripten/1.30.0/glfwTest.js:6031:7
>
> __Z6initGLv@file:///Users/igloomedialtd/emsdk_portable/emscripten/1.30.0/glfwTest.js:6971:10
>
> _main@file:///Users/igloomedialtd/emsdk_portable/emscripten/1.30.0/glfwTest.js:6993:3
>
> asm._main@file:///Users/igloomedialtd/emsdk_portable/emscripten/1.30.0/glfwTest.js:10431:8
>
> callMain@file:///Users/igloomedialtd/emsdk_portable/emscripten/1.30.0/glfwTest.js:10550:15
>
> doRun@file:///Users/igloomedialtd/emsdk_portable/emscripten/1.30.0/glfwTest.js:10608:42
>
> run/<@file:///Users/igloomedialtd/emsdk_portable/emscripten/1.30.0/glfwTest.js:10619:7
> " glfwTest.html:1245:12
> Module.printErr() glfwTest.html:1245
> callMain() glfwTest.js:10566
> doRun() glfwTest.js:10608
> run/<() glfwTest.js:10619
>
> ReferenceError: GL is not defined
>
I've attached the file I'm trying to build with this post.
I'd be really grateful if anyone could take a look and let me know if I've
done anything wrong?
Cheers!
--
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.
#include<stdio.h>
#include<stdlib.h>
#include<GLES2/gl2.h>
#include<GL/glfw.h>
#include<emscripten/emscripten.h>
int init_gl()
{
const int width = 480,
height = 800;
if (glfwInit() != GL_TRUE) {
printf("glfwInit() failed\n");
return GL_FALSE;
}
if (glfwOpenWindow(width, height, 8, 8, 8, 8, 16, 0, GLFW_WINDOW) != GL_TRUE) {
printf("glfwOpenWindow() failed\n");
return GL_FALSE;
}
return GL_TRUE;
}
void do_frame()
{
glfwSwapBuffers();
}
void shutdown_gl()
{
glfwTerminate();
}
//MAIN FUNCTION
int main() {
printf("hello GL test\n");
if (init_gl() == GL_TRUE) {
printf("initGL was true!\n");
//on_surface_created();
//on_surface_changed();
emscripten_set_main_loop(do_frame, 0, 1);
} else {
printf("could not init GL\n");
}
shutdown_gl();
return 0;
}