Commit 38723f45 authored by Bergmann89's avatar Bergmann89

* added OpenGL ES support

parent eb7858e4
......@@ -82,7 +82,7 @@ unit uglcArrayBuffer;
interface
uses
dglOpenGL, sysutils, uglcTypes;
{$IFNDEF OPENGL_ES}dglOpenGL{$ELSE}dglOpenGLES{$ENDIF}, sysutils, uglcTypes;
type
EglcArrayBuffer = class(Exception);
......@@ -103,6 +103,7 @@ type
procedure BufferData(const aDataCount, aDataSize: Cardinal; const aUsage: TglcBufferUsage; const aData: Pointer);
function MapBuffer(const aAccess: TglcBufferAccess): Pointer;
function MapBufferRange(const aOffset: GLintptr; const aSize: GLsizeiptr; const aAccess: TglcBufferAccess): Pointer;
procedure UnmapBuffer;
procedure Bind;
procedure Unbind;
......@@ -133,14 +134,40 @@ begin
result := nil;
if (fDataCount * fDataSize) <= 0 then
exit;
{$IFNDEF OPENGL_ES}
result := glMapBuffer(GLenum(fTarget), GLenum(aAccess));
{$ELSE}
if not GL_OES_mapbuffer then
raise EglcArrayBuffer.Create('map buffer is not supported by video card');
result := glMapBufferOES(GLenum(fTarget), GLenum(aAccess));
{$ENDIF}
glcCheckAndRaiseError;
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////[c]
function TglcArrayBuffer.MapBufferRange(const aOffset: GLintptr; const aSize: GLsizeiptr; const aAccess: TglcBufferAccess): Pointer;
begin
{$IFNDEF OPENGL_ES}
if not (GL_ARB_map_buffer_range or GL_VERSION_3_0) then
raise EglcArrayBuffer.Create('map buffer range is not supported by video card');
result := glMapBufferRange(GLenum(fTarget), aOffset, aSize, GLenum(aAccess));
{$ELSE}
if not GL_VERSION_3_0 then
raise EglcArrayBuffer.Create('map buffer range is not supported by video card');
result := glMapBufferRange(GLenum(fTarget), aOffset, aSize, GLenum(aAccess));
{$ENDIF}
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////[c]
procedure TglcArrayBuffer.UnmapBuffer;
begin
{$IFNDEF OPENGL_ES}
glUnmapBuffer(GLenum(fTarget));
{$ELSE}
if not (GL_OES_mapbuffer or GL_VERSION_3_0) then
raise EglcArrayBuffer.Create('unmap buffer is not supported by video card');
glUnmapBuffer(GLenum(fTarget));
{$ENDIF}
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////[c]
......@@ -158,13 +185,19 @@ end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////[c]
constructor TglcArrayBuffer.Create(const aTarget: TglcBufferTarget);
begin
if not GL_ARB_Vertex_Buffer_Object then
{$IFNDEF OPENGL_ES}
if not (GL_ARB_Vertex_Buffer_Object or GL_VERSION_2_0) then
raise EglcArrayBuffer.Create('Create - VertexBuffer: not supported');
{$ELSE}
if not GL_VERSION_2_0 then
raise EglcArrayBuffer.Create('Create - VertexBuffer: not supported');
{$ENDIF}
inherited Create;
glGenBuffers(1, @fID);
fDataCount := 0;
fDataSize := 0;
fTarget := aTarget;
glcCheckAndRaiseError;
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////[c]
......
......@@ -1320,11 +1320,16 @@ type
{$IFEND}
TglcBitmapFormat = TglBitmapFormat;
TglcBitmap1D = TglBitmap1D;
TglcBitmap2D = TglBitmap2D;
{$IF NOT DEFINED(OPENGL_ES)}
TglcBitmap1D = TglBitmap1D;
TglcBitmapCubeMap = TglBitmapCubeMap;
TglcBitmapNormalMap = TglBitmapNormalMap;
{$ELSEIF DEFINED(OPENGL_ES_2_0)}
TglcBitmapCubeMap = TglBitmapCubeMap;
TglcBitmapNormalMap = TglBitmapNormalMap;
{$IFEND}
const
NULL_SIZE: TglBitmapPixelPosition = (Fields: []; X: 0; Y: 0);
......
......@@ -57,7 +57,9 @@ type
procedure Perspective(const aFOVAngle, aAspectRatio, aNear, aFar: Single);
procedure Ortho(const aLeft, aRight, aBottom, aTop, aNear, aFar: Single);
procedure Activate;
{$IFNDEF OPENGL_ES}
procedure Render;
{$ENDIF}
constructor Create;
end;
......@@ -82,7 +84,7 @@ type
implementation
uses
Math, dglOpenGL;
Math, {$IFNDEF OPENGL_ES}dglOpenGL{$ELSE}dglOpenGLES{$ENDIF};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TglcFrustum///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -152,13 +154,14 @@ begin
glMatrixMode(GL_PROJECTION);
glLoadIdentity;
if fIsOrthogonal then
glOrtho(fLeft, fRight, fBottom, fTop, fNear, fFar)
{$IFNDEF OPENGL_ES}glOrtho{$ELSE}glOrthof{$ENDIF}(fLeft, fRight, fBottom, fTop, fNear, fFar)
else
glFrustum(fLeft, fRight, fBottom, fTop, fNear, fFar);
{$IFNDEF OPENGL_ES}glFrustum{$ELSE}glFrustumf{$ENDIF}(fLeft, fRight, fBottom, fTop, fNear, fFar);
glMatrixMode(GL_MODELVIEW);
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{$IFNDEF OPENGL_ES}
procedure TglcFrustum.Render;
var
min, max: TgluVector2f;
......@@ -189,6 +192,7 @@ begin
glVertex3f(0, 0, 0); glVertex3f(max[0], min[0], -fFar);
glEnd;
end;
{$ENDIF}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
constructor TglcFrustum.Create;
......
......@@ -39,7 +39,7 @@ unit uglcFrameBufferObject;
interface
uses
Classes, SysUtils, fgl, dglOpenGl, uglcTypes;
Classes, SysUtils, fgl, {$IFNDEF OPENGL_ES}dglOpenGl{$ELSE}dglOpenGLES{$ENDIF}, uglcTypes;
type
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -126,6 +126,9 @@ type
fWidth: Integer;
fHeight: Integer;
fBuffers: TglcAttachmentContainerList;
{$IFDEF OPENGL_ES}
fOldViewport: array[0..3] of GLint;
{$ENDIF}
function GetBuffer(const aIndex: Integer): TglcBuffer;
procedure SetBuffer(const aIndex: Integer; const aValue: TglcBuffer);
......@@ -322,8 +325,8 @@ begin
glGenTextures(1, @fID);
Bind(false);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, {$IFNDEF OPENGL_ES}GL_CLAMP{$ELSE}GL_CLAMP_TO_EDGE{$ENDIF});
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, {$IFNDEF OPENGL_ES}GL_CLAMP{$ELSE}GL_CLAMP_TO_EDGE{$ENDIF});
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
Unbind(false);
......@@ -466,6 +469,7 @@ begin
raise EglcFrameBufferObject.Create('Incomplete attachment');
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
raise EglcFrameBufferObject.Create('Missing attachment');
{$IFNDEF OPENGL_ES}
GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
raise EglcFrameBufferObject.Create('Incomplete dimensions');
GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
......@@ -474,6 +478,7 @@ begin
raise EglcFrameBufferObject.Create('Incomplete draw buffer');
GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
raise EglcFrameBufferObject.Create('Incomplete read buffer');
{$ENDIF}
GL_FRAMEBUFFER_UNSUPPORTED:
raise EglcFrameBufferObject.Create('Framebufferobjects unsupported');
end;
......@@ -490,7 +495,9 @@ procedure TglcFrameBufferObject.UpdateAndCheckFBO;
var
buff: array of GLenum;
{$IFNDEF OPENGL_ES}
b: GLboolean;
{$ENDIF}
i: Integer;
begin
if (fBuffers.Count = 0) then
......@@ -508,14 +515,24 @@ begin
//set Read and Draw Buffer
if (Length(buff) = 0) then begin
glReadBuffer(GL_NONE);
{$IFNDEF OPENGL_ES}
glDrawBuffer(GL_NONE);
{$ELSE}
SetLength(buff, 1);
buff[0] := GL_NONE;
glDrawBuffers(1, @buff[0]);
{$ENDIF}
end else begin
glDrawBuffers(Length(buff), @buff[0]);
{$IFNDEF OPENGL_ES}
glGetBooleanv(GL_DOUBLEBUFFER, @b);
if b then
glReadBuffer(GL_BACK)
else
glReadBuffer(GL_FRONT);
{$ELSE}
glReadBuffer(GL_FRONT);
{$ENDIF}
end;
Unbind(false);
end;
......@@ -612,7 +629,11 @@ procedure TglcFrameBufferObject.Bind(const aSetViewport: Boolean = true);
begin
glBindFramebuffer(GL_FRAMEBUFFER, fID);
if aSetViewport then begin
{$IFNDEF OPENGL_ES}
glPushAttrib(GL_VIEWPORT_BIT);
{$ELSE}
glGetIntegerv(GL_VIEWPORT, @fOldViewport[0]);
{$ENDIF}
glViewPort(0, 0, fWidth, fHeight);
end;
end;
......@@ -622,7 +643,11 @@ end;
procedure TglcFrameBufferObject.Unbind(const aResetViewport: Boolean = true);
begin
if aResetViewport then
{$IFNDEF OPENGL_ES}
glPopAttrib;
{$ELSE}
glViewport(fOldViewport[0], fOldViewport[1], fOldViewport[2], fOldViewport[3]);
{$ENDIF}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
end;
......
......@@ -9,7 +9,7 @@ unit uglcLight;
interface
uses
Classes, SysUtils, dglOpenGL, ugluVector, uglcTypes;
Classes, SysUtils, {$IFNDEF OPENGL_ES}dglOpenGl{$ELSE}dglOpenGLES{$ENDIF}, ugluVector, uglcTypes;
type
TglcMaterialRec = packed record
......
......@@ -57,7 +57,7 @@ unit uglcShader;
interface
uses
Classes, SysUtils, fgl, dglOpenGL, uglcTypes, ugluMatrix, uglcContext;
Classes, SysUtils, fgl, {$IFNDEF OPENGL_ES}dglOpenGl{$ELSE}dglOpenGLES{$ENDIF}, uglcTypes, ugluMatrix;
type
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -67,19 +67,19 @@ type
TglcShaderObject = class(TObject)
private
fAtachedTo: TglcShaderProgram;
fShaderObj: GLHandle;
fShaderObj: GLuint;
fShaderType: TglcShaderType;
fCode: String;
fOnLog: TglcShaderLogEvent;
fAttachedTo: TglcShaderProgram;
function GetInfoLog(aObj: GLHandle): String;
function GetInfoLog(aObj: GLuint): String;
function GetCompiled: Boolean;
procedure Log(const aMsg: String);
procedure CreateShaderObj;
procedure AttachTo(const aProgram: TglcShaderProgram);
public
property ShaderObj : GLHandle read fShaderObj;
property ShaderObj: GLuint read fShaderObj;
property ShaderType: TglcShaderType read fShaderType;
property Compiled: Boolean read GetCompiled;
property AtachedTo: TglcShaderProgram read fAtachedTo;
......@@ -96,12 +96,12 @@ type
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TglcShaderProgram = class(TglcShaderObjectList)
private
fProgramObj: GLHandle;
fProgramObj: GLuint;
fOnLog: TglcShaderLogEvent;
fFilename: String;
function GetUniformLocation(const aName: String; out aPos: glInt): Boolean;
function GetInfoLog(Obj: GLHandle): String;
function GetInfoLog(Obj: GLuint): String;
function GetCompiled: Boolean;
function GetLinked: Boolean;
......@@ -109,7 +109,7 @@ type
procedure Log(const msg: String);
procedure AttachShaderObj(const aShaderObj: TglcShaderObject);
public
property ProgramObj: glHandle read fProgramObj;
property ProgramObj: GLuint read fProgramObj;
property Filename: String read fFilename;
property Compiled: Boolean read GetCompiled;
property Linked: Boolean read GetLinked;
......@@ -172,7 +172,7 @@ const
//ließt das Log eines OpenGL-Objekts aus
//@Obj: Handle des Objekts, dessen Log ausgelesen werden soll;
//@result: Log des Objekts;
function TglcShaderObject.GetInfoLog(aObj: GLHandle): String;
function TglcShaderObject.GetInfoLog(aObj: GLuint): String;
var
Msg: PChar;
bLen: GLint;
......@@ -293,7 +293,7 @@ end;
//ließt das Log eines OpenGL-Objekts aus
//@Obj: Handle des Objekts, dessen Log ausgelesen werden soll;
//@result: Log des Objekts;
function TglcShaderProgram.GetInfoLog(Obj: GLHandle): String;
function TglcShaderProgram.GetInfoLog(Obj: GLuint): String;
var
Msg: PChar;
bLen: GLint;
......@@ -336,12 +336,6 @@ end;
procedure TglcShaderProgram.CreateProgramObj;
begin
if (fProgramObj = 0) then begin
if GL_LibHandle = nil then
raise EglcShader.Create('TglShaderProgram.Create - OpenGL not initialized');
if not TglcContext.IsAnyContextActive then
raise EglcShader.Create('TglShaderProgram.Create - no valid render context');
fProgramObj := glCreateProgram();
Log('shader program created: #'+IntToHex(fProgramObj, 4));
end;
......@@ -815,12 +809,14 @@ procedure TglcShaderProgram.LoadFromStream(const aStream: TStream);
result := TglcShaderType.stVertex
else if (aStr = 'GL_FRAGMENT_SHADER') then
result := TglcShaderType.stFragment
{$IFNDEF OPENGL_ES}
else if (aStr = 'GL_GEOMETRY_SHADER') then
result := TglcShaderType.stGeometry
else if (aStr = 'GL_TESS_CONTROL_SHADER') then
result := TglcShaderType.stTessControl
else if (aStr = 'GL_TESS_EVALUATION_SHADER') then
result := TglcShaderType.stTessEvaluation
{$ENDIF}
else
raise Exception.Create('invalid shader type: ' + aStr);
end;
......@@ -924,9 +920,11 @@ var
case aShaderType of
TglcShaderType.stVertex: result := 'GL_VERTEX_SHADER';
TglcShaderType.stFragment: result := 'GL_FRAGMENT_SHADER';
{$IFNDEF OPENGL_ES}
TglcShaderType.stGeometry: result := 'GL_GEOMETRY_SHADER';
TglcShaderType.stTessControl: result := 'GL_TESS_CONTROL_SHADER';
TglcShaderType.stTessEvaluation: result := 'GL_TESS_EVALUATION_SHADER';
{$ENDIF}
else
result := 'UNKNOWN';
end;
......@@ -972,4 +970,4 @@ begin
end;
end.
\ No newline at end of file
......@@ -12,7 +12,7 @@ unit uglcTypes;
interface
uses
dglOpenGL, sysutils;
{$IFNDEF OPENGL_ES}dglOpenGL{$ELSE}dglOpenGLES{$ENDIF}, sysutils;
type
TglcFace = (
......@@ -20,10 +20,12 @@ type
faBack = GL_BACK,
faBoth = GL_FRONT_AND_BACK);
{$IFNDEF OPENGL_ES}
TglcPolygonMode = (
pmPoint = GL_POINT,
pmLine = GL_LINE,
pmFill = GL_FILL);
{$ENDIF}
TglcDepthFunc = (
dfNever = GL_NEVER,
......@@ -37,7 +39,9 @@ type
TglcClearBuffer = (
cbDepthBuffer = GL_DEPTH_BUFFER_BIT,
{$IFNDEF OPENGL_ES}
cbAccumBuffer = GL_ACCUM_BUFFER_BIT,
{$ENDIF}
cbStencilBuffer = GL_STENCIL_BUFFER_BIT,
cbColorBuffer = GL_COLOR_BUFFER_BIT);
......@@ -54,9 +58,13 @@ type
mfLinear = GL_LINEAR);
TglcTextureWrap = (
{$IFNDEF OPENGL_ES}
twClamp = GL_CLAMP,
{$ENDIF}
twRepeat = GL_REPEAT,
{$IFNDEF OPENGL_ES}
twClampToBorder = GL_CLAMP_TO_BORDER,
{$ENDIF}
twClampToEdge = GL_CLAMP_TO_EDGE,
twMirroredRepeat = GL_MIRRORED_REPEAT);
......@@ -85,7 +93,9 @@ type
TglcFormat = (
fmUnknown = 0,
{$IFNDEF OPENGL_ES}
fmColorIndex = GL_COLOR_INDEX,
{$ENDIF}
fmDepthComponent = GL_DEPTH_COMPONENT,
fmRed = GL_RED,
fmGreen = GL_GREEN,
......@@ -95,8 +105,10 @@ type
fmRGBA = GL_RGBA,
fmLuminance = GL_LUMINANCE,
fmLuminanceAlpha = GL_LUMINANCE_ALPHA,
{$IFNDEF OPENGL_ES}
fmBGR = GL_BGR,
fmBGRA = GL_BGRA,
{$ENDIF}
fmDepthStencil = GL_DEPTH_STENCIL);
TglcInternalFormat = (
......@@ -107,6 +119,7 @@ type
ifRGBA = GL_RGBA,
ifLuminance = GL_LUMINANCE,
ifLuminanceAlpha = GL_LUMINANCE_ALPHA,
{$IFNDEF OPENGL_ES}
ifR3G3B2 = GL_R3_G3_B2,
ifAlpha4 = GL_ALPHA4,
ifAlpha8 = GL_ALPHA8,
......@@ -129,19 +142,25 @@ type
ifIntensity16 = GL_INTENSITY16,
ifRGB4 = GL_RGB4,
ifRGB5 = GL_RGB5,
{$ENDIF}
ifRGB8 = GL_RGB8,
{$IFNDEF OPENGL_ES}
ifRGB10 = GL_RGB10,
ifRGB12 = GL_RGB12,
ifRGB16 = GL_RGB16,
ifRGBA2 = GL_RGBA2,
{$ENDIF}
ifRGBA4 = GL_RGBA4,
ifRGB5A1 = GL_RGB5_A1,
ifRGBA8 = GL_RGBA8,
ifRGB10A2 = GL_RGB10_A2,
{$IFNDEF OPENGL_ES}
ifRGBA12 = GL_RGBA12,
ifRGBA16 = GL_RGBA16,
{$ENDIF}
ifDepthComponent16 = GL_DEPTH_COMPONENT16,
ifDepthComponent24 = GL_DEPTH_COMPONENT24,
{$IFNDEF OPENGL_ES}
ifDepthComponent32 = GL_DEPTH_COMPONENT32,
ifCompressedAlpha = GL_COMPRESSED_ALPHA,
ifCompressedLuminance = GL_COMPRESSED_LUMINANCE,
......@@ -149,6 +168,7 @@ type
ifCompressedIntensity = GL_COMPRESSED_INTENSITY,
ifCompressedRGB = GL_COMPRESSED_RGB,
ifCompressedRGBA = GL_COMPRESSED_RGBA,
{$ENDIF}
ifRGBA32f = GL_RGBA32F,
ifRGB32f = GL_RGB32F,
ifRGBA16F = GL_RGBA16F,
......@@ -156,17 +176,26 @@ type
ifDepth24Stencil8 = GL_DEPTH24_STENCIL8,
ifSRGB = GL_SRGB,
ifSRGB8 = GL_SRGB8,
{$IFNDEF OPENGL_ES}
ifSRGBA = GL_SRGB_ALPHA,
{$ENDIF}
ifSRGBA8 = GL_SRGB8_ALPHA8,
{$IFNDEF OPENGL_ES}
ifSLuminanceAlpha = GL_SLUMINANCE_ALPHA,
ifSLuminance8Alpha8 = GL_SLUMINANCE8_ALPHA8,
ifSLuminance = GL_SLUMINANCE,
ifSLuminance8 = GL_SLUMINANCE8,
{$ENDIF}
ifDepth32fStencil8 = GL_DEPTH32F_STENCIL8,
{$IFNDEF OPENGL_ES}
ifStencil1 = GL_STENCIL_INDEX1,
ifStencil4 = GL_STENCIL_INDEX4,
ifStencil8 = GL_STENCIL_INDEX8,
ifStencil16 = GL_STENCIL_INDEX16);
{$ENDIF}
ifStencil8 = GL_STENCIL_INDEX8
{$IFNDEF OPENGL_ES}
, ifStencil16 = GL_STENCIL_INDEX16
{$ENDIF}
);
TglcAttachment = (
atDepthStencil = GL_DEPTH_STENCIL_ATTACHMENT,
......@@ -191,10 +220,13 @@ type
TglcShaderType = (
stFragment = GL_FRAGMENT_SHADER,
stVertex = GL_VERTEX_SHADER,
stGeometry = GL_GEOMETRY_SHADER,
stTessEvaluation = GL_TESS_EVALUATION_SHADER,
stTessControl = GL_TESS_CONTROL_SHADER);
stVertex = GL_VERTEX_SHADER
{$IFNDEF OPENGL_ES}
, stGeometry = GL_GEOMETRY_SHADER
, stTessEvaluation = GL_TESS_EVALUATION_SHADER
, stTessControl = GL_TESS_CONTROL_SHADER
{$ENDIF}
);
TglcBufferTarget = (
btArrayBuffer = GL_ARRAY_BUFFER,
......@@ -226,11 +258,13 @@ type
end;
procedure glcRenderFace(const aValue: TglcFace); inline;
procedure glcPolygonMode(const aFace: TglcFace; const aValue: TglcPolygonMode); inline;
procedure glcDepthFunc(const aValue: TglcDepthFunc); inline;
procedure glcBlendFunc(const aSource, aDest: TglcBlendFactor); inline; overload;
procedure glcBlendFunc(const aMode: TglcBlendMode); inline; overload;
procedure glcCheckAndRaiseError;
{$IFNDEF OPENGL_ES}
procedure glcPolygonMode(const aFace: TglcFace; const aValue: TglcPolygonMode); inline;
{$ENDIF}
implementation
......@@ -264,12 +298,6 @@ begin
end;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure glcPolygonMode(const aFace: TglcFace; const aValue: TglcPolygonMode);
begin
glPolygonMode(GLenum(aFace), GLenum(aValue));
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure glcDepthFunc(const aValue: TglcDepthFunc);
begin
......@@ -298,20 +326,36 @@ begin
raise EOpenGL.Create(e);
end;
{$IFNDEF OPENGL_ES}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure glcPolygonMode(const aFace: TglcFace; const aValue: TglcPolygonMode);
begin
glPolygonMode(GLenum(aFace), GLenum(aValue));
end;
{$ENDIF}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//EOpenGL///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
constructor EOpenGL.Create(const aErrorCode: GLenum);
begin
fErrorCode := aErrorCode;
{$IFNDEF OPENGL_ES}
inherited Create(gluErrorString(fErrorCode));
{$ELSE}
inherited Create('OpenGL Error: ' + IntToHex(fErrorCode, 8));
{$ENDIF}
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
constructor EOpenGL.Create(const aMsg: String; const aErrorCode: GLenum);
begin
fErrorCode := aErrorCode;
{$IFNDEF OPENGL_ES}
inherited Create(aMsg + ': ' + gluErrorString(fErrorCode))
{$ELSE}
inherited Create(aMsg + ': ' + IntToHex(fErrorCode, 8));
{$ENDIF}
end;
end.
......
......@@ -9,7 +9,7 @@ unit ugluVector;
interface
uses
Classes, SysUtils, dglOpenGL;
Classes, SysUtils, {$IFNDEF OPENGL_ES}dglOpenGL{$ELSE}dglOpenGLES{$ENDIF};
type
//Vektortypen
......@@ -799,10 +799,10 @@ end;
//@result: absolute Raumkoordianten des Vectors v;
function gluGetAbsCoord(const v: TgluVector3f): TgluVector3f;
var
v4: TVector4f;
v4: TgluVector4f;
sum: Single;
i, j: Integer;
m: array[0..3, 0..3] of TGLFloat;
m: array[0..3, 0..3] of GLfloat;
begin
for i := 0 to 2 do
v4[i] := v[i];
......
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