@@ -68,12 +68,15 @@ renderer_type Renderer_type = RENDERER_OPENGL;
6868int WindowGL = 0 ;
6969
7070struct Renderer {
71- Renderer () : shader_{shaders::vertex, shaders::fragment, {
71+ Renderer () : shader_{
72+ std::string{kGlslVersion } + std::string{shaders::vertex},
73+ std::string{kGlslVersion } + std::string{shaders::fragment},
74+ {
7275 vertexAttrib (3 , GL_FLOAT, GL_FALSE, &PosColorUV2Vertex::pos, " in_pos" ),
7376 vertexAttrib (4 , GL_FLOAT, GL_FALSE, &PosColorUV2Vertex::color, " in_color" ),
7477 vertexAttrib (2 , GL_FLOAT, GL_FALSE, &PosColorUV2Vertex::uv0, " in_uv0" ),
7578 vertexAttrib (2 , GL_FLOAT, GL_FALSE, &PosColorUV2Vertex::uv1, " in_uv1" )
76- }} {
79+ }} {
7780 shader_.Use ();
7881
7982 // these are effectively just constants, for now
@@ -143,6 +146,13 @@ struct Renderer {
143146 glm::mat4x4 projection_;
144147 GLint texture_enable_{};
145148 ShaderProgram<PosColorUV2Vertex> shader_;
149+
150+ static constexpr auto kGlslVersion =
151+ #if defined(ANDROID)
152+ shaders::version_300_es;
153+ #else
154+ shaders::version_150_core;
155+ #endif
146156};
147157std::optional<Renderer> gRenderer ;
148158
@@ -424,8 +434,10 @@ int opengl_Setup(oeApplication *app, int *width, int *height) {
424434 SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16 );
425435 SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1 );
426436 SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
437+ #if !defined(ANDROID)
427438 SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 2 );
428439 SDL_GL_SetAttribute (SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
440+ #endif
429441 Uint32 flags = SDL_WINDOW_OPENGL;
430442
431443 if (fullscreen) {
0 commit comments