1
#include "NuxCore/NuxCore.h"
2
#include "NuxGraphics/BitmapFormats.h"
3
#include "NuxGraphics/GraphicsDisplay.h"
4
#include "NuxGraphics/GLWindowManager.h"
5
#include "NuxGraphics/GraphicsEngine.h"
6
#include "NuxCore/FilePath.h"
8
#if defined(NUX_OS_WINDOWS)
9
#define PKGDATADIR "../../data/"
13
void TextureLayerOverTexture()
15
nux::GraphicsDisplay* graphics_display = gGLWindowManager.CreateGLWindow("Window", 600, 300, nux::WINDOWSTYLE_NORMAL, 0, false);
16
nux::GraphicsEngine* graphics_engine = graphics_display->GetGraphicsEngine();
18
graphics_display->ShowWindow();
20
nux::BaseTexture* flowers = nux::CreateTextureFromFile(PKGDATADIR"/textures/flowers.png");
21
nux::BaseTexture* wall = nux::CreateTextureFromFile(PKGDATADIR"/textures/wall.png");
28
memset(&event, 0, sizeof(nux::Event));
29
graphics_engine->GetWindowSize(w, h);
30
graphics_engine->SetViewport(0, 0, w, h);
31
graphics_engine->SetOrthographicProjectionMatrix(w, h);
32
bool first_time = true;
36
CHECKGL(glClearColor(0, 0, 0, 1));
37
CHECKGL(glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT));
39
graphics_display->GetSystemEvent(&event);
40
if (first_time || (event.type == nux::NUX_SIZE_CONFIGURATION))
43
graphics_engine->GetWindowSize(w, h);
44
graphics_engine->SetViewport(0, 0, w, h);
45
graphics_engine->SetScissor(0, 0, w, h);
46
graphics_engine->SetOrthographicProjectionMatrix(w, h);
49
int num_quad_per_row = graphics_display->GetWindowWidth() / (quad_size + space);
54
for (int i = 0; i < nux::LAYER_BLEND_MODE_LAST; ++i)
56
graphics_engine->QRP_GLSL_ColorLayerOverColor(x, y, quad_size, quad_size,
59
(nux::LayerBlendMode)i);
62
x += quad_size + space;
63
if (column == num_quad_per_row)
66
y += quad_size + space;
71
graphics_display->SwapBuffer();
72
} while(event.type != nux::NUX_TERMINATE_APP);
74
flowers->UnReference();
77
delete graphics_display;
80
int main(int argc, char **argv)
82
nux::NuxCoreInitialize(0);
83
nux::NuxGraphicsInitialize();
85
TextureLayerOverTexture();