mirror of
https://github.com/processing/processing4.git
synced 2026-02-14 10:55:38 +01:00
textures working, but still no fonts
This commit is contained in:
@@ -4028,7 +4028,7 @@ public class PApplet extends Applet
|
||||
Frame frame = new Frame();
|
||||
frame.setResizable(false); // remove the grow box
|
||||
frame.pack(); // get insets. get more.
|
||||
frame.show(); // gl hack
|
||||
//frame.show(); // gl hack
|
||||
Class c = Class.forName(name);
|
||||
PApplet applet = (PApplet) c.newInstance();
|
||||
|
||||
@@ -4141,6 +4141,11 @@ public class PApplet extends Applet
|
||||
// public functions for processing.core
|
||||
|
||||
|
||||
public void modified() {
|
||||
g.modified();
|
||||
}
|
||||
|
||||
|
||||
public void alpha(int alpha[]) {
|
||||
g.alpha(alpha);
|
||||
}
|
||||
|
||||
@@ -191,11 +191,10 @@ public class PFont implements PConstants {
|
||||
for (int y = 0; y < h; y++) {
|
||||
for (int x = 0; x < w; x++) {
|
||||
int valu = temp[y*w + x] & 0xff;
|
||||
//images[i].pixels[y*64 + x] = valu;
|
||||
images[i].pixels[y * twidth + x] = valu;
|
||||
// the following makes javagl more happy..
|
||||
// not sure what's going on
|
||||
//(valu << 24) | (valu << 16) | (valu << 8) | valu; //0xffffff;
|
||||
//images[i].pixels[y * twidth + x] = valu;
|
||||
|
||||
images[i].pixels[y * twidth + x] =
|
||||
(valu << 24) | (valu << 16) | (valu << 8) | valu;
|
||||
//System.out.print((images[i].pixels[y*64+x] > 128) ? "*" : ".");
|
||||
}
|
||||
//System.out.println();
|
||||
|
||||
@@ -85,7 +85,9 @@ public class PImage implements PConstants, Cloneable {
|
||||
public boolean smooth = false;
|
||||
|
||||
/** for gl subclass / hardware accel */
|
||||
public int cacheIndex;
|
||||
public int tindex;
|
||||
public int tpixels[];
|
||||
public int twidth, theight;
|
||||
|
||||
// private fields
|
||||
private int fracU, ifU, fracV, ifV, u1, u2, v1, v2, sX, sY, iw, iw1, ih1;
|
||||
@@ -108,7 +110,7 @@ public class PImage implements PConstants, Cloneable {
|
||||
*/
|
||||
public PImage() {
|
||||
format = RGB; // makes sure that this guy is useful
|
||||
cacheIndex = -1;
|
||||
tindex = -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +138,7 @@ public class PImage implements PConstants, Cloneable {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.format = format;
|
||||
this.cacheIndex = -1;
|
||||
this.tindex = -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +150,39 @@ public class PImage implements PConstants, Cloneable {
|
||||
this.height = height;
|
||||
this.pixels = new int[width*height];
|
||||
this.format = format;
|
||||
this.cacheIndex = -1;
|
||||
this.tindex = -1;
|
||||
}
|
||||
|
||||
|
||||
public void modified() {
|
||||
tindex = -1;
|
||||
|
||||
int width2 = (int) Math.pow(2, Math.ceil(Math.log(width) / Math.log(2)));
|
||||
int height2 = (int) Math.pow(2, Math.ceil(Math.log(height) / Math.log(2)));
|
||||
|
||||
if ((width2 == width) && (height2 == height)) {
|
||||
// image can be used by itself as the texture image
|
||||
tpixels = pixels;
|
||||
|
||||
} else {
|
||||
if ((width2 > twidth) || (height2 > theight)) {
|
||||
// either twidth/theight are zero, or size has changed
|
||||
tpixels = null;
|
||||
}
|
||||
if (tpixels == null) {
|
||||
twidth = width2;
|
||||
theight = height2;
|
||||
tpixels = new int[twidth * theight];
|
||||
}
|
||||
// copy image data into the texture
|
||||
int p = 0;
|
||||
int t = 0;
|
||||
for (int y = 0; y < height; y++) {
|
||||
System.arraycopy(pixels, p, tpixels, t, width);
|
||||
p += width;
|
||||
t += twidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +205,7 @@ public class PImage implements PConstants, Cloneable {
|
||||
} catch (InterruptedException e) { }
|
||||
|
||||
format = RGB;
|
||||
cacheIndex = -1;
|
||||
tindex = -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ package processing.core;
|
||||
|
||||
public interface PMethods {
|
||||
|
||||
public void modified();
|
||||
|
||||
public void alpha(int alpha[]);
|
||||
|
||||
public void alpha(PImage alpha);
|
||||
|
||||
@@ -12,6 +12,10 @@ X eyeX, eyeY etc have been renamed cameraX/Y/Z, and cameraNear/Far
|
||||
X modify targa and tiff writing routines to break into header writing
|
||||
X writeTIFF, writeHeaderTIFF, writeTGA, writeHeaderTGA
|
||||
|
||||
_ remove need to use depth() at the beginning
|
||||
_ and cameraMode(PERSPECTIVE) on each frame
|
||||
_ reverse y coordinates
|
||||
|
||||
_ implement size(0, 0) -> just doesn't bother doing a frame.show();
|
||||
_ implement fullscreen().. this takes over the screen as best it can
|
||||
_ really more like present mode..
|
||||
|
||||
Reference in New Issue
Block a user