opengl cleanup during the flight back from MN

This commit is contained in:
benfry
2005-08-12 17:36:45 +00:00
parent b127aae5f6
commit a7ba67a0ef
5 changed files with 176 additions and 347 deletions
-10
View File
@@ -230,11 +230,8 @@ public interface PConstants {
static final int SQUARE = 1 << 0;
static final int ROUND = 1 << 1;
static final int PROJECT = 1 << 2;
//static final int CAP_MASK = SQUARE | ROUND | PROJECT;
static final int MITER = 1 << 3;
//static final int ROUND = 1 << 4;
static final int BEVEL = 1 << 5;
//static final int JOIN_MASK = MITERED | ROUND | BEVELED;
// lighting
@@ -245,12 +242,6 @@ public interface PConstants {
static final int SPOT = 3;
// net
//static final int CLIENT = 0;
//static final int SERVER = 1;
// key constants
// only including the most-used of these guys
@@ -294,7 +285,6 @@ public interface PConstants {
static final int SCALE_STROKE_WIDTH = 0;
static final int LIGHTING_AFFECTS_STROKE = 1;
//static final int NEW_GRAPHICS = 2;
static final int DISABLE_TEXT_SMOOTH = 3;
static final int DISABLE_SMOOTH_HACK = 4;
static final int NO_DEPTH_TEST = 5;
+76 -166
View File
@@ -30,44 +30,15 @@ import java.awt.image.*;
/**
* Subclass of PGraphics that handles 3D rendering.
* <p/>
* Lighting and camera implementation by Simon Greenwold.
*/
public class PGraphics3 extends PGraphics {
/** The modelview matrix. */
//public PMatrix modelview;
/** Inverse modelview matrix, used for lighting. */
//public PMatrix modelviewInv;
/**
* The camera matrix, the modelview
* will be set to this on beginFrame.
*/
//public PMatrix camera;
/** Inverse camera matrix */
//public PMatrix cameraInv;
// ........................................................
// Lighting-related variables
// store the facing direction to speed rendering
//protected boolean useBackfaceCulling = false; // is this in use?
// Material properties
//public float ambientR, ambientG, ambientB;
//public int ambientRi, ambientGi, ambientBi;
//public float specularR, specularG, specularB, specularA;
//public int specularRi, specularGi, specularBi, specularAi;
//public float emissiveR, emissiveG, emissiveB;
//public int emissiveRi, emissiveGi, emissiveBi;
//public float shininess;
// Whether or not we have to worry about vertex position for lighting calcs
private boolean lightingDependsOnVertexPosition;
@@ -90,15 +61,6 @@ public class PGraphics3 extends PGraphics {
// ........................................................
/** Camera field of view (in radians, as of rev 86) */
//public float cameraFOV;
/** Position of the camera */
//public float cameraX, cameraY, cameraZ;
//public float cameraNear, cameraFar;
//public float cameraAspect;
/**
* This is turned on at beginCamera, and off at endCamera
* Currently we don't support nested begin/end cameras.
@@ -106,9 +68,6 @@ public class PGraphics3 extends PGraphics {
*/
protected boolean manipulatingCamera;
// projection matrix
//public PMatrix projection; // = new PMatrix();
// These two matrices always point to either the modelview
// or the modelviewInv, but they are swapped during
// when in camera maniuplation mode. That way camera transforms
@@ -118,61 +77,6 @@ public class PGraphics3 extends PGraphics {
// ........................................................
/// the stencil buffer
//public int stencil[];
/// depth buffer
//public float zbuffer[];
// ........................................................
/** Maximum lights by default is 8, which is arbitrary,
but is the minimum defined by OpenGL */
//public static final int MAX_LIGHTS = 8;
//public int lightCount = 0;
/** Light types */
//public int lights[];
/** Light positions */
//public float lightsX[], lightsY[], lightsZ[];
/** Light direction (normalized vector) */
//public float lightsNX[], lightsNY[], lightsNZ[];
/** Light falloff */
//public float lightsFalloffConstant[];
//public float lightsFalloffLinear[];
//public float lightsFalloffQuadratic[];
/** Light spot angle */
//public float lightsSpotAngle[];
/** Cosine of light spot angle */
//public float lightsSpotAngleCos[];
/** Light spot concentration */
//public float lightsSpotConcentration[];
/** Diffuse colors for lights.
* For an ambient light, this will hold the ambient color.
* Internally these are stored as numbers between 0 and 1. */
//public float lightsDiffuseR[], lightsDiffuseG[], lightsDiffuseB[];
/** Specular colors for lights.
Internally these are stored as numbers between 0 and 1. */
//public float lightsSpecularR[], lightsSpecularG[], lightsSpecularB[];
//public float lightSpecularR;
//public float lightSpecularG;
//public float lightSpecularB;
//public float lightFalloffConstant;
//public float lightFalloffLinear;
//public float lightFalloffQuadratic;
// ........................................................
// pos of first vertex of current shape in vertices array
protected int vertex_start;
@@ -499,18 +403,18 @@ public class PGraphics3 extends PGraphics {
/**
* Sets the current normal vector.
* <P>
* <P/>
* This is for drawing three dimensional shapes and surfaces,
* allowing you to specify a vector perpendicular to the surface
* of the shape, which determines how lighting affects it.
* <P>
* <P/>
* For the most part, PGraphics will attempt to automatically
* assign normals to shapes, but since that's imperfect,
* this is a better option when you want more control.
* <P>
* <P/>
* For people familiar with OpenGL, this function is basically
* identical to glNormal3f().
* <P>
* <P/>
* Only applies inside a beginShape/endShape block.
*/
public void normal(float nx, float ny, float nz) {
@@ -1147,6 +1051,7 @@ public class PGraphics3 extends PGraphics {
pathCount++;
}
protected void add_line(int a, int b) {
add_line_with_clip(a, b);
}
@@ -1192,6 +1097,7 @@ public class PGraphics3 extends PGraphics {
pathLength[pathCount-1]++;
}
protected void add_triangle(int a, int b, int c) {
add_triangle_with_clip(a, b, c);
//add_triangle_no_clip(a, b, c);
@@ -1317,10 +1223,9 @@ public class PGraphics3 extends PGraphics {
float pa = (cameraNear - bz) / dz;
float pb = 1 - pa;
//System.out.println("az, bz, cameraNear, dz: " + az + ", " + bz + ", " + cameraNear + ", " + dz);
//System.out.println("PA, PB: " + pa + ", " + pb);
vertex(pa * va[MX] + pb * vb[MX], pa * va[MY] + pb * vb[MY], pa * va[MZ] + pb * vb[MZ]);
vertex(pa * va[MX] + pb * vb[MX],
pa * va[MY] + pb * vb[MY],
pa * va[MZ] + pb * vb[MZ]);
int irv = vertexCount - 1;
vertex_end_including_clip_verts++;
float[] rv = vertices[irv];
@@ -1373,6 +1278,7 @@ public class PGraphics3 extends PGraphics {
return irv;
}
protected final void add_triangle_no_clip(int a, int b, int c) {
//System.out.println("adding triangle " + triangleCount);
if (triangleCount == triangles.length) {
@@ -1404,8 +1310,6 @@ public class PGraphics3 extends PGraphics {
protected void render_triangles() {
//public void render_triangles() {
//System.out.println("PGraphics3 render triangles");
//System.out.println("rendering " + triangleCount + " triangles");
for (int i = 0; i < triangleCount; i ++) {
@@ -1457,6 +1361,27 @@ public class PGraphics3 extends PGraphics {
}
public void triangleCallback(float x1, float y1, float z1,
float r1, float g1, float b1, float a1,
float u1, float v1, boolean e1,
float x2, float y2, float z2,
float r2, float g2, float b2, float a2,
float u2, float v2, boolean e2,
float x3, float y3, float z3,
float r3, float g3, float b3, float a3,
float u3, float v3, boolean e3,
PImage texture) {
}
public void lineCallback(float x1, float y1, float z1,
float r1, float g1, float b1, float a1,
float x2, float y2, float z2,
float r2, float g2, float b2, float a2,
float weight, int cap, int join) {
}
protected void depth_sort_lines() {
}
@@ -1475,6 +1400,10 @@ public class PGraphics3 extends PGraphics {
line.setVertices(a[X], a[Y], a[Z],
b[X], b[Y], b[Z]);
//if (renderCallbackObject != null) {
//lineCallbackMethod.
//}
line.setIndex(index);
line.draw();
}
@@ -1910,8 +1839,8 @@ public class PGraphics3 extends PGraphics {
int vIndex;
// Handle lighting on, but no lights (in this case, just use emissive)
// This wont be used currently because lightCount == 0 is don't use lighting
// at all... So. OK. If that ever changes, use the below:
// This wont be used currently because lightCount == 0 is don't use
// lighting at all... So. OK. If that ever changes, use the below:
/*
if (lightCount == 0) {
vIndex = triangles[triIndex][VERTEX1];
@@ -1943,10 +1872,11 @@ public class PGraphics3 extends PGraphics {
}
// If the lighting doesn't depend on the vertex position, do the following:
// We've already dealt with MANUAL_SHAPE_NORMAL mode before we got into this
// function, so here we only have to deal with AUTO_NORMAL mode. So we calculate
// the normal for this triangle, and use that for the lighting
// If the lighting doesn't depend on the vertex position, do the
// following: We've already dealt with MANUAL_SHAPE_NORMAL mode before
// we got into this function, so here we only have to deal with
// AUTO_NORMAL mode. So we calculate the normal for this triangle,
// and use that for the lighting.
else if (!lightingDependsOnVertexPosition) {
vIndex = triangles[triIndex][VERTEX1];
int vIndex2 = triangles[triIndex][VERTEX2];
@@ -1969,9 +1899,12 @@ public class PGraphics3 extends PGraphics {
// The true at the end says the normal is already in world coordinates
calc_lighting_contribution(vIndex, tempLightingContribution, true);
copy_vertex_color_to_triangle(triIndex, vIndex, 0, tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex2, 1, tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex3, 2, tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex, 0,
tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex2, 1,
tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex3, 2,
tempLightingContribution);
}
// If lighting is position-dependent
@@ -1982,23 +1915,26 @@ public class PGraphics3 extends PGraphics {
vertices[vIndex][NY] = vertices[vertex_start][NY];
vertices[vIndex][NZ] = vertices[vertex_start][NZ];
calc_lighting_contribution(vIndex, tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex, 0, tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex, 0,
tempLightingContribution);
vIndex = triangles[triIndex][VERTEX2];
vertices[vIndex][NX] = vertices[vertex_start][NX];
vertices[vIndex][NY] = vertices[vertex_start][NY];
vertices[vIndex][NZ] = vertices[vertex_start][NZ];
calc_lighting_contribution(vIndex, tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex, 1, tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex, 1,
tempLightingContribution);
vIndex = triangles[triIndex][VERTEX3];
vertices[vIndex][NX] = vertices[vertex_start][NX];
vertices[vIndex][NY] = vertices[vertex_start][NY];
vertices[vIndex][NZ] = vertices[vertex_start][NZ];
calc_lighting_contribution(vIndex, tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex, 2, tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex, 2,
tempLightingContribution);
}
// lighting mode is AUTO_NORMAL
else {
vIndex = triangles[triIndex][VERTEX1];
@@ -2021,25 +1957,29 @@ public class PGraphics3 extends PGraphics {
vertices[vIndex][NZ] = norm[Z];
// The true at the end says the normal is already in world coordinates
calc_lighting_contribution(vIndex, tempLightingContribution, true);
copy_vertex_color_to_triangle(triIndex, vIndex, 0, tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex, 0,
tempLightingContribution);
vertices[vIndex2][NX] = norm[X];
vertices[vIndex2][NY] = norm[Y];
vertices[vIndex2][NZ] = norm[Z];
// The true at the end says the normal is already in world coordinates
calc_lighting_contribution(vIndex2, tempLightingContribution, true);
copy_vertex_color_to_triangle(triIndex, vIndex2, 1, tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex2, 1,
tempLightingContribution);
vertices[vIndex3][NX] = norm[X];
vertices[vIndex3][NY] = norm[Y];
vertices[vIndex3][NZ] = norm[Z];
// The true at the end says the normal is already in world coordinates
calc_lighting_contribution(vIndex3, tempLightingContribution, true);
copy_vertex_color_to_triangle(triIndex, vIndex3, 2, tempLightingContribution);
copy_vertex_color_to_triangle(triIndex, vIndex3, 2,
tempLightingContribution);
}
}
}
protected void handle_lighting() {
// If the lighting does not depend on vertex position and there is a single
@@ -2059,6 +1999,7 @@ public class PGraphics3 extends PGraphics {
}
}
protected void handle_no_lighting() {
int vIndex;
for (int tri = 0; tri < triangleCount; tri++) {
@@ -2071,6 +2012,8 @@ public class PGraphics3 extends PGraphics {
}
}
//////////////////////////////////////////////////////////////
// BASIC SHAPES
@@ -2637,6 +2580,7 @@ public class PGraphics3 extends PGraphics {
}
//////////////////////////////////////////////////////////////
// MATRIX TRANSFORMATIONS
@@ -2811,9 +2755,9 @@ public class PGraphics3 extends PGraphics {
/**
* Set matrix mode to the camera matrix (instead of
* the current transformation matrix). This means applyMatrix,
* resetMatrix, etc. will affect the camera.
* Set matrix mode to the camera matrix (instead of the current
* transformation matrix). This means applyMatrix, resetMatrix, etc.
* will affect the camera.
* <P>
* Note that the camera matrix is *not* the perspective matrix,
* it is in front of the modelview matrix (hence the name "model"
@@ -2866,13 +2810,12 @@ public class PGraphics3 extends PGraphics {
/**
* Record the current settings into the camera matrix.
* And set the matrix mode back to the current
* transformation matrix.
* Record the current settings into the camera matrix, and set
* the matrix mode back to the current transformation matrix.
* <P>
* Note that this will destroy any settings to scale(),
* translate() to your scene, because the final camera
* matrix will be copied (not multiplied) into the modelview.
* Note that this will destroy any settings to scale(), translate(),
* or whatever, because the final camera matrix will be copied
* (not multiplied) into the modelview.
*/
public void endCamera() {
if (!manipulatingCamera) {
@@ -3284,36 +3227,6 @@ public class PGraphics3 extends PGraphics {
ambientFromCalc();
}
/*
public void fill(int rgb) {
super.fill(rgb);
colorAmbient();
}
public void fill(float gray) {
super.fill(gray);
colorAmbient();
}
public void fill(float gray, float alpha) {
super.fill(gray, alpha);
colorAmbient();
}
public void fill(float x, float y, float z) {
super.fill(x, y, z);
colorAmbient();
}
public void fill(float x, float y, float z, float a) {
super.fill(x, y, z, a);
colorAmbient();
}
*/
//////////////////////////////////////////////////////////////
@@ -3345,9 +3258,6 @@ public class PGraphics3 extends PGraphics {
ambientR = calcR;
ambientG = calcG;
ambientB = calcB;
//ambientRi = calcRi;
//ambientGi = calcGi;
//ambientBi = calcBi;
}
+6 -6
View File
@@ -239,8 +239,10 @@ _ don't allow beginShape() if shape is already set
_ (otherwise will cause some very strange errors)
_ figure out a good model for adaptive sizing of circles
_ also goes for arcs, though will be weighted based on arc size
_ point appears to be broken
_ could be a problem with java 1.5? (was using win2k)
_ point() issues
_ point() being funneled through beginShape is terribly slow
_ go the other way 'round
_ sometimes broken, could be a problem with java 1.5? (was using win2k)
noStroke();
colorMode(RGB, 100);
for(int i=0; i<100; i++) {
@@ -327,10 +329,6 @@ _ clipping issues here.. but also something in scan converter
_ not clipping areas from offscreen
_ huge geometry slows things way down
_ points
_ point() being funneled through beginShape is terribly slow
_ go the other way 'round
CORE / PGraphics2
@@ -527,6 +525,8 @@ _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs
PGraphicsGL
_ point() doesn't work with some graphics card setups
_ http://dev.processing.org/bugs/show_bug.cgi?id=121
_ blend(), get(), set(), loadPixels, updatePixels() are broken in opengl
_ set(x, y, image) y reversed in openGL
_ http://dev.processing.org/bugs/show_bug.cgi?id=91
+69 -133
View File
@@ -38,7 +38,27 @@ import net.java.games.jogl.*;
* JOGL requires Java 1.4 or higher, so there are no restrictions on this
* code to be compatible with Java 1.1 or Java 1.3.
* <p/>
* Lighting and camera implementation by Simon Greenwold.
* This code relies on PGraphics3 for all lighting and transformations.
* Meaning that translate(), rotate(), and any lighting will be done in
* PGraphics3, and OpenGL is only used to blit lines and triangles as fast
* as it possibly can.
* <p/>
* For this reason, OpenGL may not be accelerated as far as it could be,
* but I don't have the time to maintain two separate versions of the
* renderer. My development time must always be focused on implementation
* and covering features first, and optimizing later.
* <p/>
* Further, the difference may be negligible, as the primary slowdown
* in Java is moving pixels (i.e. a large frame buffer is nearly impossible
* because Java just can't do a MemoryImageSource at screen resolution)
* and the overhead from JNI tends to be significant. In the latter case,
* we may even save time in some cases where a large number of calls to
* OpenGL would otherwise be used, but that's probably a stretch.
* <p/>
* The code is also very messy, while features are being added and
* removed rapidly as we head towards 1.0. Things got particularly ugly
* as we approached beta while both Simon and I were working on it.
* Relax, we'll get it fixed up later.
*/
public class PGraphicsGL extends PGraphics3 {
public GL gl;
@@ -370,11 +390,6 @@ public class PGraphicsGL extends PGraphics3 {
}
private final float min(float a, float b) {
return (a < b) ? a : b;
}
protected void render_triangles() {
report("into triangles");
//System.out.println("rendering " + triangleCount + " triangles");
@@ -601,8 +616,8 @@ public class PGraphicsGL extends PGraphics3 {
/**
* Handled entirely by OpenGL, so use this to override the superclass.
*/
protected void light_and_transform() {
}
//protected void light_and_transform() {
//}
//////////////////////////////////////////////////////////////
@@ -611,7 +626,7 @@ public class PGraphicsGL extends PGraphics3 {
/**
* Cache an image using a specified glTexName
* (name is just an integer index).
*
* <p/>
* If a cacheIndex is already assigned in the image,
* this request will be ignored.
*/
@@ -931,19 +946,13 @@ public class PGraphicsGL extends PGraphics3 {
vertex = new double[] {
x + textPoints[0], y + textPoints[1], 0
};
//textVertex[0] = x + textPoints[0];
//textVertex[1] = y + textPoints[1];
if (TESS) {
//glu.gluTessVertex(tobj, textVertex, textVertex);
//double a[] = new double[3];
//a[0] = textVertex[0];
//a[1] = textVertex[1];
glu.gluTessVertex(tobj, vertex, vertex);
} else {
vertex((float) vertex[0], (float) vertex[1]);
}
lastX = textPoints[0]; //vertex[0];
lastY = textPoints[1]; //vertex[1];
lastX = textPoints[0];
lastY = textPoints[1];
break;
case PathIterator.SEG_QUADTO: // 2 points
@@ -957,8 +966,7 @@ public class PGraphicsGL extends PGraphics3 {
x + bezierPoint(lastX, textPoints[0],
textPoints[0], textPoints[2], t),
y + bezierPoint(lastY, textPoints[1],
textPoints[1], textPoints[3], t),
0
textPoints[1], textPoints[3], t), 0
};
if (TESS) {
glu.gluTessVertex(tobj, vertex, vertex);
@@ -966,8 +974,6 @@ public class PGraphicsGL extends PGraphics3 {
vertex((float) vertex[0], (float) vertex[1]);
}
}
//textVertex[0] = textPoints[2];
//textVertex[1] = textPoints[3];
lastX = textPoints[2];
lastY = textPoints[3];
break;
@@ -984,8 +990,7 @@ public class PGraphicsGL extends PGraphics3 {
x + bezierPoint(lastX, textPoints[0],
textPoints[2], textPoints[4], t),
y + bezierPoint(lastY, textPoints[1],
textPoints[3], textPoints[5], t),
0
textPoints[3], textPoints[5], t), 0
};
if (TESS) {
glu.gluTessVertex(tobj, vertex, vertex);
@@ -1223,7 +1228,8 @@ public class PGraphicsGL extends PGraphics3 {
//return num;
}
public void ambientLight(float r, float g, float b, float x, float y, float z) {
public void ambientLight(float r, float g, float b,
float x, float y, float z) {
super.ambientLight(r, g, b, x, y, z);
glLightEnable(lightCount - 1);
glLightAmbient(lightCount - 1);
@@ -1404,87 +1410,34 @@ public class PGraphicsGL extends PGraphics3 {
//////////////////////////////////////////////////////////////
/*
public void fill(int rgb) {
super.fill(rgb);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE, new float[] {calcR, calcG, calcB, calcA});
}
public void fill(float gray) {
super.fill(gray);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE, new float[] {calcR, calcG, calcB, calcA});
}
public void fill(float gray, float alpha) {
super.fill(gray, alpha);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE, new float[] {calcR, calcG, calcB, calcA});
}
public void fill(float x, float y, float z) {
super.fill(x, y, z);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE, new float[] {calcR, calcG, calcB, calcA});
}
public void fill(float x, float y, float z, float a) {
super.fill(x, y, z, a);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE, new float[] {calcR, calcG, calcB, calcA});
}
*/
protected void fillFromCalc() {
super.fillFromCalc();
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE,
new float[] { calcR, calcG, calcB, calcA });
}
/*
public void diffuse(int rgb) {
super.diffuse(rgb);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, new float[] {calcR, calcG, calcB, calcA});
}
public void diffuse(float gray) {
super.diffuse(gray);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, new float[] {calcR, calcG, calcB, calcA});
}
public void diffuse(float gray, float alpha) {
super.diffuse(gray, alpha);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, new float[] {calcR, calcG, calcB, calcA});
}
public void diffuse(float x, float y, float z) {
super.diffuse(x, y, z);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, new float[] {calcR, calcG, calcB, calcA});
}
public void diffuse(float x, float y, float z, float a) {
super.diffuse(x, y, z, a);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, new float[] {calcR, calcG, calcB, calcA});
}
*/
//////////////////////////////////////////////////////////////
public void ambient(int rgb) {
super.ambient(rgb);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, new float[] {calcR, calcG, calcB, calcA});
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT,
new float[] { calcR, calcG, calcB, calcA });
}
public void ambient(float gray) {
super.ambient(gray);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, new float[] {calcR, calcG, calcB, calcA});
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT,
new float[] { calcR, calcG, calcB, calcA });
}
public void ambient(float x, float y, float z) {
super.ambient(x, y, z);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, new float[] {calcR, calcG, calcB, calcA});
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT,
new float[] { calcR, calcG, calcB, calcA });
}
@@ -1493,30 +1446,35 @@ public class PGraphicsGL extends PGraphics3 {
public void specular(int rgb) {
super.specular(rgb);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, new float[] {calcR, calcG, calcB, calcA});
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR,
new float[] { calcR, calcG, calcB, calcA });
}
public void specular(float gray) {
super.specular(gray);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, new float[] {calcR, calcG, calcB, calcA});
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR,
new float[] { calcR, calcG, calcB, calcA });
}
public void specular(float gray, float alpha) {
super.specular(gray, alpha);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, new float[] {calcR, calcG, calcB, calcA});
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR,
new float[] { calcR, calcG, calcB, calcA });
}
public void specular(float x, float y, float z) {
super.specular(x, y, z);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, new float[] {calcR, calcG, calcB, calcA});
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR,
new float[] { calcR, calcG, calcB, calcA });
}
public void specular(float x, float y, float z, float a) {
super.specular(x, y, z, a);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, new float[] {calcR, calcG, calcB, calcA});
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR,
new float[] { calcR, calcG, calcB, calcA });
}
@@ -1525,19 +1483,22 @@ public class PGraphicsGL extends PGraphics3 {
public void emissive(int rgb) {
super.emissive(rgb);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_EMISSION, new float[] {calcR, calcG, calcB, calcA});
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_EMISSION,
new float[] { calcR, calcG, calcB, calcA });
}
public void emissive(float gray) {
super.emissive(gray);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_EMISSION, new float[] {calcR, calcG, calcB, calcA});
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_EMISSION,
new float[] { calcR, calcG, calcB, calcA });
}
public void emissive(float x, float y, float z) {
super.emissive(x, y, z);
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_EMISSION, new float[] {calcR, calcG, calcB, calcA});
gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_EMISSION,
new float[] { calcR, calcG, calcB, calcA });
}
@@ -1967,8 +1928,6 @@ public class PGraphicsGL extends PGraphics3 {
(getset[0] & 0xff00) |
((getset[0] >> 16) & 0xff);
}
//throw new RuntimeException("get() not yet implemented for OpenGL");
//return 0; // TODO
}
@@ -1996,21 +1955,7 @@ public class PGraphicsGL extends PGraphics3 {
newbie.pixels);
nativeToJavaARGB(newbie);
//newbie.updatePixels();
/*
int index = y*width + x;
int index2 = 0;
for (int row = y; row < y+h; row++) {
System.arraycopy(pixels, index,
newbie.pixels, index2, w);
index+=width;
index2+=w;
}
*/
return newbie;
//throw new RuntimeException("get() not yet implemented for OpenGL");
//return null; // TODO
}
@@ -2019,8 +1964,6 @@ public class PGraphicsGL extends PGraphics3 {
}
//PImage setter = new PImage(1, 1);
public void set(int x, int y, int argb) {
if (BIG_ENDIAN) {
// convert ARGB to RGBA
@@ -2031,13 +1974,11 @@ public class PGraphicsGL extends PGraphics3 {
getset[0] =
(argb & 0xff00ff00) |
((argb << 16) & 0xff0000) |
//(argb & 0xff00) |
((argb >> 16) & 0xff);
}
gl.glRasterPos2f(x + EPSILON, y + EPSILON);
gl.glDrawPixels(1, 1, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, getset);
//throw new RuntimeException("set() not available with OpenGL");
}
@@ -2076,11 +2017,11 @@ public class PGraphicsGL extends PGraphics3 {
/**
* This is really inefficient and not a good idea.
* Use get() and set() with a smaller image area.
* This is really inefficient and not a good idea in OpenGL.
* Use get() and set() with a smaller image area, or call the
* filter on an image instead, and then draw that.
*/
public void filter(int kind) {
//throw new RuntimeException("filter() not available with OpenGL");
PImage temp = get();
temp.filter(kind);
set(0, 0, temp);
@@ -2088,11 +2029,11 @@ public class PGraphicsGL extends PGraphics3 {
/**
* This is really inefficient and not a good idea.
* Use get() and set() with a smaller image area.
* This is really inefficient and not a good idea in OpenGL.
* Use get() and set() with a smaller image area, or call the
* filter on an image instead, and then draw that.
*/
public void filter(int kind, float param) {
//throw new RuntimeException("filter() not available with OpenGL");
PImage temp = get();
temp.filter(kind, param);
set(0, 0, temp);
@@ -2102,17 +2043,10 @@ public class PGraphicsGL extends PGraphics3 {
//////////////////////////////////////////////////////////////
// TODO implement these with glCopyPixels
//public void copy(PImage src, int dx, int dy) {
//throw new RuntimeException("copy() not available with OpenGL");
//}
/**
* TODO - extremely slow and not optimized.
* Currently calls a loadPixels() on the whole canvas,
* then does the copy, then it calls updatePixels().
* Extremely slow and not optimized, should use glCopyPixels instead.
* Currently calls a loadPixels() on the whole canvas, then does the copy,
* then it calls updatePixels().
*/
public void copy(int sx1, int sy1, int sx2, int sy2,
int dx1, int dy1, int dx2, int dy2) {
@@ -2142,18 +2076,12 @@ public class PGraphicsGL extends PGraphics3 {
public void blend(int sx, int sy, int dx, int dy, int mode) {
set(dx, dy, PImage.blend(get(sx, sy), get(dx, dy), mode));
//loadPixels();
//super.blend(sx, sy, dx, dy, mode);
//updatePixels();
}
public void blend(PImage src,
int sx, int sy, int dx, int dy, int mode) {
set(dx, dy, PImage.blend(src.get(sx, sy), get(dx, dy), mode));
//loadPixels();
//super.blend(src, sx, sy, dx, dy, mode);
//updatePixels();
}
@@ -2196,6 +2124,14 @@ public class PGraphicsGL extends PGraphics3 {
//////////////////////////////////////////////////////////////
private final float min(float a, float b) {
return (a < b) ? a : b;
}
//////////////////////////////////////////////////////////////
/**
* Report on anything from glError().
* Don't use this inside glBegin/glEnd otherwise it'll
+25 -32
View File
@@ -30,6 +30,13 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=84
o rebuild jikes with --enable-static --disable-shared
X http://dev.processing.org/bugs/show_bug.cgi?id=47
X switched to use the version from the rpm on the sf.net site
o auto-run the javadoc in dist.sh
o doctor a copy of the css file to use p5 defaults
o and re-copy the css in after generating the doc each time
X timing fix introduce regression on linux
X extra (NUL?) chars are added
X i.e. on first run, the ten blank lines each have a li'l box
X http://dev.processing.org/bugs/show_bug.cgi?id=118
fixed in previous releases
X closing window w/o first hitting stop() causes freak out
@@ -56,6 +63,16 @@ _ can also just change the name
_ make a note in the library howto about using something besides p5
_ don't allow subfolders forever inside the sketchbook folder
_ once a sketch is found, don't recurse deeper
_ same for libraries, cuz this makes a mess
_ (do this right after rev 91 release... could break things)
_ make simple tool for casey to rebuild all the examples at once
_ first select a folder, then will open each sketch in turn, and export
_ just make it easier to go to the next sketch
_ need to rebuild with this release because of 1.3/1.4 issues
_ http://dev.processing.org/bugs/show_bug.cgi?id=117
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -77,19 +94,12 @@ X make os into: Mac OS, Windows, Linux, Other
X while other categories might exist, it's too confusing for minimal benefit
o make things that are P5 into "enhancement"
o unless a P6 can be added? or something called "enhancement"?
_ link to list all bugs (especially sorted by priority)
_ don't allow subfolders forever inside the sketchbook folder
_ once a sketch is found, don't recurse deeper
_ same for libraries, cuz this makes a mess
_ (do this right after rev 91 release... could break things)
_ make simple tool for casey to rebuild all the examples at once
_ first select a folder, then will open each sketch in turn, and export
_ just make it easier to go to the next sketch
_ need to rebuild with this release because of 1.3/1.4 issues
_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=WebsiteBugs;action=display;num=1117258456
_ is there a way to list "all" bugs (especially sorted by priority?)
_ or at least the first 20 listed by priority?
forum bugs
_ when replying, all the replies so far are listed twice
_ fonts are wrong all over the place (use windows to debug)
_ emacs keybindings
_ general (easier to support)
@@ -122,17 +132,6 @@ _ ctrl-x-2 split window
_ ctrl-x-o switch windows
_ ctrl-x-1 single window
_ auto-run the javadoc in dist.sh
_ doctor a copy of the css file to use p5 defaults
_ and re-copy the css in after generating the doc each time
forum bugs
_ when replying, all the replies so far are listed twice
_ fonts are wrong all over the place (use windows to debug)
bugzilla
_ get these two todo lists into their bugzilla categories
_ setup bugzilla and enter all the bugs
_ faq - is there a way to do xxx?
_ advanced users who are outgrowing the basic reference:
@@ -154,6 +153,8 @@ _ get an xml library and example in there
_ nanoxml problems with manifest
_ appears to use 1.6.8 version since it's just two classes
_ explanation of can't mix awt components with p5
_ post to web example
_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=VideoCamera;action=display;num=1117194066#7
@@ -176,15 +177,7 @@ _ starting with the one about modifying the sketch name for spaces
_ http://processing.org/bugs/show_bug.cgi?id=3
PDE / Console
_ timing fix introduce regression on linux
_ extra (NUL?) chars are added
_ i.e. on first run, the ten blank lines each have a li'l box
_ http://dev.processing.org/bugs/show_bug.cgi?id=118
PDE / Compiler & Preprocessor?
PDE / Compiler & Preprocessor
_ casting problems in the parser
_ straighten out int() -> toInt() conversions