diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index a2497ef8..ae51645f 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -79,7 +79,7 @@ IF(WIN32) ENDIF(NO_CONSOLE) ELSE(WIN32) SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -rdynamic") - SET(ADDITIONAL_LIBRARIES pthread) + SET(ADDITIONAL_LIBRARIES pthread X11) SET(framework_SOURCES ${framework_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/platform/x11window.cpp) ENDIF(WIN32) diff --git a/src/framework/graphics/painter.cpp b/src/framework/graphics/painter.cpp index 3a439513..207f2da4 100644 --- a/src/framework/graphics/painter.cpp +++ b/src/framework/graphics/painter.cpp @@ -36,10 +36,8 @@ void Painter::init() setCompositionMode(CompositionMode_SourceOver); PainterShaderProgramPtr program = PainterShaderProgramPtr(new PainterShaderProgram); - program->addShaderFromSourceCode(Shader::Vertex, glslMainWithTexCoordsVertexShader); - program->addShaderFromSourceCode(Shader::Vertex, glslPositionOnlyVertexShader); - program->addShaderFromSourceCode(Shader::Fragment, glslMainFragmentShader); - program->addShaderFromSourceCode(Shader::Fragment, glslTextureSrcFragmentShader); + program->addShaderFromSourceCode(Shader::Vertex, glslMainWithTexCoordsVertexShader + glslPositionOnlyVertexShader); + program->addShaderFromSourceCode(Shader::Fragment, glslMainFragmentShader + glslTextureSrcFragmentShader); program->bindAttributeLocation(VERTEX_COORDS_ATTR, "vertexCoord"); program->bindAttributeLocation(TEXTURE_COORDS_ATTR, "textureCoord"); assert(program->link()); @@ -51,10 +49,8 @@ void Painter::init() m_drawTexturedProgram = program; program = PainterShaderProgramPtr(new PainterShaderProgram); - program->addShaderFromSourceCode(Shader::Vertex, glslMainVertexShader); - program->addShaderFromSourceCode(Shader::Vertex, glslPositionOnlyVertexShader); - program->addShaderFromSourceCode(Shader::Fragment, glslMainFragmentShader); - program->addShaderFromSourceCode(Shader::Fragment, glslSolidColorFragmentShader); + program->addShaderFromSourceCode(Shader::Vertex, glslMainVertexShader + glslPositionOnlyVertexShader); + program->addShaderFromSourceCode(Shader::Fragment, glslMainFragmentShader + glslSolidColorFragmentShader); program->bindAttributeLocation(VERTEX_COORDS_ATTR, "vertexCoord"); assert(program->link()); program->bindUniformLocation(PainterShaderProgram::PROJECTION_MATRIX_UNIFORM, "projectionMatrix"); diff --git a/src/framework/graphics/paintershadersources.h b/src/framework/graphics/paintershadersources.h index a020be4b..667d35ca 100644 --- a/src/framework/graphics/paintershadersources.h +++ b/src/framework/graphics/paintershadersources.h @@ -29,13 +29,13 @@ static int COLOR_UNIFORM = 2; static int OPACITY_UNIFORM = 3; static int TEXTURE_UNIFORM = 4; -static const char *glslMainVertexShader = "\n\ +static const std::string glslMainVertexShader = "\n\ vec4 calculatePosition();\n\ void main() {\n\ gl_Position = calculatePosition();\n\ }\n"; -static const char *glslMainWithTexCoordsVertexShader = "\n\ +static const std::string glslMainWithTexCoordsVertexShader = "\n\ attribute vec2 textureCoord;\n\ uniform mat2 textureTransformMatrix;\n\ varying vec2 textureCoords;\n\ @@ -46,14 +46,16 @@ static const char *glslMainWithTexCoordsVertexShader = "\n\ textureCoords = textureTransformMatrix * textureCoord;\n\ }\n"; -static const char *glslPositionOnlyVertexShader = "\n\ +static std::string glslPositionOnlyVertexShader = "\n\ attribute vec2 vertexCoord;\n\ uniform mat3 projectionMatrix;\n\ vec4 calculatePosition() {\n\ return vec4(projectionMatrix * vec3(vertexCoord.xy, 1), 1);\n\ }\n"; -static const char *glslMainFragmentShader = "\n\ +static const std::string glslMainFragmentShader = "\n\ + precision lowp vec4;\n\ + precision lowp float;\n\ uniform float opacity;\n\ vec4 calculatePixel();\n\ void main()\n\ @@ -61,7 +63,8 @@ static const char *glslMainFragmentShader = "\n\ gl_FragColor = calculatePixel() * opacity;\n\ }\n"; -static const char *glslTextureSrcFragmentShader = "\n\ +static const std::string glslTextureSrcFragmentShader = "\n\ + precision mediump vec2;\n\ varying vec2 textureCoords;\n\ uniform vec4 color;\n\ uniform sampler2D texture;\n\ @@ -69,7 +72,7 @@ static const char *glslTextureSrcFragmentShader = "\n\ return texture2D(texture, textureCoords) * color;\n\ }\n"; -static const char *glslSolidColorFragmentShader = "\n\ +static const std::string glslSolidColorFragmentShader = "\n\ uniform vec4 color;\n\ vec4 calculatePixel() {\n\ return color;\n\ diff --git a/src/framework/platform/x11window.cpp b/src/framework/platform/x11window.cpp index 09f6ed12..5e36c4a0 100644 --- a/src/framework/platform/x11window.cpp +++ b/src/framework/platform/x11window.cpp @@ -340,7 +340,7 @@ void X11Window::internalChooseGLVisual() m_rootWindow = RootWindow(m_display, m_visual->screen); #else static int attrList[] = { - EGL_BUFFER_SIZE, 24, + //EGL_BUFFER_SIZE, 24, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE };