X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Fglwidget.cpp;h=2501ad8296a1d100c9bd3a2815718ef675edc878;hb=6bbf8a69b977644a55a4abdea71dfa9e3bb6c087;hp=e32dde3682aa65c4b6d842e6d960313803e669ae;hpb=e6b7d61963423b7f9cb4c6c24d2befca50328d4f;p=virtualjaguar diff --git a/src/gui/glwidget.cpp b/src/gui/glwidget.cpp index e32dde3..2501ad8 100644 --- a/src/gui/glwidget.cpp +++ b/src/gui/glwidget.cpp @@ -13,15 +13,33 @@ #include "glwidget.h" +#include "jaguar.h" #include "settings.h" +#include "tom.h" + +#ifdef __GCCWIN32__ +// Apparently on win32, various OpenGL constants aren't pulled in. +#include +#endif GLWidget::GLWidget(QWidget * parent/*= 0*/): QGLWidget(parent), texture(0), textureWidth(0), textureHeight(0), buffer(0), rasterWidth(320), rasterHeight(240) { +// tomDeviceWidth = rasterWidth; + tomDeviceWidth = 1024; // It has to be the texture width... + + // Set up the backbuffer + // To be safe, this should be 1280 * 625 * 2... + backbuffer = (uint32_t *)malloc(1280 * 625 * sizeof(uint32_t)); +// memset(backbuffer, 0x44, rasterWidth * + memset(backbuffer, 0xFF, 1024 * + (vjs.hardwareTypeNTSC ? rasterHeight : VIRTUAL_SCREEN_HEIGHT_PAL) + * sizeof(uint32_t)); } GLWidget::~GLWidget() { + free(backbuffer); } void GLWidget::initializeGL() @@ -58,9 +76,12 @@ rasterHeight = (vjs.hardwareTypeNTSC ? 240 : 256); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (vjs.glFilter ? GL_LINEAR : GL_NEAREST)); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (vjs.glFilter ? GL_LINEAR : GL_NEAREST)); // glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, rasterWidth, rasterHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, buffer); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, rasterWidth, rasterHeight, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, buffer); +//more kludge + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TOMGetVideoModeWidth(), rasterHeight, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, buffer); +// glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, rasterWidth, rasterHeight, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, buffer); - double w = (double)rasterWidth / (double)textureWidth; + double w = (double)TOMGetVideoModeWidth() / (double)textureWidth; +// double w = (double)rasterWidth / (double)textureWidth; double h = (double)rasterHeight / (double)textureHeight; unsigned u = outputWidth; unsigned v = outputHeight; @@ -96,6 +117,8 @@ printf("Resizing: new raster width/height = %i x %i\n", rasterWidth, rasterHeigh } buffer = new uint32_t[textureWidth * textureHeight]; +//??? +memset(buffer, 0x00, textureWidth * textureHeight * sizeof(uint32_t)); glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glPixelStorei(GL_UNPACK_ROW_LENGTH, textureWidth);