--- OpenGLPluginX-orig.c Sat May 22 17:17:20 2004
+++ OpenGLPluginX.c Fri Jun 11 19:22:03 2004
@@ -176,5 +176,14 @@
// only clear when resizing, since raster content always fills the viewport
// glClear(GL_COLOR_BUFFER_BIT);
-
+ float overlay_scale_x = 1;
+ float overlay_scale_y = 1;
+ if (ctx->prefs.overlay_scaling) // scale overlay-pixels to match game-pixel scaling
+ {
+ //printf("DEBUG: OpenGL overlay_scaling is indeed on\n");
+#define RGB_TRIPLET_PIXELS 4.0 // overlay image dimensions must be multiples of four
+ overlay_scale_x = (float)( (ctx->viewportWidth / RGB_TRIPLET_PIXELS) / (ctx->screenTexture.w ) );
+ overlay_scale_y = (float)( (ctx->viewportHeight / RGB_TRIPLET_PIXELS) / (ctx->screenTexture.h ) );
+ }
+
DoBlit(inParams);
if (ctx->prefs.overlay)
@@ -185,11 +194,12 @@
glVertex2f(-1.0, -1.0);
glMultiTexCoord2fv(GL_TEXTURE0, &ctx->screenTexCoords[2]);
- glMultiTexCoord2f(GL_TEXTURE1,ctx->overlayTexture.fullx,0);
+ glMultiTexCoord2f(GL_TEXTURE1,(float)(ctx->overlayTexture.fullx/overlay_scale_x),0);
glVertex2f(1.0, -1.0);
glMultiTexCoord2fv(GL_TEXTURE0, &ctx->screenTexCoords[4]);
- glMultiTexCoord2f(GL_TEXTURE1,ctx->overlayTexture.fullx,ctx->overlayTexture.fully);
+ glMultiTexCoord2f(GL_TEXTURE1,(float)(ctx->overlayTexture.fullx/overlay_scale_x),
+ (float)(ctx->overlayTexture.fully/overlay_scale_y));
glVertex2f(1.0, 1.0);
glMultiTexCoord2fv(GL_TEXTURE0, &ctx->screenTexCoords[6]);
- glMultiTexCoord2f(GL_TEXTURE1,0,ctx->overlayTexture.fully);
+ glMultiTexCoord2f(GL_TEXTURE1,0,(float)(ctx->overlayTexture.fully/overlay_scale_y));
glVertex2f(-1.0, 1.0);
glEnd();
@@ -907,6 +917,7 @@
0, GL_RGBA, GL_UNSIGNED_BYTE, defaultOverlay);
}
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ // Is this necessary to fall back to GL_NEAREST?
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ctx->prefs.overlay_scaling ? GL_LINEAR : GL_NEAREST );
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ctx->prefs.overlay_scaling ? GL_LINEAR : GL_NEAREST );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
@@ -988,4 +999,9 @@
err = noErr;
break;
+ case 'Oscl':
+ value = GetControl32BitValue (cmd.source.control);
+ SetPrefAsBoolean (value, CFSTR("openGL_Overlay_scaling"));
+ err = noErr;
+ break;
}
break;
@@ -1152,4 +1198,5 @@
ControlID menuID = { kCreator, 4 };
ControlID syncID = { kCreator, 5 };
+ ControlID oscalingID = { kCreator, 6 };
Boolean b;
@@ -1159,5 +1206,10 @@
if (control)
SetControlValue( control, b );
-
+
+ GetPrefAsBoolean(&b, CFSTR("openGL_Overlay_scaling"),true);
+ GetControlByID( myDialog, &oscalingID, &control );
+ if (control)
+ SetControlValue( control, b );
+
GetPrefAsBoolean(&b, CFSTR("openGL_bilinear"),false);
GetControlByID( myDialog, &smoothID, &control );
@@ -1197,4 +1249,5 @@
GetPrefAsBoolean(&c->prefs.bilinear,CFSTR("openGL_bilinear"),false);
GetPrefAsBoolean(&c->prefs.overlay,CFSTR("openGL_arcade"),false);
+ GetPrefAsBoolean(&c->prefs.overlay_scaling,CFSTR("openGL_Overlay_scaling"),false);
GetPrefAsStr255 ((StringPtr)&c->prefs.overlayFileName, CFSTR("openGL_Overlay"));
}
--- OpenGLPluginX-orig.h Fri Jun 11 19:41:11 2004
+++ OpenGLPluginX.h Thu Jun 3 23:16:18 2004
@@ -32,4 +32,5 @@
Boolean bilinear;
Boolean overlay;
+ Boolean overlay_scaling;
unsigned char overlayFileName[256];
} OpenGLPluginPreferences;
Text file Source (historic): geocities.com/carstenklapp/macmame/override/macintosh
geocities.com/carstenklapp/macmame/overridegeocities.com/carstenklapp/macmame
geocities.com/carstenklapp
(to report bad content: archivehelp @ gmail)
|
|
|
|
|