#include <msp/core/application.h>
#include <msp/graphics/simplewindow.h>
#include <msp/gl/blend.h>
+#include <msp/gl/device.h>
#include <msp/gl/matrix.h>
+#include <msp/gl/windowview.h>
#include <msp/gltk/button.h>
#include <msp/gltk/entry.h>
#include <msp/gltk/label.h>
class HelloWorld: public Msp::RegisteredApplication<HelloWorld>
{
private:
- // An OpenGL window to display our widgets in
- Graphics::SimpleGLWindow wnd;
+ // A window and graphics device to display our widgets in
+ Graphics::SimpleWindow wnd;
+ GL::Device gl_dev;
+ GL::WindowView view;
// GLtk resources and widgets
GLtk::Resources res;
HelloWorld::HelloWorld(int, char **):
wnd(200, 200),
+ gl_dev(wnd),
+ view(wnd),
// Load resources. This must be done before the root widget is created.
res("basic.skin"),
// A Root receives input from a Graphics::Window and passes it on
btn->set_geometry(GLtk::Geometry(50, 10, 100, 27));
btn->signal_clicked.connect(sigc::bind(sigc::mem_fun(this, &HelloWorld::exit), 0));
+ view.set_content(&root);
+
// Done with setting things up, show the window!
wnd.show();
}
void HelloWorld::tick()
{
wnd.tick();
-
- // Set up an orthogonal projection matching the root widget
- GL::MatrixStack::projection() = GL::Matrix::ortho_bottomleft(200, 200);
- GL::MatrixStack::modelview() = GL::Matrix();
-
- // Font rendering requires blending
- GL::Bind bind_blend(GL::Blend::alpha());
-
- root.render();
-
- wnd.swap_buffers();
+ view.render();
}
// Displays a greeting to the user