mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
initial merge with code from andres for A3D
This commit is contained in:
@@ -40,3 +40,11 @@
|
||||
|
||||
+ Registering methods (registerPost(), registerDraw(), etc) is not supported.
|
||||
Too much overhead for too little benefit.
|
||||
|
||||
+ All cursor-related methods have been removed. (They don't make sense in
|
||||
a touch-controlled interface.)
|
||||
|
||||
+ The all-lowercase version of arraycopy() (deprecated from the desktop version)
|
||||
has been removed.
|
||||
|
||||
+ The deprecated openStream() method has been removed. Use createInput().
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,100 @@
|
||||
package processing.android.core;
|
||||
|
||||
import javax.microedition.khronos.opengles.*;
|
||||
|
||||
/**
|
||||
* @invisible
|
||||
* This class provides some utilities functions.
|
||||
*/
|
||||
public class GLUtils
|
||||
{
|
||||
static public int parsePrimitiveType(String typeStr)
|
||||
{
|
||||
if (typeStr.equals("points")) return GL11.GL_POINTS;
|
||||
else if (typeStr.equals("line_strip")) return GL11.GL_LINE_STRIP;
|
||||
else if (typeStr.equals("line_loop")) return GL11.GL_LINE_LOOP;
|
||||
else if (typeStr.equals("lines")) return GL11.GL_LINES;
|
||||
else if (typeStr.equals("triangle_strip")) return GL11.GL_TRIANGLE_STRIP;
|
||||
else if (typeStr.equals("triangle_fan")) return GL11.GL_TRIANGLE_FAN;
|
||||
else if (typeStr.equals("triangles")) return GL11.GL_TRIANGLES;
|
||||
//else if (typeStr.equals("quad_strip")) return GL11.GL_QUAD_STRIP;
|
||||
//else if (typeStr.equals("quads")) return GL11.GL_QUADS;
|
||||
//else if (typeStr.equals("polygon")) return GL11.GL_POLYGON;
|
||||
else
|
||||
{
|
||||
System.err.println("Unrecognized geometry mode. Using points.");
|
||||
return GL11.GL_POINTS;
|
||||
}
|
||||
}
|
||||
|
||||
static public int parsePrimitiveTypeUpperCase(String typeStr)
|
||||
{
|
||||
if (typeStr.equals("POINTS")) return GL11.GL_POINTS;
|
||||
else if (typeStr.equals("POINT_SPRITES")) return GL11.GL_POINTS;
|
||||
else if (typeStr.equals("LINE_STRIP")) return GL11.GL_LINE_STRIP;
|
||||
else if (typeStr.equals("LINE_LOOP")) return GL11.GL_LINE_LOOP;
|
||||
else if (typeStr.equals("LINES")) return GL11.GL_LINES;
|
||||
else if (typeStr.equals("TRIANGLE_STRIP")) return GL11.GL_TRIANGLE_STRIP;
|
||||
else if (typeStr.equals("TRIANGLE_FAN")) return GL11.GL_TRIANGLE_FAN;
|
||||
else if (typeStr.equals("TRIANGLES")) return GL11.GL_TRIANGLES;
|
||||
//else if (typeStr.equals("QUAD_STRIP")) return GL.GL_QUAD_STRIP;
|
||||
//else if (typeStr.equals("QUADS")) return GL.GL_QUADS;
|
||||
//else if (typeStr.equals("POLYGON")) return GL.GL_POLYGON;
|
||||
else
|
||||
{
|
||||
System.err.println("Unrecognized geometry mode. Using points.");
|
||||
return GL11.GL_POINTS;
|
||||
}
|
||||
}
|
||||
|
||||
static public int parseVBOMode(String modeStr)
|
||||
{
|
||||
if (modeStr.equals("STATIC")) return GL11.GL_STATIC_DRAW;
|
||||
else if (modeStr.equals("DYNAMIC")) return GL11.GL_DYNAMIC_DRAW;
|
||||
//else if (modeStr.equals("STREAM")) return GL.GL_STREAM_COPY;
|
||||
else
|
||||
{
|
||||
System.err.println("Unrecognized VBO mode mode. Using static.");
|
||||
return GL11.GL_STATIC_DRAW;
|
||||
}
|
||||
}
|
||||
|
||||
static void printFramebufferError(int status)
|
||||
{
|
||||
/*
|
||||
if (status == GL11.GL_FRAMEBUFFER_COMPLETE_EXT) return;
|
||||
else if (status == GL11.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT)
|
||||
{
|
||||
System.err.println("Frame buffer is incomplete (GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT)");
|
||||
}
|
||||
else if (status == GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT)
|
||||
{
|
||||
System.err.println("Frame buffer is incomplete (GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT)");
|
||||
}
|
||||
else if (status == GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT)
|
||||
{
|
||||
System.err.println("Frame buffer is incomplete (GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT)");
|
||||
}
|
||||
else if (status == GL.GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT)
|
||||
{
|
||||
System.err.println("Frame buffer is incomplete (GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT)");
|
||||
}
|
||||
else if (status == GL.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT)
|
||||
{
|
||||
System.err.println("Frame buffer is incomplete (GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT)");
|
||||
}
|
||||
else if (status == GL.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT)
|
||||
{
|
||||
System.err.println("Frame buffer is incomplete (GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT)");
|
||||
}
|
||||
else if (status == GL.GL_FRAMEBUFFER_UNSUPPORTED_EXT)
|
||||
{
|
||||
System.err.println("Frame buffer is incomplete (GL_FRAMEBUFFER_UNSUPPORTED_EXT)");
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("Frame buffer is incomplete (unknown error code)");
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -271,7 +271,7 @@ public interface PConstants {
|
||||
|
||||
static final int LINE = 4;
|
||||
static final int LINES = 4;
|
||||
|
||||
|
||||
static final int TRIANGLE = 8;
|
||||
static final int TRIANGLES = 9;
|
||||
static final int TRIANGLE_STRIP = 10;
|
||||
@@ -291,6 +291,10 @@ public interface PConstants {
|
||||
static final int SPHERE = 40;
|
||||
static final int BOX = 41;
|
||||
|
||||
static public final int LINE_STRIP = 50;
|
||||
static public final int LINE_LOOP = 51;
|
||||
static public final int POINT_SPRITES = 52;
|
||||
|
||||
|
||||
// shape closing modes
|
||||
|
||||
@@ -335,11 +339,9 @@ public interface PConstants {
|
||||
// uv texture orientation modes
|
||||
|
||||
/** texture coordinates in 0..1 range */
|
||||
static final int NORMAL = 1;
|
||||
/** @deprecated use NORMAL instead */
|
||||
static final int NORMALIZED = 1;
|
||||
static final int NORMAL = 1;
|
||||
/** texture coordinates based on image width/height */
|
||||
static final int IMAGE = 2;
|
||||
static final int IMAGE = 2;
|
||||
|
||||
|
||||
// text placement modes
|
||||
|
||||
@@ -4112,6 +4112,10 @@ public class PGraphics extends PImage implements PConstants {
|
||||
showMethodWarning("lights");
|
||||
}
|
||||
|
||||
public void resetLights() {
|
||||
showMethodWarning("resetLights");
|
||||
}
|
||||
|
||||
public void noLights() {
|
||||
showMethodWarning("noLights");
|
||||
}
|
||||
@@ -5016,4 +5020,8 @@ public class PGraphics extends PImage implements PConstants {
|
||||
public boolean is3D() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void model(GLModel model, float x, float y, float z) {
|
||||
showMethodWarning("model");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,23 +29,9 @@ import android.graphics.Paint.Style;
|
||||
|
||||
|
||||
/**
|
||||
* Subclass for PGraphics that implements the graphics API using Java2D.
|
||||
*
|
||||
* <p>Pixel operations too slow? As of release 0085 (the first beta),
|
||||
* the default renderer uses Java2D. It's more accurate than the renderer
|
||||
* used in alpha releases of Processing (it handles stroke caps and joins,
|
||||
* and has better polygon tessellation), but it's super slow for handling
|
||||
* pixels. At least until we get a chance to get the old 2D renderer
|
||||
* (now called P2D) working in a similar fashion, you can use
|
||||
* <TT>size(w, h, P3D)</TT> instead of <TT>size(w, h)</TT> which will
|
||||
* be faster for general pixel flipping madness. </p>
|
||||
*
|
||||
* <p>To get access to the Java 2D "Graphics2D" object for the default
|
||||
* renderer, use:
|
||||
* <PRE>Graphics2D g2 = ((PGraphicsJava2D)g).g2;</PRE>
|
||||
* This will let you do Java 2D stuff directly, but is not supported in
|
||||
* any way shape or form. Which just means "have fun, but don't complain
|
||||
* if it breaks."</p>
|
||||
* Subclass for PGraphics that implements the graphics API using
|
||||
* the Android 2D graphics model. Similar tradeoffss to JAVA2D mode
|
||||
* with the original (desktop) version of Processing.
|
||||
*/
|
||||
public class PGraphicsAndroid2D extends PGraphics {
|
||||
|
||||
@@ -152,9 +138,9 @@ public class PGraphicsAndroid2D extends PGraphics {
|
||||
// FRAME
|
||||
|
||||
|
||||
public boolean canDraw() {
|
||||
return true;
|
||||
}
|
||||
// public boolean canDraw() {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
|
||||
public void requestDraw() {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
||||
0176 (private)
|
||||
X begin the merge of the new A3D, remove old OpenGL code
|
||||
|
||||
|
||||
_ add method to set the icon (and package name?)
|
||||
@@ -10,6 +11,7 @@ X add methods to request rendering
|
||||
_ need to deal with fps problems with this model
|
||||
_ check on multiple pointers (peter's msg)
|
||||
_ add clear and close to all stream methods?
|
||||
_ is there a way to get a width/height default to use for surfaceChanged?
|
||||
|
||||
P1 this is embarrassing, need to fix ASAP
|
||||
P2 need to fix before beta release
|
||||
|
||||
Reference in New Issue
Block a user