Set correct includes for ES3 support, fix GL_HALF_FLOAT with custom define
This commit is contained in:
parent
c147ab51c9
commit
c49dbac134
|
|
@ -58,7 +58,9 @@ if (${PLATFORM} MATCHES "Desktop")
|
||||||
|
|
||||||
elseif (${PLATFORM} MATCHES "Web")
|
elseif (${PLATFORM} MATCHES "Web")
|
||||||
set(PLATFORM_CPP "PLATFORM_WEB")
|
set(PLATFORM_CPP "PLATFORM_WEB")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
if(NOT DEFINED GRAPHICS)
|
||||||
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||||
|
endif()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 --profiling")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 --profiling")
|
||||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -290,8 +290,12 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_WEB)
|
#if defined(PLATFORM_WEB)
|
||||||
#define GLFW_INCLUDE_ES2 // GLFW3: Enable OpenGL ES 2.0 (translated to WebGL)
|
#if defined(GRAPHICS_API_OPENGL_ES3)
|
||||||
//#define GLFW_INCLUDE_ES3 // GLFW3: Enable OpenGL ES 3.0 (transalted to WebGL2?)
|
#define GLFW_INCLUDE_ES3 // GLFW3: Enable OpenGL ES 3.0 (transalted to WebGL2?)
|
||||||
|
#else
|
||||||
|
#define GLFW_INCLUDE_ES2 // GLFW3: Enable OpenGL ES 2.0 (translated to WebGL)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "GLFW/glfw3.h" // GLFW3: Windows, OpenGL context and Input management
|
#include "GLFW/glfw3.h" // GLFW3: Windows, OpenGL context and Input management
|
||||||
#include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX
|
#include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX
|
||||||
|
|
||||||
|
|
|
||||||
18
src/rlgl.h
18
src/rlgl.h
|
|
@ -799,8 +799,11 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
||||||
#define GLAD_GL_IMPLEMENTATION
|
#define GLAD_GL_IMPLEMENTATION
|
||||||
#include "external/glad.h" // GLAD extensions loading library, includes OpenGL headers
|
#include "external/glad.h" // GLAD extensions loading library, includes OpenGL headers
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_ES3) && defined(PLATFORM_WEB)
|
||||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
#include <GLES3/gl3.h>
|
||||||
|
//#include "external/glad_gles3.h"
|
||||||
|
#endif
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_ES2) //&& !defined(GRAPHICS_API_OPENGL_ES3)
|
||||||
// NOTE: OpenGL ES 2.0 can be enabled on PLATFORM_DESKTOP,
|
// 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
|
// in that case, functions are loaded from a custom glad for OpenGL ES 2.0
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
|
@ -897,8 +900,10 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
#define glClearDepth glClearDepthf
|
#define glClearDepth glClearDepthf
|
||||||
#define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER
|
#if !defined(GRAPHICS_API_OPENGL_ES3) //These macros are defined in gl3.h
|
||||||
#define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER
|
#define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER
|
||||||
|
#define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Default shader vertex attribute names to set location points
|
// Default shader vertex attribute names to set location points
|
||||||
|
|
@ -1037,7 +1042,7 @@ typedef void *(*rlglLoadProc)(const char *name); // OpenGL extension functions
|
||||||
static rlglData RLGL = { 0 };
|
static rlglData RLGL = { 0 };
|
||||||
#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2
|
#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_ES2) && !(defined(GRAPHICS_API_OPENGL_ES3) && defined(PLATFORM_WEB)) //ES3 should provide its own implementation
|
||||||
// NOTE: VAO functionality is exposed through extensions (OES)
|
// NOTE: VAO functionality is exposed through extensions (OES)
|
||||||
static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays = NULL;
|
static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays = NULL;
|
||||||
static PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray = NULL;
|
static PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray = NULL;
|
||||||
|
|
@ -1048,6 +1053,9 @@ static PFNGLDRAWARRAYSINSTANCEDEXTPROC glDrawArraysInstanced = NULL;
|
||||||
static PFNGLDRAWELEMENTSINSTANCEDEXTPROC glDrawElementsInstanced = NULL;
|
static PFNGLDRAWELEMENTSINSTANCEDEXTPROC glDrawElementsInstanced = NULL;
|
||||||
static PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisor = NULL;
|
static PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisor = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef GL_HALF_FLOAT
|
||||||
|
#define GL_HALF_FLOAT 0x140B
|
||||||
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module specific Functions Declaration
|
// Module specific Functions Declaration
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user