Skip to content

Commit 90c2a07

Browse files
author
Erik van Bilsen
committed
Disabled VAO on Android, since it is not reliable supported on all devices
1 parent f9b2557 commit 90c2a07

File tree

1 file changed

+9
-26
lines changed

1 file changed

+9
-26
lines changed

Tutorials/Common/Sample.Classes.pas

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,6 @@ TVertexArray = class(TInterfacedObject, IVertexArray)
228228
glGenVertexArrays: procedure(n: GLsizei; arrays: PGLuint); {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
229229
glBindVertexArray: procedure(array_: GLuint); {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
230230
glDeleteVertexArrays: procedure(n: GLsizei; {$IFDEF MSWINDOWS}const{$ENDIF} arrays: PGLuint); {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
231-
{$IFDEF ANDROID}
232-
FLibHandle: THandle;
233-
{$ENDIF}
234231
private
235232
FVertexBuffer: GLuint;
236233
FIndexBuffer: GLuint;
@@ -252,7 +249,6 @@ TVertexArray = class(TInterfacedObject, IVertexArray)
252249
procedure EndRender;
253250
public
254251
class constructor Create;
255-
class destructor Destroy;
256252
{$ENDREGION 'Internal Declarations'}
257253
public
258254
{ Creates a vertex array.
@@ -745,8 +741,6 @@ implementation
745741
System.IOUtils,
746742
{$IF Defined(MACOS)}
747743
Macapi.CoreFoundation, // For inlining to work
748-
{$ELSEIF Defined(ANDROID)}
749-
Posix.Dlfcn,
750744
{$ENDIF}
751745
Neslib.Stb.Image,
752746
Sample.Platform;
@@ -1046,14 +1040,6 @@ constructor TVertexArray.Create(const ALayout: TVertexLayout; const AVertices;
10461040
Create(ALayout, AVertices, ASizeOfVertices, AIndices[0], Length(AIndices));
10471041
end;
10481042

1049-
class destructor TVertexArray.Destroy;
1050-
begin
1051-
{$IFDEF ANDROID}
1052-
if (FLibHandle <> 0) then
1053-
dlClose(FLibHandle);
1054-
{$ENDIF}
1055-
end;
1056-
10571043
constructor TVertexArray.Create(const ALayout: TVertexLayout; const AVertices;
10581044
const ASizeOfVertices: Integer; const AIndices;
10591045
const AIndexCount: Integer);
@@ -1174,18 +1160,15 @@ class procedure TVertexArray.Initialize;
11741160
glBindVertexArray := glBindVertexArrayAPPLE;
11751161
glDeleteVertexArrays := glDeleteVertexArraysAPPLE;
11761162
{$ELSEIF Defined(ANDROID)}
1177-
FSupportsVAO := glIsExtensionSupported('GL_OES_vertex_array_object');
1178-
if (FSupportsVAO) then
1179-
begin
1180-
FLibHandle := dlopen(AndroidGles2Lib, RTLD_LAZY);
1181-
FSupportsVAO := (FLibHandle <> 0);
1182-
if (FSupportsVAO) then
1183-
begin
1184-
glGenVertexArrays := dlsym(FLibHandle, 'glGenVertexArraysOES');
1185-
glBindVertexArray := dlsym(FLibHandle, 'glBindVertexArrayOES');
1186-
glDeleteVertexArrays := dlsym(FLibHandle, 'glDeleteVertexArraysOES');
1187-
end;
1188-
end;
1163+
{ Technically, a lot of Android devices support VAO's if the extension
1164+
GL_OES_vertex_array_object is available. However, on some Android devices,
1165+
this extension is available, but it does not work. Calling a VAO API then
1166+
results in a log message: "E/libEGL: called unimplemented OpenGL ES API."
1167+
(See http://blog.linderdaum.com/2013/10/19/vao/).
1168+
So we cannot reliably use VAO's on Android.
1169+
(NOTE: As of OpenGL ES 3.0, VAO are part of the core specification, but we
1170+
target OpenGL ES 2.0) }
1171+
FSupportsVAO := False;
11891172
{$ENDIF}
11901173

11911174
FSupportsVAO := FSupportsVAO and Assigned(glGenVertexArrays)

0 commit comments

Comments
 (0)