Sync android and desktop versions of P3D.

This commit is contained in:
codeanticode
2012-03-30 21:40:58 +00:00
parent f90faeb184
commit 1a05916a50
9 changed files with 657 additions and 842 deletions

View File

@@ -43,7 +43,7 @@ public class PTexture implements PConstants {
public int width, height;
protected PApplet parent; // The Processing applet
protected PGraphicsOpenGL pg; // The main renderer
protected PGraphicsOpenGL pg; // The main renderer
protected PGL pgl; // The interface between Processing and OpenGL.
protected PGL.Context context; // The context that created this texture.
@@ -479,7 +479,7 @@ public class PTexture implements PConstants {
////////////////////////////////////////////////////////////
// Utilities
/**
* Flips intArray along the X axis.
@@ -543,7 +543,7 @@ public class PTexture implements PConstants {
* @param h int
*/
protected void convertToRGBA(int[] intArray, int[] tIntArray, int arrayFormat, int w, int h) {
if (PGraphicsOpenGL.BIG_ENDIAN) {
if (PGL.BIG_ENDIAN) {
switch (arrayFormat) {
case ALPHA:
@@ -683,7 +683,7 @@ public class PTexture implements PConstants {
protected void convertToARGB(int[] intArray, int[] tIntArray) {
int t = 0;
int p = 0;
if (PGraphicsOpenGL.BIG_ENDIAN) {
if (PGL.BIG_ENDIAN) {
// RGBA to ARGB conversion: shifting RGB 8 bits to the right,
// and placing A 24 bits to the left.
@@ -820,12 +820,15 @@ public class PTexture implements PConstants {
if (scale) {
// Rendering tex into "this", and scaling the source rectangle
// to cover the entire destination region.
pg.drawTexture(tex, x, y, w, h, 0, 0, width, height);
pgl.drawTexture(tex.glTarget, tex.glID, tex.glWidth, tex.glHeight,
x, y, w, h, 0, 0, width, height);
} else {
// Rendering tex into "this" but without scaling so the contents
// of the source texture fall in the corresponding texels of the
// destination.
pg.drawTexture(tex, x, y, w, h, x, y, w, h);
pgl.drawTexture(tex.glTarget, tex.glID, tex.glWidth, tex.glHeight,
x, y, w, h, x, y, w, h);
}
pg.popFramebuffer();
}