mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-01 15:50:27 +02:00
Add a unified cross platform OpenGL core profile binding (#52)
This commit is contained in:
@ -9,6 +9,7 @@
|
||||
#include "irrString.h"
|
||||
#include "irrArray.h"
|
||||
#include "os.h"
|
||||
#include <dlfcn.h>
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
#include <android/native_activity.h>
|
||||
@ -20,7 +21,7 @@ namespace video
|
||||
{
|
||||
|
||||
CEGLManager::CEGLManager() : IContextManager(), EglWindow(0), EglDisplay(EGL_NO_DISPLAY),
|
||||
EglSurface(EGL_NO_SURFACE), EglContext(EGL_NO_CONTEXT), EglConfig(0), MajorVersion(0), MinorVersion(0)
|
||||
EglSurface(EGL_NO_SURFACE), EglContext(EGL_NO_CONTEXT), EglConfig(0), MajorVersion(0), MinorVersion(0), libHandle(NULL)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CEGLManager");
|
||||
@ -109,6 +110,9 @@ void CEGLManager::terminate()
|
||||
|
||||
MajorVersion = 0;
|
||||
MinorVersion = 0;
|
||||
|
||||
if (libHandle)
|
||||
dlclose(libHandle);
|
||||
}
|
||||
|
||||
bool CEGLManager::generateSurface()
|
||||
@ -590,6 +594,19 @@ const SExposedVideoData& CEGLManager::getContext() const
|
||||
return Data;
|
||||
}
|
||||
|
||||
void* CEGLManager::getProcAddress(const std::string &procName)
|
||||
{
|
||||
void* proc = NULL;
|
||||
proc = (void*)eglGetProcAddress(procName.c_str());
|
||||
if (!proc) { // fallback
|
||||
if (!libHandle)
|
||||
libHandle = dlopen("libGLESv2.so", RTLD_LAZY);
|
||||
if (libHandle)
|
||||
proc = dlsym(libHandle, procName.c_str());
|
||||
}
|
||||
return proc;
|
||||
}
|
||||
|
||||
bool CEGLManager::swapBuffers()
|
||||
{
|
||||
return (eglSwapBuffers(EglDisplay, EglSurface)==EGL_TRUE);
|
||||
|
Reference in New Issue
Block a user