OpenGL modernization: make shaders code compatible with OpenGL ES 2.0

This commit is contained in:
f4exb 2016-03-08 09:17:00 +01:00
parent dcbd61904c
commit f4f8c3d2f5
2 changed files with 8 additions and 8 deletions

View File

@ -103,8 +103,8 @@ void GLShaderSimple::cleanup()
} }
const QString GLShaderSimple::m_vertexShaderSourceSimple = QString( const QString GLShaderSimple::m_vertexShaderSourceSimple = QString(
"uniform mat4 uMatrix;\n" "uniform highp mat4 uMatrix;\n"
"attribute vec4 vertex;\n" "attribute highp vec4 vertex;\n"
"void main() {\n" "void main() {\n"
" gl_Position = uMatrix * vertex;\n" " gl_Position = uMatrix * vertex;\n"
"}\n" "}\n"

View File

@ -125,10 +125,10 @@ void GLShaderTextured::cleanup()
} }
const QString GLShaderTextured::m_vertexShaderSourceTextured = QString( const QString GLShaderTextured::m_vertexShaderSourceTextured = QString(
"uniform mat4 uMatrix;\n" "uniform highp mat4 uMatrix;\n"
"attribute vec4 vertex;\n" "attribute highp vec4 vertex;\n"
"attribute vec2 texCoord;\n" "attribute highp vec2 texCoord;\n"
"varying vec2 texCoordVar;\n" "varying mediump vec2 texCoordVar;\n"
"void main() {\n" "void main() {\n"
" gl_Position = uMatrix * vertex;\n" " gl_Position = uMatrix * vertex;\n"
" texCoordVar = texCoord;\n" " texCoordVar = texCoord;\n"
@ -136,8 +136,8 @@ const QString GLShaderTextured::m_vertexShaderSourceTextured = QString(
); );
const QString GLShaderTextured::m_fragmentShaderSourceTextured = QString( const QString GLShaderTextured::m_fragmentShaderSourceTextured = QString(
"uniform sampler2D uTexture;\n" "uniform lowp sampler2D uTexture;\n"
"varying vec2 texCoordVar;\n" "varying mediump vec2 texCoordVar;\n"
"void main() {\n" "void main() {\n"
" gl_FragColor = texture2D(uTexture, texCoordVar);\n" " gl_FragColor = texture2D(uTexture, texCoordVar);\n"
"}\n" "}\n"