Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/base/URenderer_OpenGL.pas
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ TRenderer_OpenGLBase = class(TRenderer)
SupportsVAO: boolean;
SupportsFBO: boolean;
SupportsMappedBuffer: boolean;
SupportsMipMap: boolean;
GlyphTextureFormat: GLint;

MappedBuffer: PGLfloat; // OpenGL 2.0 doesn't support mapped buffers, so we manage it ourself.
Expand Down Expand Up @@ -1522,6 +1523,8 @@ function TRenderer_OpenGLBase.GetBlend(): boolean;

function TRenderer_OpenGLBase.LoadTexture(Data: PByte; W, H: integer; const Identifier: IPath; Typ: TTextureType; UseMipmaps: boolean): TTexture;
begin
if (UseMipmaps and (not SupportsMipMap)) then
UseMipmaps := false;
if (Typ = TEXTURE_TYPE_TRANSPARENT) or (Typ = TEXTURE_TYPE_COLORIZED) then
Result := TTexture_OpenGL.Create(Data, W, H, Identifier, GL_RGBA, 4, GL_CLAMP_TO_EDGE, UseMipmaps)
else // TEXTURE_TYPE_PLAIN
Expand Down Expand Up @@ -1780,6 +1783,7 @@ procedure TRenderer_OpenGL3.CheckVersion();
SupportsVAO := true;
SupportsFBO := true;
SupportsMappedBuffer := true;
SupportsMipMap := true;
GlyphTextureFormat := GL_RED;
if ((MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >= 3))) then
fSupportsProjectM := true;
Expand Down Expand Up @@ -1833,6 +1837,7 @@ procedure TRenderer_OpenGLES.CheckVersion();
GL_OES_vertex_array_object: boolean;
GL_OES_element_index_uint: boolean;
GL_EXT_texture_rg: boolean;
GL_OES_texture_npot: boolean;
begin
if (MajorVersion < 2) then
raise Exception.Create('Could not initialize OpenGL ES 2.0 or later');
Expand All @@ -1842,6 +1847,7 @@ procedure TRenderer_OpenGLES.CheckVersion();
SupportsVAO := true;
fSupportsProjectM := true;
SupportsMappedBuffer := true;
SupportsMipMap := true;
GlyphTextureFormat := GL_RED;
end
else
Expand All @@ -1858,6 +1864,11 @@ procedure TRenderer_OpenGLES.CheckVersion();
GlyphTextureFormat := GL_RED
else
GlyphTextureFormat := GL_LUMINANCE;
GL_OES_texture_npot := Int_CheckExtension(Extensions, 'GL_OES_texture_npot');
if (GL_OES_texture_npot) then
SupportsMipMap := true
else
Log.LogInfo('OpenGL ES driver does not support mipmapping for NPOT textures. Mipmapping will be disabled', 'TRenderer_OpenGLES.CheckVersion');
end;
SupportsFBO := true;
end;
Expand Down Expand Up @@ -1908,6 +1919,7 @@ procedure TRenderer_OpenGL2.CheckVersion();
GL_ARB_map_buffer_range := Int_CheckExtension(Extensions, 'GL_ARB_map_buffer_range');
if (GL_ARB_map_buffer_range) then
SupportsMappedBuffer := true;
SupportsMipMap := true;
fSupportsProjectM := false;
SupportsFBO := false;
GlyphTextureFormat := GL_LUMINANCE;
Expand Down
Loading