Turn TMS_USE_GLES compile-time option into a runtime use_gles setting

This of course requires support from the SDL library Principia is linked to, but should still make it more accessible to switch between the two on Linux
This commit is contained in:
ROllerozxa 2026-06-23 23:38:23 +02:00
commit 462369618e
12 changed files with 138 additions and 132 deletions

View file

@ -1202,20 +1202,20 @@ game::init_framebuffers()
this->bloom_fb = 0; this->bloom_fb = 0;
} }
#ifndef TMS_USE_GLES if (!_tms.use_gles) {
if (settings["postprocess"]->v.b) { if (settings["postprocess"]->v.b) {
tms_infof("Postprocess time"); tms_infof("Postprocess time");
this->main_fb = tms_fb_alloc(_tms.window_width, _tms.window_height, 0); this->main_fb = tms_fb_alloc(_tms.window_width, _tms.window_height, 0);
tms_fb_add_texture(this->main_fb, GL_RGBA, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, GL_NEAREST, GL_NEAREST); tms_fb_add_texture(this->main_fb, GL_RGBA, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, GL_NEAREST, GL_NEAREST);
tms_fb_enable_depth(this->main_fb, GL_DEPTH_COMPONENT16); tms_fb_enable_depth(this->main_fb, GL_DEPTH_COMPONENT16);
this->bloom_fb = tms_fb_alloc(_tms.window_width, _tms.window_height, 1); this->bloom_fb = tms_fb_alloc(_tms.window_width, _tms.window_height, 1);
tms_fb_add_texture(this->bloom_fb, GL_RGBA, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, GL_LINEAR, GL_LINEAR); tms_fb_add_texture(this->bloom_fb, GL_RGBA, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, GL_LINEAR, GL_LINEAR);
} else { } else {
this->main_fb = 0; this->main_fb = 0;
this->bloom_fb = 0; this->bloom_fb = 0;
}
} }
#endif
} }
void void
@ -2859,10 +2859,8 @@ game::render()
tms_fb_swap_blur3x3(tms_pipeline_get_framebuffer(3)); tms_fb_swap_blur3x3(tms_pipeline_get_framebuffer(3));
} }
#ifndef TMS_USE_GLES if (!_tms.use_gles && settings["postprocess"]->v.b)
if (settings["postprocess"]->v.b)
tms_fb_bind(this->main_fb); tms_fb_bind(this->main_fb);
#endif
tms_assertf((ierr = glGetError()) == 0, "gl error %d in game::render after shadow/ao", ierr); tms_assertf((ierr = glGetError()) == 0, "gl error %d in game::render after shadow/ao", ierr);
glDisable(GL_BLEND); glDisable(GL_BLEND);
@ -2871,10 +2869,8 @@ game::render()
tms_assertf((ierr = glGetError()) == 0, "gl error %d in game::render before bg", ierr); tms_assertf((ierr = glGetError()) == 0, "gl error %d in game::render before bg", ierr);
#ifndef TMS_USE_GLES if (!_tms.use_gles && settings["gamma_correct"]->v.b && !settings["postprocess"]->v.b)
if (settings["gamma_correct"]->v.b && !settings["postprocess"]->v.b)
glEnable(GL_FRAMEBUFFER_SRGB); glEnable(GL_FRAMEBUFFER_SRGB);
#endif
if (this->state.abo_architect_mode) { if (this->state.abo_architect_mode) {
glClearColor(.25f, .25f, .25f, 1.f); glClearColor(.25f, .25f, .25f, 1.f);
@ -2994,11 +2990,9 @@ game::render()
tms_assertf((ierr = glGetError()) == 0, "gl error %d after render foreground", ierr); tms_assertf((ierr = glGetError()) == 0, "gl error %d after render foreground", ierr);
} }
#ifndef TMS_USE_GLES if (!_tms.use_gles && settings["gamma_correct"]->v.b && !settings["postprocess"]->v.b) {
if (settings["gamma_correct"]->v.b && !settings["postprocess"]->v.b) {
glDisable(GL_FRAMEBUFFER_SRGB); glDisable(GL_FRAMEBUFFER_SRGB);
} }
#endif
glDepthMask(true); glDepthMask(true);
glDisable(GL_BLEND); glDisable(GL_BLEND);
@ -3007,8 +3001,7 @@ game::render()
tms_ddraw_set_matrices(this->dd, this->cam->view, this->cam->projection); tms_ddraw_set_matrices(this->dd, this->cam->view, this->cam->projection);
//tms_ddraw_line3d(this->dd, 0, 0, 0, this->light.x*2.f, this->light.y*2.f, this->light.z*2.f); //tms_ddraw_line3d(this->dd, 0, 0, 0, this->light.x*2.f, this->light.y*2.f, this->light.z*2.f);
#ifndef TMS_USE_GLES if (!_tms.use_gles && settings["postprocess"]->v.b) {
if (settings["postprocess"]->v.b) {
tms_fb_unbind(this->main_fb); tms_fb_unbind(this->main_fb);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
glDisable(GL_BLEND); glDisable(GL_BLEND);
@ -3064,7 +3057,6 @@ game::render()
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
tms_assertf((ierr = glGetError()) == 0, "gl error %d after postprocess", ierr); tms_assertf((ierr = glGetError()) == 0, "gl error %d after postprocess", ierr);
} }
#endif
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND); glEnable(GL_BLEND);

View file

@ -260,19 +260,17 @@ void init_framebuffers() {
if (settings["shadow_map_precision"]->v.i == 0) { if (settings["shadow_map_precision"]->v.i == 0) {
shadow_map_precision = GL_RGB; shadow_map_precision = GL_RGB;
} else if (settings["shadow_map_precision"]->v.i == 1) { } else if (settings["shadow_map_precision"]->v.i == 1) {
#ifdef TMS_USE_GLES if (!_tms.use_gles)
/* Android does not seem to have either GL_RGB16F or GL_RGBA16F defined */ /* Android does not seem to have either GL_RGB16F or GL_RGBA16F defined */
shadow_map_precision = GL_RGB; shadow_map_precision = GL_RGB;
#else else
shadow_map_precision = GL_RGB16F; shadow_map_precision = GL_RGB16F;
#endif
} else if (settings["shadow_map_precision"]->v.i == 2) { } else if (settings["shadow_map_precision"]->v.i == 2) {
#ifdef TMS_USE_GLES if (_tms.use_gles)
/* Android does not seem to have either GL_RGB32F or GL_RGBA32F defined */ /* Android does not seem to have either GL_RGB32F or GL_RGBA32F defined */
shadow_map_precision = GL_RGB; shadow_map_precision = GL_RGB;
#else else
shadow_map_precision = GL_RGB32F; shadow_map_precision = GL_RGB32F;
#endif
} }
tms_fb_add_texture(gi_fb, shadow_map_precision, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, GL_NEAREST, GL_NEAREST); tms_fb_add_texture(gi_fb, shadow_map_precision, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, GL_NEAREST, GL_NEAREST);
@ -1128,46 +1126,49 @@ void tproject_quit() {
} }
void setup_opengl_settings() { void setup_opengl_settings() {
#ifdef TMS_USE_GLES if (_tms.use_gles) {
if (settings["shadow_map_precision"]->is_uninitialized()) { if (settings["shadow_map_precision"]->is_uninitialized()) {
settings["shadow_map_precision"]->v.i = 0;
}
if (settings["shadow_map_depth_texture"]->is_uninitialized()) {
if (strstr(_tms.gl_extensions, "GL_OES_depth_texture") != 0) {
tms_infof("GL_OES_depth_texture: YES");
settings["shadow_map_depth_texture"]->v.b = 1;
} else {
tms_infof("GL_OES_depth_texture: NO");
settings["shadow_map_depth_texture"]->v.b = 0;
}
}
#else
if (settings["shadow_map_precision"]->is_uninitialized()) {
if (strstr(_tms.gl_extensions, "GL_ARB_texture_float") != 0
|| strstr(_tms.gl_extensions, "GL_ATI_texture_float") != 0) {
tms_infof("GL_ARB_texture_float: YES");
settings["shadow_map_precision"]->v.i = 1;
} else {
tms_infof("GL_ARB_texture_float: NO");
settings["shadow_map_precision"]->v.i = 0; settings["shadow_map_precision"]->v.i = 0;
} }
}
if (settings["gamma_correct"]->is_uninitialized()) { if (settings["shadow_map_depth_texture"]->is_uninitialized()) {
if (strstr(_tms.gl_extensions, "GL_EXT_texture_sRGB") != 0 if (strstr(_tms.gl_extensions, "GL_OES_depth_texture") != 0) {
&& strstr(_tms.gl_extensions, "GL_EXT_framebuffer_sRGB") != 0) { tms_infof("GL_OES_depth_texture: YES");
tms_infof("GL_EXT_texture_sRGB+GL_EXT_framebuffer_sRGB: YES"); settings["shadow_map_depth_texture"]->v.b = 1;
settings["gamma_correct"]->v.b = 1; } else {
} else { tms_infof("GL_OES_depth_texture: NO");
tms_infof("GL_EXT_texture_sRGB+GL_EXT_framebuffer_sRGB: NO"); settings["shadow_map_depth_texture"]->v.b = 0;
settings["gamma_correct"]->v.b = 0; }
} }
}
// GL_ARB_depth_texture is OpenGL 1.5+, so we can always assume it to exist on desktop // XXX: We need to really fix gamma correction on GLES...
settings["shadow_map_depth_texture"]->v.b = 1; settings["gamma_correct"]->v.b = 0;
#endif } else {
if (settings["shadow_map_precision"]->is_uninitialized()) {
if (strstr(_tms.gl_extensions, "GL_ARB_texture_float") != 0
|| strstr(_tms.gl_extensions, "GL_ATI_texture_float") != 0) {
tms_infof("GL_ARB_texture_float: YES");
settings["shadow_map_precision"]->v.i = 1;
} else {
tms_infof("GL_ARB_texture_float: NO");
settings["shadow_map_precision"]->v.i = 0;
}
}
if (settings["gamma_correct"]->is_uninitialized()) {
if (strstr(_tms.gl_extensions, "GL_EXT_texture_sRGB") != 0
&& strstr(_tms.gl_extensions, "GL_EXT_framebuffer_sRGB") != 0) {
tms_infof("GL_EXT_texture_sRGB+GL_EXT_framebuffer_sRGB: YES");
settings["gamma_correct"]->v.b = 1;
} else {
tms_infof("GL_EXT_texture_sRGB+GL_EXT_framebuffer_sRGB: NO");
settings["gamma_correct"]->v.b = 0;
}
}
// GL_ARB_depth_texture is OpenGL 1.5+, so we can always assume it to exist on desktop
settings["shadow_map_depth_texture"]->v.b = 1;
}
} }
void tproject_preinit() { void tproject_preinit() {
@ -1176,6 +1177,10 @@ void tproject_preinit() {
if (!settings.load()) if (!settings.load())
tms_infof("ERROR!"); tms_infof("ERROR!");
if (settings["use_gles"]->v.b)
_tms.use_gles = true;
settings.save(); settings.save();
tms_infof("Shadow quality: %d (%dx%d)", tms_infof("Shadow quality: %d (%dx%d)",

View file

@ -1055,14 +1055,14 @@ material_factory::init_shaders()
tms_shader_global_clear_defines(); tms_shader_global_clear_defines();
#ifndef TMS_USE_GLES if (!_tms.use_gles) {
tms_shader_global_define_vs("lowp", ""); tms_shader_global_define_vs("lowp", "");
tms_shader_global_define_fs("lowp", ""); tms_shader_global_define_fs("lowp", "");
tms_shader_global_define_vs("mediump", ""); tms_shader_global_define_vs("mediump", "");
tms_shader_global_define_fs("mediump", ""); tms_shader_global_define_fs("mediump", "");
tms_shader_global_define_vs("highp", ""); tms_shader_global_define_vs("highp", "");
tms_shader_global_define_fs("highp", ""); tms_shader_global_define_fs("highp", "");
#endif }
if (settings["shadow_map_precision"]->v.i == 0 && !settings["shadow_map_depth_texture"]->is_true()) if (settings["shadow_map_precision"]->v.i == 0 && !settings["shadow_map_depth_texture"]->is_true())
tms_shader_global_define("SHADOW_BIAS", ".15"); tms_shader_global_define("SHADOW_BIAS", ".15");

View file

@ -50,8 +50,10 @@ static void apply_very_bad_settings()
#ifdef TMS_USE_GLES #ifdef TMS_USE_GLES
#define GAMMA_CORRECT_DEFAULT false #define GAMMA_CORRECT_DEFAULT false
#define USE_GLES true
#else #else
#define GAMMA_CORRECT_DEFAULT -1 #define GAMMA_CORRECT_DEFAULT -1
#define USE_GLES false
#endif #endif
void void
@ -62,6 +64,8 @@ _settings::init()
/** -Graphics **/ /** -Graphics **/
this->add("debug", S_BOOL, false); this->add("debug", S_BOOL, false);
this->add("use_gles", S_BOOL, USE_GLES);
// Shadows // Shadows
this->add("enable_shadows", S_BOOL, ENABLE_SHADOWS_DEFAULT); this->add("enable_shadows", S_BOOL, ENABLE_SHADOWS_DEFAULT);
this->add("shadow_quality", S_UINT8, 1); this->add("shadow_quality", S_UINT8, 1);

View file

@ -233,27 +233,27 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv)
tms_infof("Device PPCM: %f %f", _tms.xppcm, _tms.yppcm); tms_infof("Device PPCM: %f %f", _tms.xppcm, _tms.yppcm);
#endif #endif
#ifdef TMS_USE_GLES if (_tms.use_gles) {
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
#else } else {
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
#endif }
SDL_GLContext gl_context = SDL_GL_CreateContext(_window); SDL_GLContext gl_context = SDL_GL_CreateContext(_window);
if (gl_context == NULL) if (gl_context == NULL)
tms_fatalf("Error creating GL Context: %s", SDL_GetError()); tms_fatalf("Error creating GL Context: %s", SDL_GetError());
#ifdef TMS_USE_GLES int version;
int version = gladLoadGLES2((GLADloadfunc)SDL_GL_GetProcAddress); if (_tms.use_gles)
#else version = gladLoadGLES2((GLADloadfunc)SDL_GL_GetProcAddress);
int version = gladLoadGL((GLADloadfunc)SDL_GL_GetProcAddress); else
#endif version = gladLoadGL((GLADloadfunc)SDL_GL_GetProcAddress);
tms_infof("Loaded GL version %d.%d", GLAD_VERSION_MAJOR(version), GLAD_VERSION_MINOR(version)); tms_infof("Loaded GL version %d.%d", GLAD_VERSION_MAJOR(version), GLAD_VERSION_MINOR(version));
tms_infof("GL Info: %s/%s/%s", glGetString(GL_VENDOR), glGetString(GL_RENDERER), glGetString(GL_VERSION)); tms_infof("GL Info: %s/%s/%s", glGetString(GL_VENDOR), glGetString(GL_RENDERER), glGetString(GL_VERSION));

View file

@ -700,10 +700,10 @@ tms_fb_add_texture(struct tms_fb *fb, int format,
bufs[y] = GL_COLOR_ATTACHMENT0 + y; bufs[y] = GL_COLOR_ATTACHMENT0 + y;
} }
#ifndef TMS_USE_GLES if (!tms.use_gles) {
glDrawBuffers(fb->num_textures+1, bufs); glDrawBuffers(fb->num_textures+1, bufs);
tms_assertf((ierr = glGetError()) == 0, "gl error %d in tms_fb_add_texture %d 15", ierr, x); tms_assertf((ierr = glGetError()) == 0, "gl error %d in tms_fb_add_texture %d 15", ierr, x);
#endif }
} }
fb->num_textures ++; fb->num_textures ++;

View file

@ -138,7 +138,10 @@ static GLint compile(struct tms_shader *sh, GLenum st, const char *src)
num_src += sh->num_fs_defines + _tms_global_shader.num_fs_defines; num_src += sh->num_fs_defines + _tms_global_shader.num_fs_defines;
char *sources[num_src+1]; char *sources[num_src+1];
sources[0] = TMS_GLSL_HEADER; if (tms.use_gles)
sources[0] = TMS_GLSL_HEADER_GLES;
else
sources[0] = TMS_GLSL_HEADER_GL;
for (int x=0; x<sh->num_defines; x++) for (int x=0; x<sh->num_defines; x++)
sources[1+x] = sh->defines[x]; sources[1+x] = sh->defines[x];

View file

@ -6,15 +6,14 @@
#include <tms/math/vector.h> #include <tms/math/vector.h>
#include <tms/core/tms.h> #include <tms/core/tms.h>
#ifdef TMS_USE_GLES #define TMS_GLSL_HEADER_GLES\
#define TMS_GLSL_HEADER\
"#version 100\n"\ "#version 100\n"\
"precision mediump float;"\ "precision mediump float;"\
"precision mediump int;"\ "precision mediump int;"\
"\n" "\n"
#else
#define TMS_GLSL_HEADER "#version 110\n" #define TMS_GLSL_HEADER_GL "#version 110\n"
#endif
struct tms_mesh_attribute; struct tms_mesh_attribute;

View file

@ -379,22 +379,18 @@ tms_texture_upload(struct tms_texture *tex)
colors = GL_RGB; colors = GL_RGB;
format = GL_RGB; format = GL_RGB;
#ifndef TMS_USE_GLES if (!tms.use_gles && tex->gamma_correction) {
if (tex->gamma_correction) {
format = GL_SRGB; format = GL_SRGB;
} }
#endif
break; break;
case 4: case 4:
colors = GL_RGBA; colors = GL_RGBA;
format = GL_RGBA; format = GL_RGBA;
#ifndef TMS_USE_GLES if (!tms.use_gles && tex->gamma_correction) {
if (tex->gamma_correction) {
format = GL_SRGB8_ALPHA8; format = GL_SRGB8_ALPHA8;
} }
#endif
break; break;
default: default:
@ -408,12 +404,12 @@ tms_texture_upload(struct tms_texture *tex)
glBindTexture(GL_TEXTURE_2D, tex->gl_texture); glBindTexture(GL_TEXTURE_2D, tex->gl_texture);
#ifndef TMS_USE_GLES if (!tms.use_gles) {
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
if (tex->filter == TMS_MIPMAP) { if (tex->filter == TMS_MIPMAP) {
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
}
} }
#endif
glTexImage2D(GL_TEXTURE_2D, 0, format, glTexImage2D(GL_TEXTURE_2D, 0, format,
tex->width, tex->height, tex->width, tex->height,
@ -426,15 +422,16 @@ tms_texture_upload(struct tms_texture *tex)
if (tex->filter == TMS_MIPMAP) { if (tex->filter == TMS_MIPMAP) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
#ifdef TMS_USE_GLES
glGenerateMipmap(GL_TEXTURE_2D);
int err = glGetError(); if (tms.use_gles) {
if (err != 0) { glGenerateMipmap(GL_TEXTURE_2D);
tms_infof("error: could not create mipmaps (%d)", err);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); int err = glGetError();
if (err != 0) {
tms_infof("error: could not create mipmaps (%d)", err);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
} }
#endif
} else { } else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, tex->filter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, tex->filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, tex->filter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, tex->filter);

View file

@ -19,6 +19,7 @@ struct tms_singleton _tms = {
.gl_extensions = "", .gl_extensions = "",
.delta_cap = 0, .delta_cap = 0,
.emulating_portrait = 0, .emulating_portrait = 0,
.use_gles = false
}; };
int tms_preinit(void) { int tms_preinit(void) {
@ -38,14 +39,15 @@ tms_init(void)
tmat4_set_ortho(tms.window_projection, 0, tms.window_width, 0, tms.window_height, 1, -1); tmat4_set_ortho(tms.window_projection, 0, tms.window_width, 0, tms.window_height, 1, -1);
#ifndef TMS_USE_GLES
tms_shader_global_define_vs("lowp", ""); if (!tms.use_gles) {
tms_shader_global_define_fs("lowp", ""); tms_shader_global_define_vs("lowp", "");
tms_shader_global_define_vs("mediump", ""); tms_shader_global_define_fs("lowp", "");
tms_shader_global_define_fs("mediump", ""); tms_shader_global_define_vs("mediump", "");
tms_shader_global_define_vs("highp", ""); tms_shader_global_define_fs("mediump", "");
tms_shader_global_define_fs("highp", ""); tms_shader_global_define_vs("highp", "");
#endif tms_shader_global_define_fs("highp", "");
}
tproject_init(); tproject_init();
tproject_init_pipelines(); tproject_init_pipelines();

View file

@ -91,6 +91,11 @@ extern struct tms_singleton {
int emulating_portrait; int emulating_portrait;
int in_frame; int in_frame;
/// Whether to use OpenGL ES 2.0 or not. (False uses desktop OpenGL 2.1+ codepaths)
/// This variable is set from the "use_gles" setting during preinit and is the same as
/// `settings["use_gles"]->v.b`, but is also available in TMS code.
bool use_gles;
float window_projection[16]; float window_projection[16];
struct tms_screen *screen; /**< current screen */ struct tms_screen *screen; /**< current screen */
struct tms_screen *active_screen; struct tms_screen *active_screen;

View file

@ -1,5 +1,6 @@
#include "varray.h" #include "varray.h"
#include "gbuffer.h" #include "gbuffer.h"
#include "tms.h"
#include <string.h> #include <string.h>
#include <tms/core/err.h> #include <tms/core/err.h>
@ -117,12 +118,10 @@ tms_varray_bind_attributes(struct tms_varray *va,
; ;
} }
#ifndef TMS_USE_GLES if (!tms.use_gles && (m->component_type == GL_UNSIGNED_INT || m->component_type == GL_INT))
if (m->component_type == GL_UNSIGNED_INT || m->component_type == GL_INT)
glVertexAttribIPointer(locations[x], m->num_components, m->component_type, glVertexAttribIPointer(locations[x], m->num_components, m->component_type,
bufdata->vsize, (void*)(uintptr_t)m->offset); bufdata->vsize, (void*)(uintptr_t)m->offset);
else else
#endif
glVertexAttribPointer(locations[x], m->num_components, m->component_type, glVertexAttribPointer(locations[x], m->num_components, m->component_type,
0, bufdata->vsize, (void*)(uintptr_t)m->offset); 0, bufdata->vsize, (void*)(uintptr_t)m->offset);