Emscripten: glCreateShader()

Created on 1 May 2020  路  4Comments  路  Source: emscripten-core/emscripten

Hi there!
Although working, still calling glCreateShader(GL_FRAGMENT_SHADER); (GLES3/gl3.h) generates (glGetError() ==) GL_INVALID_ENUM (0x0500).
Best,
Szilard

All 4 comments

Hi, make sure you create a window with the correct major and minor gl context versions

....
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
GLFWwindow* window = glfwCreateWindow(620, 480, "WINDOW TITLE", 0, 0);
glfwMakeContextCurrent(window);
....

Here is a template project to help you get started https://github.com/o-micron/IntroToRendering

Hi Omar,
Thanks for getting back to me!
That's exactly what I'm doing. That doesn't seem to be an issue of context creation and in fact, I can get my fragment shader to compile, it's just that the above call to glCreateShader() generates an error.

Sorry, my bad.
It's not the call to glCreateShader(GL_FRAGMENT_SHADER); that generates the error, but a call to glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);. Though I still don't get why this should generate an error, it runs perfectly fine on desktop, too. I'll look into it.
Thanks!

On a side note, don't forget that Emscripten will actually try to map the opengl stuff to webgl2 which is not 100% gles 3.0 but almost identical... you might have enumerations or features not available in webgl2 but available in gles 3.0, so double check that, it might be the problem ..

Was this page helpful?
0 / 5 - 0 ratings