From 7220ddfa3cd71469d3cf884921524ad531c521eb Mon Sep 17 00:00:00 2001 From: Darafei Praliaskouski Date: Fri, 27 Sep 2013 14:00:54 +0300 Subject: [PATCH] [drape] fixed linux compilation --- drape/attribute_provider.cpp | 2 +- drape/glIncludes.hpp | 22 +++++++++------------- drape/glfunctions.cpp | 11 +++++++++-- drape/pointers.hpp | 2 +- drape/shader_reference.hpp | 1 + drape/texture.hpp | 1 + drape/uniform_value.cpp | 1 + drape/uniform_value.hpp | 1 + drape_head/glwidget.cpp | 6 +++++- 9 files changed, 29 insertions(+), 18 deletions(-) diff --git a/drape/attribute_provider.cpp b/drape/attribute_provider.cpp index 3c0af9f2f4..fbeb4827df 100644 --- a/drape/attribute_provider.cpp +++ b/drape/attribute_provider.cpp @@ -6,7 +6,7 @@ #define CHECK_STREAMS CheckStreams() #define INIT_STREAM(x) InitStream((x)) #else - #include "macros.hpp" + #include "../../base/macros.hpp" #define INIT_CHECK_INFO(x) UNUSED_VALUE((x)) #define CHECK_STREAMS #define INIT_STREAM(x) UNUSED_VALUE((x)) diff --git a/drape/glIncludes.hpp b/drape/glIncludes.hpp index 32e937510e..226d916bba 100644 --- a/drape/glIncludes.hpp +++ b/drape/glIncludes.hpp @@ -1,19 +1,15 @@ #pragma once -#if defined(__APPLE__) - #include - #if (TARGET_OS_IPHONE > 0) - #define USE_OPENGLES20_IF_AVAILABLE 1 - #include - #define OGL_IOS - #else - #include - #include - #define OGL_MAC - #endif -#elif +#include "../std/target_os.hpp" + +#if defined(OMIM_OS_IPHONE) + #define USE_OPENGLES20_IF_AVAILABLE 1 + #include +#elif defined(OMIM_OS_MAC) + #include + #include +#else #define GL_GLEXT_PROTOTYPES #include #include - #define OGL_ANDROID #endif diff --git a/drape/glfunctions.cpp b/drape/glfunctions.cpp index 476a844dc8..b325800fc2 100644 --- a/drape/glfunctions.cpp +++ b/drape/glfunctions.cpp @@ -1,6 +1,9 @@ #include "glfunctions.hpp" #include "glIncludes.hpp" #include "../base/assert.hpp" +#include "../base/logging.hpp" + +#include namespace { @@ -69,11 +72,15 @@ namespace void GLFunctions::Init() { /// VAO -#if defined(OGL_MAC) +#if defined(OMIM_OS_MAC) glGenVertexArraysFn = &glGenVertexArraysAPPLE; glBindVertexArrayFn = &glBindVertexArrayAPPLE; glDeleteVertexArrayFn = &glDeleteVertexArraysAPPLE; -#elif defined(OGL_IOS) || defined(OGL_ANDROID) +#elif defined(OMIM_OS_LINUX) + glGenVertexArraysFn = &::glGenVertexArrays; + glBindVertexArrayFn = &::glBindVertexArray; + glDeleteVertexArrayFn = &::glDeleteVertexArrays; +#elif defined(OMIM_OS_MOBILE) glGenVertexArraysFn = &glGenVertexArraysOES; glBindVertexArrayFn = &glBindVertexArrayOES; glDeleteVertexArrayFn = &glDeleteVertexArraysOES; diff --git a/drape/pointers.hpp b/drape/pointers.hpp index 0edadc764d..5e0aa667de 100644 --- a/drape/pointers.hpp +++ b/drape/pointers.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include "../std/memcpy.hpp" template class ReferencePoiner diff --git a/drape/shader_reference.hpp b/drape/shader_reference.hpp index 7b56293747..e05dede218 100644 --- a/drape/shader_reference.hpp +++ b/drape/shader_reference.hpp @@ -1,6 +1,7 @@ #pragma once #include "../std/string.hpp" +#include "../std/stdint.hpp" class ShaderReference { diff --git a/drape/texture.hpp b/drape/texture.hpp index 4d18f11163..44507b9d5b 100644 --- a/drape/texture.hpp +++ b/drape/texture.hpp @@ -3,6 +3,7 @@ #include "pointers.hpp" #include "../std/string.hpp" +#include "../std/stdint.hpp" struct TextureInfo { diff --git a/drape/uniform_value.cpp b/drape/uniform_value.cpp index e29856f39c..dd88c86c55 100644 --- a/drape/uniform_value.cpp +++ b/drape/uniform_value.cpp @@ -1,6 +1,7 @@ #include "uniform_value.hpp" #include "glfunctions.hpp" #include "../base/assert.hpp" +#include "../std/memcpy.hpp" namespace { diff --git a/drape/uniform_value.hpp b/drape/uniform_value.hpp index d8174047bb..1e7eaac48d 100644 --- a/drape/uniform_value.hpp +++ b/drape/uniform_value.hpp @@ -5,6 +5,7 @@ #include "../std/string.hpp" #include "../std/shared_array.hpp" +#include "../std/memcpy.hpp" class UniformValue { diff --git a/drape_head/glwidget.cpp b/drape_head/glwidget.cpp index 8e59fbb839..0bb99abcdd 100644 --- a/drape_head/glwidget.cpp +++ b/drape_head/glwidget.cpp @@ -56,11 +56,15 @@ void GLWidget::initializeGL() gen.SetProgram(1); gen.SetViewport(-1.0f, -1.0f, 2.0f, 2.0f); gen.SetUniforms(uniforms); - gen.Generate(1000, *m_batcher); + gen.Generate(3000, *m_batcher); } void GLWidget::paintGL() { + glClearDepth(1.0); + glDepthFunc(GL_LEQUAL); + glDepthMask(GL_TRUE); + glEnable(GL_DEPTH_TEST); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (!m_frames.empty())