get current pixel scale from GLWindow

This commit is contained in:
codeanticode
2015-05-17 09:14:22 -04:00
parent 4037d0ec43
commit 474dddf704
4 changed files with 35 additions and 23 deletions

View File

@@ -132,11 +132,6 @@ public abstract class PGL {
* order to make sure the lines are always on top of the fill geometry */
protected static float STROKE_DISPLACEMENT = 0.999f;
// ........................................................
// Retina support
int pixel_scale = 1;
// ........................................................
@@ -566,9 +561,10 @@ public abstract class PGL {
x = (int)offsetX;
y = (int)offsetY;
}
float scale = pg.getPixelScale();
drawTexture(TEXTURE_2D, glColorTex.get(frontTex), fboWidth, fboHeight,
x, y, pg.width, pg.height,
0, 0, pixel_scale * pg.width, pixel_scale * pg.height,
0, 0, (int)(scale * pg.width), (int)(scale * pg.height),
0, 0, pg.width, pg.height);
}
@@ -663,10 +659,11 @@ public abstract class PGL {
x = (int)offsetX;
y = (int)offsetY;
}
float scale = pg.getPixelScale();
drawTexture(TEXTURE_2D, glColorTex.get(backTex),
fboWidth, fboHeight,
x, y, pg.width, pg.height,
0, 0, pixel_scale * pg.width, pixel_scale * pg.height,
0, 0, (int)(scale * pg.width), (int)(scale * pg.height),
0, 0, pg.width, pg.height);
// Swapping front and back textures.
@@ -720,12 +717,14 @@ public abstract class PGL {
private void createFBOLayer() {
String ext = getString(EXTENSIONS);
float scale = pg.getPixelScale();
if (-1 < ext.indexOf("texture_non_power_of_two")) {
fboWidth = pixel_scale * pg.width;
fboHeight = pixel_scale * pg.height;
fboWidth = (int)(scale * pg.width);
fboHeight = (int)(scale * pg.height);
} else {
fboWidth = nextPowerOfTwo(pixel_scale * pg.width);
fboHeight = nextPowerOfTwo(pixel_scale * pg.height);
fboWidth = nextPowerOfTwo((int)(scale * pg.width));
fboHeight = nextPowerOfTwo((int)(scale * pg.height));
}
int maxs = maxSamples();