Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libraries/glfw.c3l/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"provides": "glfw",
"targets" : {
"emscripten" : {
"link-args" : [],
"dependencies" : [],
"linked-libraries" : []
},
"macos-x64" : {
"link-args" : [],
"dependencies" : [],
Expand Down
28 changes: 20 additions & 8 deletions libraries/opengl.c3l/gl.c3
Original file line number Diff line number Diff line change
Expand Up @@ -13734,12 +13734,24 @@ fn void load_all_gl(GLLoadFn load, int version) {

fn int load_gl_internal(GLLoadFn load)
{
getIntegerv = load("glGetIntegerv");
if (getIntegerv == null) return 0;
int major, minor;
getIntegerv((GLenum)GL_MAJOR_VERSION, &major);
getIntegerv((GLenum)GL_MINOR_VERSION, &minor);
int version = (major * 10) + minor;
load_all_gl(load, version);
return version;
getIntegerv = load("glGetIntegerv");
if (getIntegerv == null) return 0;
int major, minor;
getIntegerv((GLenum)GL_MAJOR_VERSION, &major);
getIntegerv((GLenum)GL_MINOR_VERSION, &minor);
// Treating WebGL 2.0 like OpenGL 3.3 in order to load as many of the
// functions defined for WebGL 2.0 as possible. Not all OpenGL 3.1 to 3.3
// functions are supported in WebGL 2.0, but there is overlap.
if (major == 3 && minor == 0)
{
getString = load("glGetString");
String version_str = ((ZString)getString((GLenum)GL_VERSION)).str_view();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment like "Treat WebGL 2.0 as OpenGL 3.3"

if (version_str.contains("WebGL 2.0"))
{
minor = 3;
}
}
int version = (major * 10) + minor;
load_all_gl(load, version);
return version;
}
5 changes: 5 additions & 0 deletions libraries/opengl.c3l/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"provides" : "opengl",
"targets" : {
"emscripten" : {
"link-args" : [],
"dependencies" : [],
"linked-libraries" : []
},
"freebsd-x64" : {
"link-args" : [],
"dependencies" : [],
Expand Down
Loading