From 71b5e8d4b1f3ee933c8f716368a8bd5883dacd6f Mon Sep 17 00:00:00 2001 From: James Grogan Date: Mon, 14 Nov 2022 16:07:13 +0000 Subject: [PATCH] Playing with projections. --- src/graphics/opengl/OpenGlPainter.cpp | 33 +++++++++++-------- .../x11/XcbGlWindowInterface.cpp | 6 ++++ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/graphics/opengl/OpenGlPainter.cpp b/src/graphics/opengl/OpenGlPainter.cpp index 32f9926..df67c2a 100644 --- a/src/graphics/opengl/OpenGlPainter.cpp +++ b/src/graphics/opengl/OpenGlPainter.cpp @@ -18,15 +18,20 @@ void OpenGlPainter::paint(DrawingContext* context) auto surface = context->getSurface(); const auto width = double(surface->getWidth()); const auto height = double(surface->getHeight()); - - std::cout << "Painting into width " << width << " and height " << height << std::endl; - const auto num_mesh = context->getScene()->getNumMeshes(); glClearColor(1.0, 1.0, 1.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); - //glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); + glViewport(0, 0, width, height); + glOrtho(0, width, 0, height, -1.0, 1.0); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + //glMatrixMode(GL_MODELVIEW); + //glLoadIdentity(); + + std::cout << "Bounds are : " << width << " | " << height << std::endl; for (std::size_t idx=0; idx