Commit 861226e1 authored by Bergmann89's avatar Bergmann89

* [glcContext] check return value from wglShareLists

* [glcFrameBufferObject] fixed bug with glDrawBuffer/glReadBuffer
parent d7f77c99
......@@ -399,7 +399,8 @@ end;
procedure TglcContextWGL.Share(const aContext: TglcContext);
begin
wglShareLists(FRC, (aContext as TglcContextWGL).FRC);
if not wglShareLists(FRC, (aContext as TglcContextWGL).FRC) then
raise EGLError.Create('wglShareLists failed: ' + IntToStr(GetLastError()));
end;
class function TglcContextWGL.ChangeDisplaySettings(const aWidth, aHeight,
......
......@@ -322,7 +322,6 @@ constructor TglcTextureBuffer.Create(const aFormat: TglcFormat; const aInternalF
begin
inherited Create;
fBufferType := btTextureBuffer;
glGenTextures(1, @fID);
Bind(false);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, {$IFNDEF OPENGL_ES}GL_CLAMP{$ELSE}GL_CLAMP_TO_EDGE{$ENDIF});
......@@ -330,7 +329,6 @@ begin
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
Unbind(false);
fFormat := aFormat;
fInternalFormat := aInternalFormat;
SetSize(64, 64);
......@@ -495,11 +493,11 @@ procedure TglcFrameBufferObject.UpdateAndCheckFBO;
var
buff: array of GLenum;
{$IFNDEF OPENGL_ES}
b: GLboolean;
{$ENDIF}
i: Integer;
{$IFNDEF OPENGL_ES}DoubleBuffered: GLboolean;{$ENDIF}
begin
{$IFNDEF OPENGL_ES}glGetBooleanv(GL_DOUBLEBUFFER, @DoubleBuffered);{$ENDIF}
if (fBuffers.Count = 0) then
exit;
Bind(false);
......@@ -525,8 +523,7 @@ begin
end else begin
glDrawBuffers(Length(buff), @buff[0]);
{$IFNDEF OPENGL_ES}
glGetBooleanv(GL_DOUBLEBUFFER, @b);
if b then
if DoubleBuffered then
glReadBuffer(GL_BACK)
else
glReadBuffer(GL_FRONT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment