blob: d40caed765097b445c9f0f38e3efc437faba5470 (
plain)
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
|
#include "qt/qtoglcontextfactory.hpp"
#include "base/assert.hpp"
QtOGLContextFactory::QtOGLContextFactory(QOpenGLContext * renderContext, QThread * thread,
TRegisterThreadFn const & regFn, TSwapFn const & swapFn)
: m_drawContext(new QtRenderOGLContext(renderContext, thread, regFn, swapFn))
, m_uploadContext(nullptr)
{
m_uploadThreadSurface = new QOffscreenSurface(renderContext->screen());
m_uploadThreadSurface->create();
}
QtOGLContextFactory::~QtOGLContextFactory()
{
delete m_drawContext;
delete m_uploadContext;
m_uploadThreadSurface->destroy();
delete m_uploadThreadSurface;
}
dp::OGLContext * QtOGLContextFactory::getDrawContext()
{
return m_drawContext;
}
dp::OGLContext * QtOGLContextFactory::getResourcesUploadContext()
{
if (m_uploadContext == nullptr)
m_uploadContext = new QtUploadOGLContext(m_uploadThreadSurface, m_drawContext->getNativeContext());
return m_uploadContext;
}
|