Some opengl additions

This commit is contained in:
James Grogan 2022-11-15 11:50:24 +00:00
parent 72123bc333
commit 649079a5c7
6 changed files with 163 additions and 17 deletions

View file

@ -1,6 +1,7 @@
#include "XcbGlInterface.h"
#include "FileLogger.h"
#include <iostream>
#include <GL/gl.h>
@ -59,6 +60,7 @@ void XcbGlInterface::setupContext(int default_screen)
glXGetFBConfigAttrib(mDisplay, mConfig, GLX_VISUAL_ID, &visualID);
/* Create OpenGL context */
std::cout << "Creating opengl context" << std::endl;
mContext = glXCreateNewContext(mDisplay, mConfig, GLX_RGBA_TYPE, 0, True);
if (!mContext)
{

View file

@ -54,17 +54,18 @@ bool XcbGlWindowInterface::initialize(xcb_window_t window)
MLOG_ERROR("glXMakeContextCurrent failed");
return false;
}
return true;
}
void XcbGlWindowInterface::resizeViewPort(unsigned width, unsigned height)
{
glViewport(0, 0, width, height);
glScissor(0, 0, width, height);
//glViewport(0, 0, width, height);
//glScissor(0, 0, width, height);
glOrtho(0, width, 0, height, -1.0, 1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//glOrtho(0, width, 0, height, -1.0, 1.0);
//glMatrixMode(GL_PROJECTION);
//glLoadIdentity();
//glMatrixMode(GL_MODELVIEW);