- if (width > textureWidth || height > textureHeight)
- {
- // Seems that power of 2 sizes are still mandatory...
- textureWidth = 1024;
- textureHeight = 512;
-#if 0
-printf("Resizing: new texture width/height = %i x %i\n", textureWidth, textureHeight);
-printf("Resizing: new raster width/height = %i x %i\n", rasterWidth, rasterHeight);
-#endif
+//kludge [No, this is where it belongs!]
+ rasterHeight = (vjs.hardwareTypeNTSC ? VIRTUAL_SCREEN_HEIGHT_NTSC : VIRTUAL_SCREEN_HEIGHT_PAL);
+
+ return;
+}
+
+
+// At some point, we'll have to create more than one texture to handle
+// cases like Doom. Or have another go at TV type rendering; it will
+// require a 2048x512 texture though. (Note that 512 is the correct height for
+// interlaced screens; we won't have to change much here to support it.)
+void GLWidget::CreateTextures(void)
+{
+ // Seems that power of 2 sizes are still mandatory...
+ textureWidth = 1024;
+ textureHeight = 512;
+ buffer = new uint32_t[textureWidth * textureHeight];
+ JaguarSetScreenBuffer(buffer);
+
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, textureWidth);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, textureWidth, textureHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, NULL);
+}
+