Support OpenGL ES 3.0 building on Web
For some reason, the equivalent requested context (WebGL 2.0) is not provided, despite being properly requested.
This commit is contained in:
parent
b40f93b9e3
commit
807516a991
2 changed files with 14 additions and 8 deletions
|
@ -45,6 +45,8 @@
|
|||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#define GLFW_INCLUDE_NONE // Disable the standard OpenGL header inclusion on GLFW3
|
||||
// NOTE: Already provided by rlgl implementation (on glad.h)
|
||||
#include "GLFW/glfw3.h" // GLFW3: Windows, OpenGL context and Input management
|
||||
|
||||
#include <emscripten/emscripten.h> // Emscripten functionality for C
|
||||
|
@ -759,6 +761,7 @@ int InitPlatform(void)
|
|||
}
|
||||
else if (rlGetVersion() == RL_OPENGL_ES_30) // Request OpenGL ES 3.0 context
|
||||
{
|
||||
// TODO: It seems WebGL 2.0 context is not set despite being requested
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
|
||||
|
|
11
src/rlgl.h
11
src/rlgl.h
|
@ -802,7 +802,11 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
|||
#include "external/glad.h" // GLAD extensions loading library, includes OpenGL headers
|
||||
#endif
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||
#if defined(GRAPHICS_API_OPENGL_ES3)
|
||||
#include <GLES3/gl3.h> // OpenGL ES 3.0 library
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GLES2/gl2ext.h> // OpenGL ES 2.0 extensions library
|
||||
#elif defined(GRAPHICS_API_OPENGL_ES2)
|
||||
// NOTE: OpenGL ES 2.0 can be enabled on PLATFORM_DESKTOP,
|
||||
// in that case, functions are loaded from a custom glad for OpenGL ES 2.0
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_DESKTOP_SDL)
|
||||
|
@ -823,9 +827,6 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
|||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor);
|
||||
#endif
|
||||
#endif
|
||||
#if defined(GRAPHICS_API_OPENGL_ES3)
|
||||
#include <GLES3/gl3.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h> // Required for: malloc(), free()
|
||||
#include <string.h> // Required for: strcmp(), strlen() [Used in rlglInit(), on extensions loading]
|
||||
|
@ -902,9 +903,11 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
|||
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||
#define glClearDepth glClearDepthf
|
||||
#if !defined(GRAPHICS_API_OPENGL_ES3)
|
||||
#define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER
|
||||
#define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Default shader vertex attribute names to set location points
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue