mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
gl_engine: dynamic load GL functions with glad
This commit is contained in:
parent
d5125bd839
commit
3c5034e145
6 changed files with 27925 additions and 9 deletions
|
@ -348,7 +348,8 @@ struct GlWindow : Window
|
||||||
//Free in the reverse order of their creation.
|
//Free in the reverse order of their creation.
|
||||||
delete(canvas);
|
delete(canvas);
|
||||||
canvas = nullptr;
|
canvas = nullptr;
|
||||||
|
// terminate engine before SDL context destruction
|
||||||
|
tvg::Initializer::term(tvg::CanvasEngine::Gl);
|
||||||
SDL_GL_DeleteContext(context);
|
SDL_GL_DeleteContext(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
source_file = [
|
source_file = [
|
||||||
|
'tvgGl.cpp',
|
||||||
|
'tvgGl.h',
|
||||||
'tvgGlCommon.h',
|
'tvgGlCommon.h',
|
||||||
'tvgGlGpuBuffer.h',
|
'tvgGlGpuBuffer.h',
|
||||||
'tvgGlList.h',
|
'tvgGlList.h',
|
||||||
|
@ -55,7 +57,6 @@ endif
|
||||||
|
|
||||||
engine_dep += [declare_dependency(
|
engine_dep += [declare_dependency(
|
||||||
compile_args : gl_target_profile,
|
compile_args : gl_target_profile,
|
||||||
dependencies : gl_dep,
|
|
||||||
include_directories : include_directories('.'),
|
include_directories : include_directories('.'),
|
||||||
sources : source_file,
|
sources : source_file,
|
||||||
)]
|
)]
|
||||||
|
|
11972
src/renderer/gl_engine/tvgGl.cpp
Normal file
11972
src/renderer/gl_engine/tvgGl.cpp
Normal file
File diff suppressed because it is too large
Load diff
15943
src/renderer/gl_engine/tvgGl.h
Normal file
15943
src/renderer/gl_engine/tvgGl.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -25,17 +25,11 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include "tvgGl.h"
|
||||||
#if defined (THORVG_GL_TARGET_GLES)
|
#if defined (THORVG_GL_TARGET_GLES)
|
||||||
#include <GLES3/gl3.h>
|
|
||||||
#define TVG_REQUIRE_GL_MAJOR_VER 3
|
#define TVG_REQUIRE_GL_MAJOR_VER 3
|
||||||
#define TVG_REQUIRE_GL_MINOR_VER 0
|
#define TVG_REQUIRE_GL_MINOR_VER 0
|
||||||
#else
|
#else
|
||||||
#if defined(__APPLE__) || defined(__MACH__)
|
|
||||||
#include <OpenGL/gl3.h>
|
|
||||||
#else
|
|
||||||
#define GL_GLEXT_PROTOTYPES 1
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#endif
|
|
||||||
#define TVG_REQUIRE_GL_MAJOR_VER 3
|
#define TVG_REQUIRE_GL_MAJOR_VER 3
|
||||||
#define TVG_REQUIRE_GL_MINOR_VER 3
|
#define TVG_REQUIRE_GL_MINOR_VER 3
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1315,6 +1315,11 @@ int GlRenderer::term()
|
||||||
|
|
||||||
GlRenderer* GlRenderer::gen()
|
GlRenderer* GlRenderer::gen()
|
||||||
{
|
{
|
||||||
|
auto init = gladLoaderLoadGL();
|
||||||
|
if (init == 0) {
|
||||||
|
TVGERR("GL_ENGINE", "gladLoadGL() failed");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
//TODO: GL minimum version check, should be replaced with the runtime linking in GlRenderer::init()
|
//TODO: GL minimum version check, should be replaced with the runtime linking in GlRenderer::init()
|
||||||
GLint vMajor, vMinor;
|
GLint vMajor, vMinor;
|
||||||
glGetIntegerv(GL_MAJOR_VERSION, &vMajor);
|
glGetIntegerv(GL_MAJOR_VERSION, &vMajor);
|
||||||
|
|
Loading…
Add table
Reference in a new issue