1206
1206
void WindowCompositor::Draw(bool SizeConfigurationEvent, bool force_draw)
1208
1208
inside_rendering_cycle_ = true;
1209
if (!GetWindowThread()->GetWindow().isWindowMinimized())
1209
if (!window_thread_->GetGraphicsDisplay().isWindowMinimized())
1212
GetWindowThread()->GetGraphicsEngine().GetContextSize(m_Width, m_Height);
1213
GetWindowThread()->GetGraphicsEngine().SetViewport(0, 0, m_Width, m_Height);
1212
window_thread_->GetGraphicsEngine().GetContextSize(m_Width, m_Height);
1213
window_thread_->GetGraphicsEngine().SetViewport(0, 0, m_Width, m_Height);
1215
1215
// Reset the Model view Matrix and the projection matrix
1216
GetWindowThread()->GetGraphicsEngine().ResetProjectionMatrix();
1216
window_thread_->GetGraphicsEngine().ResetProjectionMatrix();
1218
GetWindowThread()->GetGraphicsEngine().ResetModelViewMatrixStack();
1219
GetWindowThread()->GetGraphicsEngine().Push2DTranslationModelViewMatrix(0.375f, 0.375f, 0.0f);
1218
window_thread_->GetGraphicsEngine().ResetModelViewMatrixStack();
1219
window_thread_->GetGraphicsEngine().Push2DTranslationModelViewMatrix(0.375f, 0.375f, 0.0f);
1222
1222
if (force_draw || SizeConfigurationEvent)
1224
1224
// We fall here after something dramatic has happen to the window such as a resizing. In this case
1225
1225
// everything must be rendered. This is very costly and should happen rarely.
1226
if (!GetWindowThread()->IsEmbeddedWindow())
1226
if (!window_thread_->IsEmbeddedWindow())
1227
1227
RenderMainWindowComposition(true);
1281
1281
if (window.IsValid())
1283
//GetWindowThread()->GetGraphicsEngine().SetContext(x, y, buffer_width, buffer_height);
1284
GetWindowThread()->GetGraphicsEngine().SetOrthographicProjectionMatrix(GetWindowThread()->GetGraphicsEngine().GetWindowWidth(),
1285
GetWindowThread()->GetGraphicsEngine().GetWindowHeight());
1286
GetWindowThread()->GetGraphicsEngine().EmptyClippingRegion();
1283
//window_thread_->GetGraphicsEngine().SetContext(x, y, buffer_width, buffer_height);
1284
window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(window_thread_->GetGraphicsEngine().GetWindowWidth(),
1285
window_thread_->GetGraphicsEngine().GetWindowHeight());
1286
window_thread_->GetGraphicsEngine().EmptyClippingRegion();
1290
GetWindowThread()->GetGraphicsEngine().SetOrthographicProjectionMatrix(GetWindowThread()->GetGraphicsEngine().GetWindowWidth(),
1291
GetWindowThread()->GetGraphicsEngine().GetWindowHeight());
1292
GetWindowThread()->GetGraphicsEngine().EmptyClippingRegion();
1290
window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(window_thread_->GetGraphicsEngine().GetWindowWidth(),
1291
window_thread_->GetGraphicsEngine().GetWindowHeight());
1292
window_thread_->GetGraphicsEngine().EmptyClippingRegion();
1295
1295
std::list<MenuPage *>::reverse_iterator rev_it_menu;
1297
1297
for (rev_it_menu = _menu_chain->rbegin(); rev_it_menu != _menu_chain->rend( ); rev_it_menu++)
1299
1299
SetProcessingTopView(m_MenuWindow.GetPointer());
1300
(*rev_it_menu)->ProcessDraw(GetWindowThread()->GetGraphicsEngine(), force_draw);
1300
(*rev_it_menu)->ProcessDraw(window_thread_->GetGraphicsEngine(), force_draw);
1301
1301
SetProcessingTopView(NULL);
1304
1304
// GetGraphicsDisplay()->GetGraphicsEngine()->SetContext(0, 0,
1305
// GetWindowThread()->GetGraphicsEngine().GetWindowWidth(),
1306
// GetWindowThread()->GetGraphicsEngine().GetWindowHeight());
1305
// window_thread_->GetGraphicsEngine().GetWindowWidth(),
1306
// window_thread_->GetGraphicsEngine().GetWindowHeight());
1309
1309
void WindowCompositor::DrawOverlay(bool force_draw)
1311
1311
ObjectWeakPtr<BaseWindow> window = m_OverlayWindow;
1312
int buffer_width = GetWindowThread()->GetGraphicsEngine().GetWindowWidth();
1313
int buffer_height = GetWindowThread()->GetGraphicsEngine().GetWindowHeight();
1312
int buffer_width = window_thread_->GetGraphicsEngine().GetWindowWidth();
1313
int buffer_height = window_thread_->GetGraphicsEngine().GetWindowHeight();
1315
1315
if (window.IsValid())
1317
//GetWindowThread()->GetGraphicsEngine().SetContext(x, y, buffer_width, buffer_height);
1318
GetWindowThread()->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
1319
GetWindowThread()->GetGraphicsEngine().EmptyClippingRegion();
1317
//window_thread_->GetGraphicsEngine().SetContext(x, y, buffer_width, buffer_height);
1318
window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
1319
window_thread_->GetGraphicsEngine().EmptyClippingRegion();
1322
GetWindowThread()->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, buffer_width, buffer_height);
1322
window_thread_->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, buffer_width, buffer_height);
1324
1324
if (OverlayDrawingCommand)
1326
1326
SetProcessingTopView(m_OverlayWindow.GetPointer());
1327
OverlayDrawingCommand->OverlayDrawing(GetWindowThread()->GetGraphicsEngine());
1327
OverlayDrawingCommand->OverlayDrawing(window_thread_->GetGraphicsEngine());
1328
1328
SetProcessingTopView(NULL);
1334
1334
void WindowCompositor::DrawTooltip(bool force_draw)
1336
1336
ObjectWeakPtr<BaseWindow> window = _tooltip_window;
1337
int buffer_width = GetWindowThread()->GetGraphicsEngine().GetWindowWidth();
1338
int buffer_height = GetWindowThread()->GetGraphicsEngine().GetWindowHeight();
1337
int buffer_width = window_thread_->GetGraphicsEngine().GetWindowWidth();
1338
int buffer_height = window_thread_->GetGraphicsEngine().GetWindowHeight();
1340
1340
if (window.IsValid())
1342
//GetWindowThread()->GetGraphicsEngine().SetContext(x, y, buffer_width, buffer_height);
1343
GetWindowThread()->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
1344
GetWindowThread()->GetGraphicsEngine().EmptyClippingRegion();
1342
//window_thread_->GetGraphicsEngine().SetContext(x, y, buffer_width, buffer_height);
1343
window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
1344
window_thread_->GetGraphicsEngine().EmptyClippingRegion();
1347
GetWindowThread()->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, buffer_width, buffer_height);
1347
window_thread_->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, buffer_width, buffer_height);
1349
1349
if (m_TooltipText.Size())
1351
1351
//SetProcessingTopView(_tooltip_window);
1352
GetPainter().PaintShape(GetWindowThread()->GetGraphicsEngine(), _tooltip_geometry, Color(0xA0000000), eSHAPE_CORNER_ROUND10, true);
1353
GetPainter().PaintTextLineStatic(GetWindowThread()->GetGraphicsEngine(), GetSysBoldFont(), _tooltip_text_geometry, m_TooltipText, Color(0xFFFFFFFF));
1352
GetPainter().PaintShape(window_thread_->GetGraphicsEngine(), _tooltip_geometry, Color(0xA0000000), eSHAPE_CORNER_ROUND10, true);
1353
GetPainter().PaintTextLineStatic(window_thread_->GetGraphicsEngine(), GetSysBoldFont(), _tooltip_text_geometry, m_TooltipText, Color(0xFFFFFFFF));
1354
1354
//SetProcessingTopView(NULL);
1528
1528
m_FrameBufferObject->SetDepthSurface(m_MainDepthRT->GetSurfaceLevel(0));
1529
1529
m_FrameBufferObject->Activate();
1531
GetWindowThread()->GetGraphicsEngine().EmptyClippingRegion();
1532
GetWindowThread()->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, buffer_width, buffer_height);
1533
GetWindowThread()->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);
1534
GetWindowThread()->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
1531
window_thread_->GetGraphicsEngine().EmptyClippingRegion();
1532
window_thread_->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, buffer_width, buffer_height);
1533
window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);
1534
window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
1536
1536
CHECKGL(glClear(/*GL_COLOR_BUFFER_BIT |*/ GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT));
1537
1537
//Begin 2D Drawing
1539
1539
if (force_draw)
1541
GetPainter().PushDrawLayer(GetWindowThread()->GetGraphicsEngine(), Geometry(0, 0, buffer_width, buffer_height), m_Background);
1542
//GetPainter().PushBackground(GetWindowThread()->GetGraphicsEngine(), Geometry(0, 0, buffer_width, buffer_height), m_Background, true);
1544
GetWindowThread()->ProcessDraw(GetWindowThread()->GetGraphicsEngine(), true);
1546
nuxAssert(GetWindowThread()->GetGraphicsEngine().GetNumberOfClippingRegions() == 0);
1541
GetPainter().PushDrawLayer(window_thread_->GetGraphicsEngine(), Geometry(0, 0, buffer_width, buffer_height), m_Background);
1542
//GetPainter().PushBackground(window_thread_->GetGraphicsEngine(), Geometry(0, 0, buffer_width, buffer_height), m_Background, true);
1544
window_thread_->ProcessDraw(window_thread_->GetGraphicsEngine(), true);
1546
nuxAssert(window_thread_->GetGraphicsEngine().GetNumberOfClippingRegions() == 0);
1547
1547
GetPainter().PopBackground();
1548
1548
GetPainter().EmptyBackgroundStack();
1552
GetPainter().PushLayer(GetWindowThread()->GetGraphicsEngine(), Geometry(0, 0, buffer_width, buffer_height), m_Background);
1553
//GetPainter().PushBackground(GetWindowThread()->GetGraphicsEngine(), Geometry(0, 0, buffer_width, buffer_height), m_Background, false);
1555
GetWindowThread()->ProcessDraw(GetWindowThread()->GetGraphicsEngine(), false);
1557
nuxAssert(GetWindowThread()->GetGraphicsEngine().GetNumberOfClippingRegions() == 0);
1552
GetPainter().PushLayer(window_thread_->GetGraphicsEngine(), Geometry(0, 0, buffer_width, buffer_height), m_Background);
1553
//GetPainter().PushBackground(window_thread_->GetGraphicsEngine(), Geometry(0, 0, buffer_width, buffer_height), m_Background, false);
1555
window_thread_->ProcessDraw(window_thread_->GetGraphicsEngine(), false);
1557
nuxAssert(window_thread_->GetGraphicsEngine().GetNumberOfClippingRegions() == 0);
1558
1558
GetPainter().PopBackground();
1559
1559
GetPainter().EmptyBackgroundStack();
1569
1569
//GetGraphicsDisplay()->GetGraphicsEngine()->QRP_Color(geo.x, geo.y, geo.width, geo.height, color::Blue);
1572
GetWindowThread()->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
1572
window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
1573
1573
m_FrameBufferObject->Deactivate();
1575
1575
unsigned int window_width, window_height;
1576
window_width = GetWindowThread()->GetGraphicsEngine().GetWindowWidth();
1577
window_height = GetWindowThread()->GetGraphicsEngine().GetWindowHeight();
1578
GetWindowThread()->GetGraphicsEngine().EmptyClippingRegion();
1579
GetWindowThread()->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, window_width, window_height);
1580
GetWindowThread()->GetGraphicsEngine().SetViewport(0, 0, window_width, window_height);
1581
GetWindowThread()->GetGraphicsEngine().SetOrthographicProjectionMatrix(window_width, window_height);
1576
window_width = window_thread_->GetGraphicsEngine().GetWindowWidth();
1577
window_height = window_thread_->GetGraphicsEngine().GetWindowHeight();
1578
window_thread_->GetGraphicsEngine().EmptyClippingRegion();
1579
window_thread_->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, window_width, window_height);
1580
window_thread_->GetGraphicsEngine().SetViewport(0, 0, window_width, window_height);
1581
window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(window_width, window_height);
1583
1583
PresentBufferToScreen(m_MainColorRT, 0, 0, false);
1610
1610
GetGraphicsDisplay()->GetGpuDevice()->DeactivateFrameBuffer();
1613
GetWindowThread()->GetGraphicsEngine().EmptyClippingRegion();
1614
GetWindowThread()->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, window_width, window_height);
1615
GetWindowThread()->GetGraphicsEngine().SetViewport(0, 0, window_width, window_height);
1616
GetWindowThread()->GetGraphicsEngine().SetOrthographicProjectionMatrix(window_width, window_height);
1613
window_thread_->GetGraphicsEngine().EmptyClippingRegion();
1614
window_thread_->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, window_width, window_height);
1615
window_thread_->GetGraphicsEngine().SetViewport(0, 0, window_width, window_height);
1616
window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(window_width, window_height);
1618
1618
// Render the MAINFBO
1627
1627
if (premultiply)
1629
GetWindowThread()->GetGraphicsEngine().GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
1629
window_thread_->GetGraphicsEngine().GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
1630
1630
GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(x, y, src_width, src_height, HWTexture, texxform0, Color(opacity, opacity, opacity, opacity));
1634
GetWindowThread()->GetGraphicsEngine().GetRenderStates().SetBlend(false);
1634
window_thread_->GetGraphicsEngine().GetRenderStates().SetBlend(false);
1635
1635
GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(x, y, src_width, src_height, HWTexture, texxform0, Color(1.0f, 1.0f, 1.0f, opacity));
1637
GetWindowThread()->GetGraphicsEngine().GetRenderStates().SetBlend(false);
1637
window_thread_->GetGraphicsEngine().GetRenderStates().SetBlend(false);
1985
1985
m_FrameBufferObject->SetDepthSurface(rt.depth_rt->GetSurfaceLevel(0));
1986
1986
m_FrameBufferObject->Activate();
1988
GetWindowThread()->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);
1989
GetWindowThread()->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
1990
GetWindowThread()->GetGraphicsEngine().ApplyClippingRectangle();
1991
//GetWindowThread()->GetGraphicsEngine().ApplyModelViewMatrix(); ???
1988
window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);
1989
window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
1990
window_thread_->GetGraphicsEngine().ApplyClippingRectangle();
1991
//window_thread_->GetGraphicsEngine().ApplyModelViewMatrix(); ???
1995
int buffer_width = GetWindowThread()->GetGraphicsEngine().GetWindowWidth();
1996
int buffer_height = GetWindowThread()->GetGraphicsEngine().GetWindowHeight();
1995
int buffer_width = window_thread_->GetGraphicsEngine().GetWindowWidth();
1996
int buffer_height = window_thread_->GetGraphicsEngine().GetWindowHeight();
1998
1998
nuxAssert(buffer_width >= 1);
1999
1999
nuxAssert(buffer_height >= 1);
2003
2003
m_FrameBufferObject->SetDepthSurface(m_MainDepthRT->GetSurfaceLevel(0));
2004
2004
m_FrameBufferObject->Activate();
2006
GetWindowThread()->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);
2007
GetWindowThread()->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
2008
GetWindowThread()->GetGraphicsEngine().ApplyClippingRectangle();
2009
//GetWindowThread()->GetGraphicsEngine().ApplyModelViewMatrix(); ???
2006
window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);
2007
window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
2008
window_thread_->GetGraphicsEngine().ApplyClippingRectangle();
2009
//window_thread_->GetGraphicsEngine().ApplyModelViewMatrix(); ???