Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/jni/com/mapswithme/maps/Framework.cpp2
-rw-r--r--android/jni/nv_event/nv_event.cpp20
-rw-r--r--android/src/com/nvidia/devtech/NvEventQueueActivity.java10
-rw-r--r--iphone/Maps/Classes/EAGLView.mm2
-rw-r--r--map/partial_render_policy.cpp20
-rw-r--r--map/render_policy_mt.cpp4
-rw-r--r--map/render_policy_st.cpp4
-rw-r--r--map/render_queue_routine.cpp1
-rw-r--r--map/tiling_render_policy_mt.cpp8
-rw-r--r--map/tiling_render_policy_st.cpp8
-rw-r--r--platform/platform.pro1
-rw-r--r--qt/draw_widget.hpp4
-rw-r--r--qt/widgets.cpp3
-rw-r--r--qt/widgets.hpp6
-rw-r--r--qt_tstfrm/macros.hpp2
-rw-r--r--qt_tstfrm/qt_tstfrm.pro2
-rw-r--r--qt_tstfrm/tstwidgets.cpp8
-rw-r--r--yg/base_texture.cpp23
-rw-r--r--yg/base_texture.hpp2
-rw-r--r--yg/blitter.cpp59
-rw-r--r--yg/blitter.hpp2
-rw-r--r--yg/defines.hpp2
-rw-r--r--yg/framebuffer.cpp32
-rw-r--r--yg/framebuffer.hpp6
-rw-r--r--yg/geometry_batcher.hpp2
-rw-r--r--yg/render_state_updater.cpp23
-rw-r--r--yg/render_state_updater.hpp4
-rw-r--r--yg/renderbuffer.cpp57
-rw-r--r--yg/renderbuffer.hpp3
-rw-r--r--yg/renderer.cpp8
-rw-r--r--yg/renderer.hpp12
-rw-r--r--yg/vertex.hpp11
-rw-r--r--yg/yg_tests/screengl_test.cpp2
-rw-r--r--yg/yg_tests/thread_render.cpp4
34 files changed, 186 insertions, 171 deletions
diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp
index 0f0b69ec8c..93dc72efe0 100644
--- a/android/jni/com/mapswithme/maps/Framework.cpp
+++ b/android/jni/com/mapswithme/maps/Framework.cpp
@@ -78,7 +78,7 @@ namespace android
LOG(LDEBUG, ("AF::InitRenderer 1"));
yg::ResourceManager::Params rmParams;
- rmParams.m_videoMemoryLimit = 15 * 1024 * 1024;
+ rmParams.m_videoMemoryLimit = 20 * 1024 * 1024;
rmParams.m_rtFormat = yg::Data8Bpp;
rmParams.m_texFormat = yg::Data4Bpp;
diff --git a/android/jni/nv_event/nv_event.cpp b/android/jni/nv_event/nv_event.cpp
index 3fe9b6ccec..fe8c9de150 100644
--- a/android/jni/nv_event/nv_event.cpp
+++ b/android/jni/nv_event/nv_event.cpp
@@ -860,30 +860,10 @@ void InitNVEvent(JavaVM* vm)
(void *) onDestroyNative
},
{
- "postUserEvent",
- "(IIIIZ)Z",
- (void *) postUserEvent
- },
- {
- "touchEvent",
- "(IIILandroid/view/MotionEvent;)Z",
- (void *) NVEventTouchEvent
- },
- {
"multiTouchEvent",
"(IZZIIIILandroid/view/MotionEvent;)Z",
(void *) NVEventMultiTouchEvent
},
- {
- "keyEvent",
- "(IIILandroid/view/KeyEvent;)Z",
- (void *) NVEventKeyEvent
- },
- {
- "accelerometerEvent",
- "(FFF)Z",
- (void *) NVEventAccelerometerEvent
- },
};
jclass k;
diff --git a/android/src/com/nvidia/devtech/NvEventQueueActivity.java b/android/src/com/nvidia/devtech/NvEventQueueActivity.java
index ecdc82ad60..8e4f279baf 100644
--- a/android/src/com/nvidia/devtech/NvEventQueueActivity.java
+++ b/android/src/com/nvidia/devtech/NvEventQueueActivity.java
@@ -275,17 +275,17 @@ public abstract class NvEventQueueActivity
}
/** The number of bits requested for the red component */
- protected int redSize = 8;
+ protected int redSize = 5;
/** The number of bits requested for the green component */
- protected int greenSize = 8;
+ protected int greenSize = 6;
/** The number of bits requested for the blue component */
- protected int blueSize = 8;
+ protected int blueSize = 5;
/** The number of bits requested for the alpha component */
- protected int alphaSize = 8;
+ protected int alphaSize = 0;
/** The number of bits requested for the stencil component */
protected int stencilSize = 8;
/** The number of bits requested for the depth component */
- protected int depthSize = 24;
+ protected int depthSize = 16;
/** Attributes used when selecting the EGLConfig */
protected int[] configAttrs = null;
diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm
index f1203026b4..a51621c995 100644
--- a/iphone/Maps/Classes/EAGLView.mm
+++ b/iphone/Maps/Classes/EAGLView.mm
@@ -131,7 +131,7 @@
shared_ptr<DrawerYG> drawer = framework->GetRenderPolicy()->GetDrawer();
drawer->screen()->beginFrame();
- drawer->screen()->clear();
+ drawer->screen()->clear(yg::gl::Screen::s_bgColor);
drawer->screen()->endFrame();
}
diff --git a/map/partial_render_policy.cpp b/map/partial_render_policy.cpp
index 1bebf10516..baea683278 100644
--- a/map/partial_render_policy.cpp
+++ b/map/partial_render_policy.cpp
@@ -6,6 +6,7 @@
#include "../yg/internal/opengl.hpp"
#include "../yg/render_state.hpp"
+#include "../yg/base_texture.hpp"
#include "../geometry/transformations.hpp"
@@ -29,7 +30,7 @@ PartialRenderPolicy::PartialRenderPolicy(VideoTimer * videoTimer,
4,
true,
false,
- 1,
+ 2,
"primaryStorage");
rmp.m_smallStoragesParams = yg::ResourceManager::StoragePoolParams(2000 * sizeof(yg::gl::Vertex),
@@ -39,11 +40,11 @@ PartialRenderPolicy::PartialRenderPolicy(VideoTimer * videoTimer,
4,
true,
false,
- 3,
+ 1,
"smallStorage");
- rmp.m_blitStoragesParams = yg::ResourceManager::StoragePoolParams(10 * sizeof(yg::gl::AuxVertex),
- sizeof(yg::gl::AuxVertex),
+ rmp.m_blitStoragesParams = yg::ResourceManager::StoragePoolParams(10 * sizeof(yg::gl::Vertex),
+ sizeof(yg::gl::Vertex),
10 * sizeof(unsigned short),
sizeof(unsigned short),
50,
@@ -122,7 +123,7 @@ PartialRenderPolicy::PartialRenderPolicy(VideoTimer * videoTimer,
m_renderQueue.reset(new RenderQueue(GetPlatform().SkinName(),
false,
- true,
+ false,
0.1,
false,
GetPlatform().ScaleEtalonSize(),
@@ -216,10 +217,12 @@ void PartialRenderPolicy::DrawFrame(shared_ptr<PaintEvent> const & e,
{
m_currentPacket.m_state->m_isDebugging = m_IsDebugging;
m_currentPacket.m_state->apply(m_curState.get());
+// OGLCHECK(glFinish());
m_curState = m_currentPacket.m_state;
}
m_currentPacket.m_command->setIsDebugging(m_IsDebugging);
m_currentPacket.m_command->perform();
+// OGLCHECK(glFinish());
}
else
break;
@@ -245,11 +248,11 @@ void PartialRenderPolicy::DrawFrame(shared_ptr<PaintEvent> const & e,
guard.Signal();
}
- OGLCHECK(glFinish());
+// OGLCHECK(glFinish());
m_state->apply(m_curState.get());
- OGLCHECK(glFinish());
+// OGLCHECK(glFinish());
/// blitting actualTarget
@@ -264,6 +267,8 @@ void PartialRenderPolicy::DrawFrame(shared_ptr<PaintEvent> const & e,
if (m_renderQueue->renderState().m_actualTarget.get() != 0)
{
+ if (m_IsDebugging)
+ LOG(LINFO, ("actualTarget: ", m_renderQueue->renderState().m_actualTarget->id()));
m2::PointD const ptShift = m_renderQueue->renderState().coordSystemShift(false);
math::Matrix<double, 3, 3> m = m_renderQueue->renderState().m_actualScreen.PtoGMatrix() * s.GtoPMatrix();
@@ -273,7 +278,6 @@ void PartialRenderPolicy::DrawFrame(shared_ptr<PaintEvent> const & e,
}
OGLCHECK(glFinish());
-
}
void PartialRenderPolicy::BeginFrame(shared_ptr<PaintEvent> const & paintEvent,
diff --git a/map/render_policy_mt.cpp b/map/render_policy_mt.cpp
index e5caa8a0aa..33993cd1c4 100644
--- a/map/render_policy_mt.cpp
+++ b/map/render_policy_mt.cpp
@@ -42,8 +42,8 @@ RenderPolicyMT::RenderPolicyMT(VideoTimer * videoTimer,
5,
"smallStorage");
- rmp.m_blitStoragesParams = yg::ResourceManager::StoragePoolParams(10 * sizeof(yg::gl::AuxVertex),
- sizeof(yg::gl::AuxVertex),
+ rmp.m_blitStoragesParams = yg::ResourceManager::StoragePoolParams(10 * sizeof(yg::gl::Vertex),
+ sizeof(yg::gl::Vertex),
10 * sizeof(unsigned short),
sizeof(unsigned short),
7,
diff --git a/map/render_policy_st.cpp b/map/render_policy_st.cpp
index 9439dd29dd..222c0467fb 100644
--- a/map/render_policy_st.cpp
+++ b/map/render_policy_st.cpp
@@ -41,8 +41,8 @@ RenderPolicyST::RenderPolicyST(VideoTimer * videoTimer,
1,
"smallStorage");
- rmp.m_blitStoragesParams = yg::ResourceManager::StoragePoolParams(10 * sizeof(yg::gl::AuxVertex),
- sizeof(yg::gl::AuxVertex),
+ rmp.m_blitStoragesParams = yg::ResourceManager::StoragePoolParams(10 * sizeof(yg::gl::Vertex),
+ sizeof(yg::gl::Vertex),
10 * sizeof(unsigned short),
sizeof(unsigned short),
50,
diff --git a/map/render_queue_routine.cpp b/map/render_queue_routine.cpp
index bd5efc75c8..b8f5f0e235 100644
--- a/map/render_queue_routine.cpp
+++ b/map/render_queue_routine.cpp
@@ -222,6 +222,7 @@ void RenderQueueRoutine::Do()
params.m_frameBuffer = m_frameBuffer;
params.m_renderState = m_renderState;
params.m_doPeriodicalUpdate = m_doPeriodicalUpdate;
+ params.m_auxFrameBuffer = m_auxFrameBuffer;
params.m_updateInterval = m_updateInterval;
params.m_skinName = m_skinName;
params.m_visualScale = m_visualScale;
diff --git a/map/tiling_render_policy_mt.cpp b/map/tiling_render_policy_mt.cpp
index 1f4c9fea7c..616a1c2c0e 100644
--- a/map/tiling_render_policy_mt.cpp
+++ b/map/tiling_render_policy_mt.cpp
@@ -42,8 +42,8 @@ TilingRenderPolicyMT::TilingRenderPolicyMT(VideoTimer * videoTimer,
1,
"smallStorage");
- rmp.m_blitStoragesParams = yg::ResourceManager::StoragePoolParams(10 * sizeof(yg::gl::AuxVertex),
- sizeof(yg::gl::AuxVertex),
+ rmp.m_blitStoragesParams = yg::ResourceManager::StoragePoolParams(10 * sizeof(yg::gl::Vertex),
+ sizeof(yg::gl::Vertex),
10 * sizeof(unsigned short),
sizeof(unsigned short),
50,
@@ -52,8 +52,8 @@ TilingRenderPolicyMT::TilingRenderPolicyMT(VideoTimer * videoTimer,
1,
"blitStorage");
- rmp.m_multiBlitStoragesParams = yg::ResourceManager::StoragePoolParams(500 * sizeof(yg::gl::AuxVertex),
- sizeof(yg::gl::AuxVertex),
+ rmp.m_multiBlitStoragesParams = yg::ResourceManager::StoragePoolParams(500 * sizeof(yg::gl::Vertex),
+ sizeof(yg::gl::Vertex),
500 * sizeof(unsigned short),
sizeof(unsigned short),
10,
diff --git a/map/tiling_render_policy_st.cpp b/map/tiling_render_policy_st.cpp
index 765d54794d..b16b187ee3 100644
--- a/map/tiling_render_policy_st.cpp
+++ b/map/tiling_render_policy_st.cpp
@@ -44,8 +44,8 @@ TilingRenderPolicyST::TilingRenderPolicyST(VideoTimer * videoTimer,
1,
"smallStorage");
- rmp.m_blitStoragesParams = yg::ResourceManager::StoragePoolParams(10 * sizeof(yg::gl::AuxVertex),
- sizeof(yg::gl::AuxVertex),
+ rmp.m_blitStoragesParams = yg::ResourceManager::StoragePoolParams(10 * sizeof(yg::gl::Vertex),
+ sizeof(yg::gl::Vertex),
10 * sizeof(unsigned short),
sizeof(unsigned short),
50,
@@ -54,8 +54,8 @@ TilingRenderPolicyST::TilingRenderPolicyST(VideoTimer * videoTimer,
1,
"blitStorage");
- rmp.m_multiBlitStoragesParams = yg::ResourceManager::StoragePoolParams(500 * sizeof(yg::gl::AuxVertex),
- sizeof(yg::gl::AuxVertex),
+ rmp.m_multiBlitStoragesParams = yg::ResourceManager::StoragePoolParams(500 * sizeof(yg::gl::Vertex),
+ sizeof(yg::gl::Vertex),
500 * sizeof(unsigned short),
sizeof(unsigned short),
10,
diff --git a/platform/platform.pro b/platform/platform.pro
index 8c10b98b6d..2b0da32c5c 100644
--- a/platform/platform.pro
+++ b/platform/platform.pro
@@ -69,4 +69,3 @@ SOURCES += \
video_timer.cpp \
http_request.cpp \
chunks_download_strategy.cpp \
- pthread_video_timer.cpp \
diff --git a/qt/draw_widget.hpp b/qt/draw_widget.hpp
index 4d0b96f20d..26fbbef062 100644
--- a/qt/draw_widget.hpp
+++ b/qt/draw_widget.hpp
@@ -1,16 +1,18 @@
#pragma once
-#include "widgets.hpp"
+//#include "widgets.hpp"
#include "../map/window_handle.hpp"
#include "../map/framework.hpp"
#include "../map/navigator.hpp"
+#include "../map/qgl_render_context.hpp"
#include "../platform/video_timer.hpp"
#include "../std/scoped_ptr.hpp"
#include <QtCore/QTimer>
+#include <QtOpenGL/qgl.h>
namespace qt
{
diff --git a/qt/widgets.cpp b/qt/widgets.cpp
index 28fdb81848..3e3c82ad20 100644
--- a/qt/widgets.cpp
+++ b/qt/widgets.cpp
@@ -1,4 +1,4 @@
-#include "widgets.hpp"
+/*#include "widgets.hpp"
#include "../qt_tstfrm/widgets_impl.hpp"
@@ -45,3 +45,4 @@ namespace qt
return m_resourceManager;
}
}
+*/
diff --git a/qt/widgets.hpp b/qt/widgets.hpp
index cb56361f87..505cac429b 100644
--- a/qt/widgets.hpp
+++ b/qt/widgets.hpp
@@ -1,7 +1,7 @@
#pragma once
-#include "../qt_tstfrm/widgets.hpp"
-#include "../map/qgl_render_context.hpp"
+//#include "../qt_tstfrm/widgets.hpp"
+/*#include "../map/qgl_render_context.hpp"
#include "../yg/resource_manager.hpp"
class DrawerYG;
@@ -42,4 +42,4 @@ namespace qt
protected:
virtual void initializeGL();
};
-}
+}*/
diff --git a/qt_tstfrm/macros.hpp b/qt_tstfrm/macros.hpp
index 7cede26627..8046cf7e7d 100644
--- a/qt_tstfrm/macros.hpp
+++ b/qt_tstfrm/macros.hpp
@@ -110,7 +110,7 @@ public:
virtual void DoDraw(shared_ptr<yg::gl::Screen> p)
{
p->beginFrame();
- p->clear();
+ p->clear(yg::gl::Screen::s_bgColor);
test.DoDraw(p);
p->endFrame();
}
diff --git a/qt_tstfrm/qt_tstfrm.pro b/qt_tstfrm/qt_tstfrm.pro
index de6c164d09..172b935503 100644
--- a/qt_tstfrm/qt_tstfrm.pro
+++ b/qt_tstfrm/qt_tstfrm.pro
@@ -21,3 +21,5 @@ SOURCES += \
main_tester.cpp \
tstwidgets.cpp \
screen_qt.cpp \
+
+
diff --git a/qt_tstfrm/tstwidgets.cpp b/qt_tstfrm/tstwidgets.cpp
index 3f7205c9d4..4512a8f9bd 100644
--- a/qt_tstfrm/tstwidgets.cpp
+++ b/qt_tstfrm/tstwidgets.cpp
@@ -62,8 +62,8 @@ void GLDrawWidget::initializeGL()
1,
"smallStorage");
- rmp.m_blitStoragesParams = yg::ResourceManager::StoragePoolParams(10 * sizeof(yg::gl::AuxVertex),
- sizeof(yg::gl::AuxVertex),
+ rmp.m_blitStoragesParams = yg::ResourceManager::StoragePoolParams(10 * sizeof(yg::gl::Vertex),
+ sizeof(yg::gl::Vertex),
10 * sizeof(unsigned short),
sizeof(unsigned short),
30,
@@ -72,8 +72,8 @@ void GLDrawWidget::initializeGL()
1,
"blitStorage");
- rmp.m_multiBlitStoragesParams = yg::ResourceManager::StoragePoolParams(500 * sizeof(yg::gl::AuxVertex),
- sizeof(yg::gl::AuxVertex),
+ rmp.m_multiBlitStoragesParams = yg::ResourceManager::StoragePoolParams(500 * sizeof(yg::gl::Vertex),
+ sizeof(yg::gl::Vertex),
500 * sizeof(unsigned short),
sizeof(unsigned short),
10,
diff --git a/yg/base_texture.cpp b/yg/base_texture.cpp
index a832e33fe8..589af77b8a 100644
--- a/yg/base_texture.cpp
+++ b/yg/base_texture.cpp
@@ -3,21 +3,13 @@
#include "internal/opengl.hpp"
#include "base_texture.hpp"
#include "utils.hpp"
+#include "../base/logging.hpp"
namespace yg
{
namespace gl
{
- void BaseTexture::checkID() const
- {
- if (!m_hasID)
- {
- m_hasID = true;
- init();
- }
- }
-
void BaseTexture::init() const
{
OGLCHECK(glGenTextures(1, &m_id));
@@ -31,20 +23,20 @@ namespace yg
}
BaseTexture::BaseTexture(m2::PointU const & size)
- : m_id(0), m_hasID(false), m_width(size.x), m_height(size.y)
+ : m_id(0), m_width(size.x), m_height(size.y)
{
-// init();
+ init();
}
BaseTexture::BaseTexture(unsigned width, unsigned height)
- : m_id(0), m_hasID(false), m_width(width), m_height(height)
+ : m_id(0), m_width(width), m_height(height)
{
-// init();
+ init();
}
BaseTexture::~BaseTexture()
{
- if ((m_hasID) && (g_doDeleteOnDestroy))
+ if (g_doDeleteOnDestroy)
OGLCHECK(glDeleteTextures(1, &m_id));
}
@@ -60,7 +52,6 @@ namespace yg
void BaseTexture::attachToFrameBuffer()
{
- checkID();
OGLCHECK(glFramebufferTexture2DFn(GL_FRAMEBUFFER_MWM,
GL_COLOR_ATTACHMENT0_MWM, GL_TEXTURE_2D, id(), 0));
utils::setupCoordinates(width(), height(), false);
@@ -75,7 +66,6 @@ namespace yg
void BaseTexture::makeCurrent() const
{
- checkID();
#ifndef OMIM_OS_ANDROID
if (current() != m_id)
#endif
@@ -84,7 +74,6 @@ namespace yg
unsigned BaseTexture::id() const
{
- checkID();
return m_id;
}
diff --git a/yg/base_texture.hpp b/yg/base_texture.hpp
index ae68553539..1dbefdc4c8 100644
--- a/yg/base_texture.hpp
+++ b/yg/base_texture.hpp
@@ -15,7 +15,6 @@ namespace yg
/// OpenGL texture ID
mutable unsigned m_id;
- mutable bool m_hasID;
/// texture dimensions
/// @{
unsigned m_width;
@@ -23,7 +22,6 @@ namespace yg
/// @}
void init() const;
- void checkID() const;
public:
diff --git a/yg/blitter.cpp b/yg/blitter.cpp
index e2ba491b50..be745c89cd 100644
--- a/yg/blitter.cpp
+++ b/yg/blitter.cpp
@@ -9,6 +9,7 @@
#include "utils.hpp"
#include "storage.hpp"
#include "vertex.hpp"
+#include "defines.hpp"
#include "texture.hpp"
#include "../geometry/screenbase.hpp"
@@ -49,6 +50,7 @@ namespace yg
m_texture = texture;
m_hasTexture = true;
m_hasColor = false;
+ m_color = yg::Color(255, 255, 255, 255);
m_resourceManager = rm;
}
@@ -112,24 +114,26 @@ namespace yg
yg::gl::Storage storage = resourceManager()->multiBlitStorages()->Reserve();
- AuxVertex * pointsData = (AuxVertex*)storage.m_vertices->lock();
+ Vertex * pointsData = (Vertex*)storage.m_vertices->lock();
for (size_t i = 0; i < s * 4; ++i)
{
pointsData[i].pt.x = geomPts[i].x;
pointsData[i].pt.y = geomPts[i].y;
- pointsData[i].texPt.x = texPts[i].x;
- pointsData[i].texPt.y = texPts[i].y;
- pointsData[i].color = yg::Color(255, 255, 255, 255);
+ pointsData[i].depth = yg::maxDepth;
+ pointsData[i].tex.x = texPts[i].x;
+ pointsData[i].tex.y = texPts[i].y;
+// pointsData[i].color = yg::Color(255, 255, 255, 255);
}
storage.m_vertices->unlock();
storage.m_vertices->makeCurrent();
- setupAuxVertexLayout(false, true, storage.m_vertices->glPtr());
+ Vertex::setupLayout(storage.m_vertices->glPtr());
OGLCHECK(glDisable(GL_BLEND));
OGLCHECK(glDisable(GL_DEPTH_TEST));
+ OGLCHECK(glDepthMask(GL_FALSE));
memcpy(storage.m_indices->lock(), &idxData[0], idxData.size() * sizeof(unsigned short));
@@ -147,6 +151,7 @@ namespace yg
OGLCHECK(glEnable(GL_DEPTH_TEST));
OGLCHECK(glEnable(GL_TEXTURE_2D));
OGLCHECK(glEnable(GL_BLEND));
+ OGLCHECK(glDepthMask(GL_TRUE));
// /// This call is necessary to avoid parasite blitting in updateActualTarget() on IPhone.
// OGLCHECK(glFinish());
@@ -290,31 +295,6 @@ namespace yg
processCommand(command);
}
- void Blitter::setupAuxVertexLayout(bool hasColor, bool hasTexture, void * glPtr)
- {
- OGLCHECK(glEnableClientState(GL_VERTEX_ARRAY));
- OGLCHECK(glVertexPointer(2, GL_FLOAT, sizeof(AuxVertex), (void*)((char*)glPtr + AuxVertex::vertexOffs)));
-
- if (hasColor)
- {
- OGLCHECK(glEnableClientState(GL_COLOR_ARRAY));
- OGLCHECK(glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(AuxVertex), (void*)((char*)glPtr + AuxVertex::colorOffs)));
- }
- else
- OGLCHECK(glDisableClientState(GL_COLOR_ARRAY));
-
- if (hasTexture)
- {
- OGLCHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
- OGLCHECK(glTexCoordPointer(2, GL_FLOAT, sizeof(AuxVertex), (void*)((char*)glPtr + AuxVertex::texCoordsOffs)));
- }
- else
- {
- OGLCHECK(glDisableClientState(GL_TEXTURE_COORD_ARRAY));
- OGLCHECK(glDisable(GL_TEXTURE_2D));
- }
- }
-
void Blitter::IMMDrawTexturedPrimitives::perform()
{
if (isDebugging())
@@ -327,36 +307,43 @@ namespace yg
if (!blitStorage.m_indices->isLocked())
blitStorage.m_indices->lock();
- AuxVertex * pointsData = (AuxVertex*)blitStorage.m_vertices->data();
+ Vertex * pointsData = (Vertex*)blitStorage.m_vertices->data();
for (size_t i = 0; i < m_ptsCount; ++i)
{
pointsData[i].pt.x = m_pts[i].x;
pointsData[i].pt.y = m_pts[i].y;
- pointsData[i].texPt.x = m_texPts[i].x;
- pointsData[i].texPt.y = m_texPts[i].y;
- pointsData[i].color = m_color;
+ pointsData[i].depth = yg::maxDepth;
+ pointsData[i].tex.x = m_texPts[i].x;
+ pointsData[i].tex.y = m_texPts[i].y;
}
blitStorage.m_vertices->unlock();
blitStorage.m_vertices->makeCurrent();
- Blitter::setupAuxVertexLayout(m_hasColor, m_hasTexture, blitStorage.m_vertices->glPtr());
+ Vertex::setupLayout(blitStorage.m_vertices->glPtr());
if (m_texture)
+ {
+ OGLCHECK(glEnable(GL_TEXTURE_2D));
m_texture->makeCurrent();
+ }
unsigned short idxData[4] = {0, 1, 2, 3};
memcpy(blitStorage.m_indices->data(), idxData, sizeof(idxData));
blitStorage.m_indices->unlock();
blitStorage.m_indices->makeCurrent();
+ OGLCHECK(glDisable(GL_ALPHA_TEST));
OGLCHECK(glDisable(GL_BLEND));
OGLCHECK(glDisable(GL_DEPTH_TEST));
+ OGLCHECK(glDepthMask(GL_FALSE));
OGLCHECK(glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_SHORT, blitStorage.m_indices->glPtr()));
+ OGLCHECK(glDepthMask(GL_TRUE));
OGLCHECK(glEnable(GL_DEPTH_TEST));
- OGLCHECK(glEnable(GL_TEXTURE_2D));
OGLCHECK(glEnable(GL_BLEND));
+ OGLCHECK(glEnable(GL_ALPHA_TEST));
+
// /// This call is necessary to avoid parasite blitting in updateActualTarget() on IPhone.
// OGLCHECK(glFinish());
diff --git a/yg/blitter.hpp b/yg/blitter.hpp
index bb53c2ccf4..3940e3bd8a 100644
--- a/yg/blitter.hpp
+++ b/yg/blitter.hpp
@@ -36,8 +36,6 @@ namespace yg
yg::gl::Storage m_blitStorage;
- static void setupAuxVertexLayout(bool hasColor, bool hasTexture, void * glPtr);
-
protected:
typedef Clipper base_t;
diff --git a/yg/defines.hpp b/yg/defines.hpp
index 3b3b1337a1..167d631eda 100644
--- a/yg/defines.hpp
+++ b/yg/defines.hpp
@@ -2,7 +2,7 @@
namespace yg
{
- static const int maxDepth = 12000;
+ static const int maxDepth = 20000;
enum EPosition
{
diff --git a/yg/framebuffer.cpp b/yg/framebuffer.cpp
index a1416928d9..45455174b3 100644
--- a/yg/framebuffer.cpp
+++ b/yg/framebuffer.cpp
@@ -2,6 +2,7 @@
#include "framebuffer.hpp"
#include "render_target.hpp"
+#include "renderbuffer.hpp"
#include "internal/opengl.hpp"
#include "utils.hpp"
@@ -40,20 +41,38 @@ namespace yg
#ifndef OMIM_OS_ANDROID
if (m_id != current())
#endif
- {
OGLCHECK(glBindFramebufferFn(GL_FRAMEBUFFER_MWM, m_id));
-// LOG(LINFO, ("FrameBuffer::makeCurrent", m_id));
- }
if (m_renderTarget)
m_renderTarget->attachToFrameBuffer();
else
+ {
+ if (m_id != 0)
+ OGLCHECK(glFramebufferRenderbufferFn(
+ GL_FRAMEBUFFER_MWM,
+ GL_COLOR_ATTACHMENT0_MWM,
+ GL_RENDERBUFFER_MWM,
+ 0));
+
utils::setupCoordinates(width(), height(), true);
+ }
if (m_depthBuffer)
m_depthBuffer->attachToFrameBuffer();
+ else
+ {
+ if (m_id != 0)
+ OGLCHECK(glFramebufferRenderbufferFn(
+ GL_FRAMEBUFFER_MWM,
+ GL_DEPTH_ATTACHMENT_MWM,
+ GL_RENDERBUFFER_MWM,
+ 0));
+ }
/// !!! it's a must for a correct work.
- checkStatus();
+ /// update: it was necessary for multisampling,
+ /// but without it on KindleFire this function produces bug
+/* if (m_id != 0)
+ checkStatus();*/
}
void FrameBuffer::setRenderTarget(shared_ptr<RenderTarget> const & renderTarget)
@@ -71,12 +90,12 @@ namespace yg
m_renderTarget.reset();
}
- void FrameBuffer::setDepthBuffer(shared_ptr<RenderTarget> const & depthBuffer)
+ void FrameBuffer::setDepthBuffer(shared_ptr<RenderBuffer> const & depthBuffer)
{
m_depthBuffer = depthBuffer;
}
- shared_ptr<RenderTarget> const & FrameBuffer::depthBuffer() const
+ shared_ptr<RenderBuffer> const & FrameBuffer::depthBuffer() const
{
return m_depthBuffer;
}
@@ -110,6 +129,7 @@ namespace yg
void FrameBuffer::checkStatus()
{
GLenum res = glCheckFramebufferStatusFn(GL_FRAMEBUFFER_MWM);
+ OGLCHECKAFTER;
if (res == GL_FRAMEBUFFER_UNSUPPORTED_MWM)
LOG(LINFO, ("unsupported combination of attached target formats. could be possibly skipped"));
else if (res == GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_MWM)
diff --git a/yg/framebuffer.hpp b/yg/framebuffer.hpp
index 49b56a481f..c4c9eb0359 100644
--- a/yg/framebuffer.hpp
+++ b/yg/framebuffer.hpp
@@ -17,7 +17,7 @@ namespace yg
unsigned int m_id;
shared_ptr<RenderTarget> m_renderTarget;
- shared_ptr<RenderTarget> m_depthBuffer;
+ shared_ptr<RenderBuffer> m_depthBuffer;
unsigned m_width;
unsigned m_height;
@@ -33,8 +33,8 @@ namespace yg
shared_ptr<RenderTarget> const & renderTarget() const;
void resetRenderTarget();
- void setDepthBuffer(shared_ptr<RenderTarget> const & depthBuffer);
- shared_ptr<RenderTarget> const & depthBuffer() const;
+ void setDepthBuffer(shared_ptr<RenderBuffer> const & depthBuffer);
+ shared_ptr<RenderBuffer> const & depthBuffer() const;
void resetDepthBuffer();
void makeCurrent();
diff --git a/yg/geometry_batcher.hpp b/yg/geometry_batcher.hpp
index b298ca58d5..19fef0c522 100644
--- a/yg/geometry_batcher.hpp
+++ b/yg/geometry_batcher.hpp
@@ -152,7 +152,7 @@ namespace yg
void enableClipRect(bool flag);
void setClipRect(m2::RectI const & rect);
- void clear(yg::Color const & c = yg::Color(187, 187, 187, 255), bool clearRT = true, float depth = 1.0, bool clearDepth = true);
+ void clear(yg::Color const & c, bool clearRT = true, float depth = 1.0, bool clearDepth = true);
/// @}
void setRenderTarget(shared_ptr<RenderTarget> const & rt);
diff --git a/yg/render_state_updater.cpp b/yg/render_state_updater.cpp
index 4be0266317..76425ed001 100644
--- a/yg/render_state_updater.cpp
+++ b/yg/render_state_updater.cpp
@@ -2,8 +2,10 @@
#include "render_state_updater.hpp"
#include "render_state.hpp"
+#include "renderbuffer.hpp"
#include "framebuffer.hpp"
#include "base_texture.hpp"
+#include "utils.hpp"
#include "internal/opengl.hpp"
@@ -21,9 +23,12 @@ namespace yg
RenderStateUpdater::RenderStateUpdater(Params const & params)
: base_t(params),
m_renderState(params.m_renderState),
+ m_auxFrameBuffer(params.m_auxFrameBuffer),
m_doPeriodicalUpdate(params.m_doPeriodicalUpdate),
m_updateInterval(params.m_updateInterval)
{
+ if ((m_doPeriodicalUpdate) && (!m_auxFrameBuffer))
+ m_auxFrameBuffer.reset(new FrameBuffer());
}
shared_ptr<RenderState> const & RenderStateUpdater::renderState() const
@@ -51,6 +56,9 @@ namespace yg
void RenderStateUpdater::UpdateActualTarget::perform()
{
+ if (isDebugging())
+ LOG(LINFO, ("performing UpdateActualTarget command"));
+
OGLCHECK(glFinish());
if (m_doSynchronize)
@@ -75,7 +83,13 @@ namespace yg
OGLCHECK(glDisable(GL_SCISSOR_TEST));
- OGLCHECK(glClearColor(192 / 255.0, 192 / 255.0, 192 / 255.0, 1.0));
+ m_auxFrameBuffer->setRenderTarget(m_renderState->m_backBuffer);
+ m_auxFrameBuffer->makeCurrent();
+
+ OGLCHECK(glClearColor(s_bgColor.r / 255.0,
+ s_bgColor.g / 255.0,
+ s_bgColor.b / 255.0,
+ s_bgColor.a / 255.0));
OGLCHECK(glClear(GL_COLOR_BUFFER_BIT));
@@ -85,8 +99,11 @@ namespace yg
m_renderState->m_actualTarget,
m_resourceManager));
+ immDrawTexturedRect->setIsDebugging(isDebugging());
immDrawTexturedRect->perform();
+ m_frameBuffer->makeCurrent();
+
if (m_isClipRectEnabled)
OGLCHECK(glEnable(GL_SCISSOR_TEST));
@@ -123,9 +140,9 @@ namespace yg
command1->m_resourceManager = resourceManager();
command1->m_isClipRectEnabled = clipRectEnabled();
command1->m_doSynchronize = renderQueue();
+ command1->m_auxFrameBuffer = m_auxFrameBuffer;
+ command1->m_frameBuffer = frameBuffer();
- /// blitting will be performed through
- /// non-multisampled framebuffer for the sake of speed
setRenderTarget(m_renderState->m_shadowBackBuffer);
m_renderState->m_mutex->Unlock();
diff --git a/yg/render_state_updater.hpp b/yg/render_state_updater.hpp
index 476a873717..21e8a88318 100644
--- a/yg/render_state_updater.hpp
+++ b/yg/render_state_updater.hpp
@@ -19,6 +19,7 @@ namespace yg
typedef GeometryRenderer base_t;
shared_ptr<RenderState> m_renderState;
+ shared_ptr<FrameBuffer> m_auxFrameBuffer;
int m_indicesCount;
bool m_doPeriodicalUpdate;
@@ -38,6 +39,8 @@ namespace yg
{
shared_ptr<RenderState> m_renderState;
shared_ptr<ResourceManager> m_resourceManager;
+ shared_ptr<FrameBuffer> m_auxFrameBuffer;
+ shared_ptr<FrameBuffer> m_frameBuffer;
bool m_isClipRectEnabled;
bool m_doSynchronize;
@@ -57,6 +60,7 @@ namespace yg
bool m_doPeriodicalUpdate;
double m_updateInterval;
shared_ptr<RenderState> m_renderState;
+ shared_ptr<FrameBuffer> m_auxFrameBuffer;
Params();
};
diff --git a/yg/renderbuffer.cpp b/yg/renderbuffer.cpp
index f801414e7a..1d2fca6de6 100644
--- a/yg/renderbuffer.cpp
+++ b/yg/renderbuffer.cpp
@@ -21,12 +21,13 @@ namespace yg
return id;
}
- void RenderBuffer::checkID() const
+ RenderBuffer::RenderBuffer(size_t width, size_t height, bool isDepthBuffer)
+ : m_id(0), m_isDepthBuffer(isDepthBuffer), m_width(width), m_height(height)
{
- if (!m_hasID)
+// if (!m_isDepthBuffer)
{
- m_hasID = true;
OGLCHECK(glGenRenderbuffersFn(1, &m_id));
+
makeCurrent();
GLenum target = GL_RENDERBUFFER_MWM;
@@ -37,35 +38,56 @@ namespace yg
m_width,
m_height));
}
+/* else
+ {
+ OGLCHECK(glGenTextures(1, &m_id));
+
+ OGLCHECK(glBindTexture(GL_TEXTURE_2D, m_id));
+
+ OGLCHECK(glTexImage2D(GL_TEXTURE_2D,
+ 0,
+ GL_DEPTH_COMPONENT24_MWM,
+ m_width,
+ m_height,
+ 0,
+ GL_DEPTH_COMPONENT24_MWM,
+ GL_UNSIGNED_INT_24_8_MWM,
+ 0));
+ }*/
}
- RenderBuffer::RenderBuffer(size_t width, size_t height, bool isDepthBuffer)
- : m_hasID(false), m_id(0), m_isDepthBuffer(isDepthBuffer), m_width(width), m_height(height)
- {}
-
RenderBuffer::~RenderBuffer()
{
- if ((m_hasID) && (g_doDeleteOnDestroy))
+ if (g_doDeleteOnDestroy)
{
- OGLCHECK(glDeleteRenderbuffersFn(1, &m_id));
+// if(m_isDepthBuffer)
+// OGLCHECK(glDeleteTextures(1, &m_id));
+// else
+ OGLCHECK(glDeleteRenderbuffersFn(1, &m_id));
}
}
unsigned int RenderBuffer::id() const
{
- checkID();
return m_id;
}
void RenderBuffer::attachToFrameBuffer()
{
- checkID();
-
- OGLCHECK(glFramebufferRenderbufferFn(
- GL_FRAMEBUFFER_MWM,
- isDepthBuffer() ? GL_DEPTH_ATTACHMENT_MWM : GL_COLOR_ATTACHMENT0_MWM,
- GL_RENDERBUFFER_MWM,
- id()));
+/* if (m_isDepthBuffer)
+ OGLCHECK(glFramebufferTexture2DFn(
+ GL_FRAMEBUFFER_MWM,
+ GL_DEPTH_ATTACHMENT_MWM,
+ GL_TEXTURE_2D,
+ id(),
+ 0
+ ));
+ else*/
+ OGLCHECK(glFramebufferRenderbufferFn(
+ GL_FRAMEBUFFER_MWM,
+ isDepthBuffer() ? GL_DEPTH_ATTACHMENT_MWM : GL_COLOR_ATTACHMENT0_MWM,
+ GL_RENDERBUFFER_MWM,
+ id()));
if (!isDepthBuffer())
utils::setupCoordinates(width(), height(), false);
@@ -73,7 +95,6 @@ namespace yg
void RenderBuffer::makeCurrent() const
{
- checkID();
#ifndef OMIM_OS_ANDROID
if (m_id != current())
#endif
diff --git a/yg/renderbuffer.hpp b/yg/renderbuffer.hpp
index 986a14624f..7604bd06e6 100644
--- a/yg/renderbuffer.hpp
+++ b/yg/renderbuffer.hpp
@@ -11,15 +11,12 @@ namespace yg
{
private:
- mutable bool m_hasID;
mutable unsigned int m_id;
bool m_isDepthBuffer;
size_t m_width;
size_t m_height;
- void checkID() const;
-
public:
RenderBuffer(size_t width, size_t height, bool isDepthBuffer = false);
diff --git a/yg/renderer.cpp b/yg/renderer.cpp
index e0a5f18b56..db2772dd1f 100644
--- a/yg/renderer.cpp
+++ b/yg/renderer.cpp
@@ -11,6 +11,8 @@ namespace yg
{
namespace gl
{
+ const yg::Color Renderer::s_bgColor(192, 192, 192, 255);
+
Renderer::BaseState::BaseState()
: m_isDebugging(false)
{}
@@ -271,12 +273,12 @@ namespace yg
}
}
- shared_ptr<RenderTarget> const & Renderer::depthBuffer() const
+ shared_ptr<RenderBuffer> const & Renderer::depthBuffer() const
{
return m_depthBuffer;
}
- void Renderer::setDepthBuffer(shared_ptr<RenderTarget> const & rt)
+ void Renderer::setDepthBuffer(shared_ptr<RenderBuffer> const & rt)
{
m_depthBuffer = rt;
@@ -304,6 +306,8 @@ namespace yg
if (m_clearDepth)
mask |= GL_DEPTH_BUFFER_BIT;
+ OGLCHECK(glDepthMask(GL_TRUE));
+
OGLCHECK(glClear(mask));
}
diff --git a/yg/renderer.hpp b/yg/renderer.hpp
index 2cc685703a..1fd29c9c80 100644
--- a/yg/renderer.hpp
+++ b/yg/renderer.hpp
@@ -33,7 +33,7 @@ namespace yg
{
shared_ptr<FrameBuffer> m_frameBuffer;
shared_ptr<RenderTarget> m_renderTarget;
- shared_ptr<RenderTarget> m_depthBuffer;
+ shared_ptr<RenderBuffer> m_depthBuffer;
shared_ptr<ResourceManager> m_resourceManager;
void apply(BaseState const * prev);
@@ -96,7 +96,7 @@ namespace yg
shared_ptr<FrameBuffer> m_frameBuffer;
shared_ptr<RenderTarget> m_renderTarget;
- shared_ptr<RenderTarget> m_depthBuffer;
+ shared_ptr<RenderBuffer> m_depthBuffer;
shared_ptr<ResourceManager> m_resourceManager;
ThreadedList<Packet> * m_renderQueue;
@@ -110,6 +110,8 @@ namespace yg
public:
+ static const yg::Color s_bgColor;
+
Renderer(Params const & params = Params());
void beginFrame();
@@ -124,15 +126,15 @@ namespace yg
void setRenderTarget(shared_ptr<RenderTarget> const & rt);
shared_ptr<RenderTarget> const & renderTarget() const;
- void setDepthBuffer(shared_ptr<RenderTarget> const & rt);
- shared_ptr<RenderTarget> const & depthBuffer() const;
+ void setDepthBuffer(shared_ptr<RenderBuffer> const & rt);
+ shared_ptr<RenderBuffer> const & depthBuffer() const;
/// @param clearRT - should we clear the renderTarget data (visible pixels)?
/// @param clearDepth - should we clear depthBuffer data?
/// @warning this function respects the clipping rect set and enabled(!)
/// by the setClipRect/enableClipRect. Whether the clipping is
/// not enabled - the entire currently bound render surface is used.
- void clear(yg::Color const & c = yg::Color(187, 187, 187, 255), bool clearRT = true, float depth = 1.0, bool clearDepth = true);
+ void clear(yg::Color const & c, bool clearRT = true, float depth = 1.0, bool clearDepth = true);
void onSize(unsigned width, unsigned height);
diff --git a/yg/vertex.hpp b/yg/vertex.hpp
index 5e72466aa1..97e8f1ec26 100644
--- a/yg/vertex.hpp
+++ b/yg/vertex.hpp
@@ -25,16 +25,5 @@ namespace yg
static void setupLayout(void * glPtr);
};
-
- struct AuxVertex
- {
- m2::PointF pt;
- m2::PointF texPt;
- yg::Color color;
- static const int vertexOffs = 0;
- static const int texCoordsOffs = sizeof(m2::PointF);
- static const int colorOffs = sizeof(m2::PointF) + sizeof(m2::PointF);
- };
-
}
}
diff --git a/yg/yg_tests/screengl_test.cpp b/yg/yg_tests/screengl_test.cpp
index 671e19480f..173c79ef82 100644
--- a/yg/yg_tests/screengl_test.cpp
+++ b/yg/yg_tests/screengl_test.cpp
@@ -383,7 +383,7 @@ namespace
p->beginFrame();
p->setClipRect(r);
p->enableClipRect(true);
- p->clear();
+ p->clear(yg::gl::Screen::s_bgColor);
}
};
diff --git a/yg/yg_tests/thread_render.cpp b/yg/yg_tests/thread_render.cpp
index 11e8fbc550..9bc131772d 100644
--- a/yg/yg_tests/thread_render.cpp
+++ b/yg/yg_tests/thread_render.cpp
@@ -28,7 +28,7 @@ namespace
for (size_t i = 0; i < 30; ++i)
{
m_pScreen->beginFrame();
- m_pScreen->clear();
+ m_pScreen->clear(yg::gl::Screen::s_bgColor);
m_pScreen->immDrawRect(
m2::RectF(i * 15 + 20, 10, i * 15 + 30, 20),
m2::RectF(),
@@ -59,7 +59,7 @@ namespace
for (size_t i = 0; i < 30; ++i)
{
p->beginFrame();
- p->clear();
+ p->clear(yg::gl::Screen::s_bgColor);
p->immDrawSolidRect(
m2::RectF(i * 15 + 20, 30, i * 15 + 30, 40),
yg::Color(0, 0, 255, (globalCounter++) * (255 / 60) ));