|
|
@@ -1838,7 +1838,10 @@ type |
|
|
|
|
|
|
|
function InitOpenGLES(const aOpenGLESLibName: String = LIBNAME_OPENGLES; aEGLLibName: String = LIBNAME_EGL): Boolean; |
|
|
|
|
|
|
|
function CreateRenderingContext(const aDisplayType: EGLNativeDisplayType; const aWindowType: PEGLNativeWindowType; const aAttributes: PEGLint): TdglRenderContext; |
|
|
|
function CreateRenderingContext(const aDisplayType: EGLNativeDisplayType; |
|
|
|
const aWindowType: PEGLNativeWindowType; |
|
|
|
const aConfigAttribs: PEGLint; |
|
|
|
const aContextAttribs: PEGLint): TdglRenderContext; |
|
|
|
procedure DestroyRenderingContext(const aContext: TdglRenderContext); |
|
|
|
function ActivateRenderingContext(const aContext: TdglRenderContext): Boolean; |
|
|
|
function DeactivateRenderingContext(const aContext: TdglRenderContext): Boolean; |
|
|
@@ -1949,7 +1952,8 @@ begin |
|
|
|
raise EeglError.Create(aMsg + ' ErrorCode: 0x' + IntToHex(err, 8), err); |
|
|
|
end; |
|
|
|
|
|
|
|
function CreateRenderingContext(const aDisplayType: EGLNativeDisplayType; const aWindowType: PEGLNativeWindowType; const aAttributes: PEGLint): TdglRenderContext; |
|
|
|
function CreateRenderingContext(const aDisplayType: EGLNativeDisplayType; const aWindowType: PEGLNativeWindowType; |
|
|
|
const aConfigAttribs: PEGLint; const aContextAttribs: PEGLint): TdglRenderContext; |
|
|
|
var |
|
|
|
ConfigCount: EGLint; |
|
|
|
Config: EGLConfig; |
|
|
@@ -1965,15 +1969,18 @@ begin |
|
|
|
if (eglInitialize(result.Display, nil, nil) <> EGL_TRUE) then |
|
|
|
RaiseEglError('unable to initialize egl.'); |
|
|
|
|
|
|
|
if (eglChooseConfig(result.Display, aAttributes, @Config, 1, @ConfigCount) <> EGL_TRUE) or |
|
|
|
(ConfigCount <> 1) then |
|
|
|
if (eglChooseConfig(result.Display, aConfigAttribs, @Config, 1, @ConfigCount) <> EGL_TRUE) or |
|
|
|
(ConfigCount < 1) then |
|
|
|
RaiseEglError('unable to get suitable config.'); |
|
|
|
|
|
|
|
if (eglBindAPI(EGL_OPENGL_ES_API) <> EGL_TRUE) then |
|
|
|
RaiseEglError('unable to get an appropriate EGL frame buffer configuration.'); |
|
|
|
|
|
|
|
result.Surface := eglCreateWindowSurface(result.Display, Config, aWindowType, nil); |
|
|
|
if (result.Surface = EGL_NO_SURFACE) then |
|
|
|
RaiseEglError('unable to create window surface.'); |
|
|
|
|
|
|
|
result.Context := eglCreateContext(result.Display, Config, EGL_NO_CONTEXT, nil); |
|
|
|
result.Context := eglCreateContext(result.Display, Config, EGL_NO_CONTEXT, aContextAttribs); |
|
|
|
if (result.Context = EGL_NO_CONTEXT) then begin |
|
|
|
eglDestroySurface(result.Display, result.Surface); |
|
|
|
RaiseEglError('unable to create context.'); |
|
|
|