1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#include "widgets.hpp"
#include "../qt_tstfrm/widgets_impl.hpp"
#include "../map/drawer_yg.hpp"
#include "../platform/platform.hpp"
#include "../yg/rendercontext.hpp"
#include "../yg/internal/opengl.hpp"
#ifdef OMIM_OS_WINDOWS
#include "../yg/internal/opengl_win32.hpp"
#endif
namespace qt
{
template class GLDrawWidgetT<DrawerYG>;
GLDrawWidget::GLDrawWidget(QWidget * pParent)
: base_type(pParent)
{
}
void GLDrawWidget::initializeGL()
{
if (m_p == 0)
{
#ifdef OMIM_OS_WINDOWS
win32::InitOpenGL();
#endif
if (!yg::gl::CheckExtensionSupport())
{
/// TODO: Show "Please Update Drivers" dialog and close the program.
}
m_renderContext = shared_ptr<yg::gl::RenderContext>(new qt::gl::RenderContext(this));
m_resourceManager = make_shared_ptr(new yg::ResourceManager(
50000 * sizeof(yg::gl::Vertex),
100000 * sizeof(unsigned short),
15,
5000 * sizeof(yg::gl::Vertex),
10000 * sizeof(unsigned short),
100,
10 * sizeof(yg::gl::AuxVertex),
10 * sizeof(unsigned short),
50,
512, 256,
15,
GetPlatform().ReadPathForFile("unicode_blocks.txt").c_str(),
GetPlatform().ReadPathForFile("fonts_whitelist.txt").c_str(),
GetPlatform().ReadPathForFile("fonts_blacklist.txt").c_str(),
2000000,
yg::Rt8Bpp,
!yg::gl::g_isBufferObjectsSupported,
!GetPlatform().IsMultiSampled()));
m_resourceManager->addFonts(GetPlatform().GetFontNames());
DrawerYG::params_t p;
p.m_resourceManager = m_resourceManager;
p.m_isMultiSampled = false;
p.m_frameBuffer = make_shared_ptr(new yg::gl::FrameBuffer(true));
p.m_dynamicPagesCount = 2;
p.m_textPagesCount = 2;
m_p = shared_ptr<DrawerYG>(new DrawerYG(GetPlatform().SkinName(), p));
}
}
shared_ptr<yg::gl::RenderContext> const & GLDrawWidget::renderContext()
{
return m_renderContext;
}
shared_ptr<yg::ResourceManager> const & GLDrawWidget::resourceManager()
{
return m_resourceManager;
}
}
|