fix focus issues, endRaw() problems, P3D and background() with raw, update

docs
This commit is contained in:
benfry
2007-10-23 20:58:28 +00:00
parent ac0ce27679
commit c1a054ec8a
8 changed files with 60 additions and 84 deletions
+6 -20
View File
@@ -350,7 +350,7 @@ there's no need to use "Import Library".
//////////////////////////////////////////////////////////////
Getting a UnsupportedClassVersionError? (especially with Java 1.5)
Getting a UnsupportedClassVersionError? (Java 1.5 and later)
When I compiled blah.jar (using the successful method mentioned
earlier) under Java 1.5, I get the following error from Processing:
@@ -359,25 +359,11 @@ java.lang.UnsupportedClassVersionError: blah/SomeClass
(Unsupported major.minor version 49.0)
This is because more recent versions of Java like to use their own
class file format that's not backwards compatible. Pretty annoying,
since it's rare that newer language features are actually used (and
shouldn't be with Processing anyway, since most likely you want to
make things work on Java 1.1)
class file format that's not backwards compatible.
The fix is to compile with "-target 1.1" which will create class
files that are compatible with Java 1.1. This is necessary for any
code that will run in a browser, since approximately 30-40% of web
users are still using Microsoft's Java 1.1.4 JVM (as of April 2005).
K. Damkjer adds: Depending on the version of Java that you're using,
specifying -target 1.1 when compiling libraries for distribution may
not be enough to get a 1.1 compatible class file. You may also need to
indicate source compatibility. It seems that -source 1.3 is the most
recent Java release that is capable of creating 1.1 targeted .class
files. All that said, here's a typical compile string for me:
javac -source 1.3 -target 1.1 -d .
-classpath %P5_HOME%\lib\core.jar package/dirs/*.java
When compiling a library, use somtehing like:
javac -source 1.4 -target 1.4 -d . \
-classpath /path/to/core.jar path/to/java/source/*.java
//////////////////////////////////////////////////////////////
@@ -479,4 +465,4 @@ official things as well.
//////////////////////////////////////////////////////////////
Ben Fry, Last updated 12 October 2007
Ben Fry, Last updated 23 October 2007
+1 -1
View File
@@ -7061,7 +7061,7 @@ in */
//System.out.println("showing frame");
//System.out.println("applet requesting focus");
//applet.requestFocus(); // ask for keydowns
applet.requestFocus(); // ask for keydowns
//System.out.println("exiting main()");
} catch (Exception e) {
+2 -1
View File
@@ -4310,7 +4310,8 @@ public abstract class PGraphics extends PImage implements PConstants {
public void endRaw() {
if (raw != null) {
// for 3D, need to flush any geometry that's been stored for sorting
raw.flush(); // this should be called by endDraw() instead
// (particularly if the ENABLE_DEPTH_SORT hint is set)
flush();
// just like beginDraw, this will have to be called because
// endDraw() will be happening outside of draw()
+28 -2
View File
@@ -423,6 +423,11 @@ public class PGraphics3D extends PGraphics {
}
render_lines();
}
// Clear this out in case flush() is called again.
// For instance, with hint(ENABLE_DEPTH_SORT), it will be called
// once on endRaw(), and once again at endDraw().
triangleCount = 0;
lineCount = 0;
}
@@ -1347,8 +1352,6 @@ public class PGraphics3D extends PGraphics {
protected void render_triangles() {
//System.out.println("rendering " + triangleCount + " triangles");
if (raw != null) {
raw.colorMode(RGB, 1);
raw.noStroke();
@@ -3874,7 +3877,30 @@ public class PGraphics3D extends PGraphics {
*/
Arrays.fill(pixels, backgroundColor);
Arrays.fill(zbuffer, Float.MAX_VALUE);
clearRaw();
}
protected void clearRaw() {
if (raw != null) {
raw.colorMode(RGB, 1);
raw.noStroke();
raw.fill(backgroundR, backgroundG, backgroundB);
raw.beginShape(TRIANGLES);
raw.vertex(0, 0);
raw.vertex(width, 0);
raw.vertex(0, height);
raw.vertex(width, 0);
raw.vertex(width, height);
raw.vertex(0, height);
raw.endShape();
}
}
@@ -29,8 +29,7 @@ import java.awt.image.*;
/**
* Subclass for PGraphics that implements the graphics API
* in Java 1.3+ using Java 2D.
* 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
+17 -26
View File
@@ -3,6 +3,13 @@ X fix problem with "export to application" and opengl
X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1193142573
X add focus requests so that better chance of keys etc working
X http://dev.processing.org/bugs/show_bug.cgi?id=645
_ argh, these make things worse (P3D run internal)
X add stuff about classversionerrors to the reference
X also update the libraries page
X fix background() with P3D and beginRaw()
X endRaw() has a problem with hint(ENABLE_DEPTH_SORT)
X because the triangles won't be rendered by the time endRaw() is called
X force depth sorted triangles to flush
_ image outofmemoryerror for casey's students
_ http://dev.processing.org/bugs/show_bug.cgi?id=355
@@ -19,6 +26,10 @@ o finish implementation so 1.1 support can return
X http://dev.processing.org/bugs/show_bug.cgi?id=125
o check into ricard's problems with beginRecord()
X i believe these were caused by linux java2d issues
X beginFrame()/beginDraw() and defaults()
X when should these be called, when not?
X seems as though the begin/end should happen inside beginRaw/Record
X defaults() gets called by the size() command in PApplet
fixed earlier
X is the texture[] array in PGraphics3D causing the problems with memory?
@@ -64,7 +75,7 @@ _ also add unhint() to the keywords file
_ and maybe remove hint() from keywords_base?
_ method to go from function name to the included examples where used?
createGraphics() mess
createGraphics() and load/updatePixels() mess
_ text characters showing up as opaque rectangles in tga files
_ http://dev.processing.org/bugs/show_bug.cgi?id=641
_ solution is to implement alpha compositing across all of P3D
@@ -98,6 +109,8 @@ _ or it's the PGraphics object, which does an updatePixels() immediately
_ if (modified) don't loadPixels again, just ignore it
_ make a note that updatePixels() only sets a flag in PImage
_ (but not PGraphics, which does it immediately)
_ copy() should automatically call updatePixels()
_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1173394373
rework some text/font code
_ fix getFontMetrics() warning
@@ -115,22 +128,6 @@ _ textAlign(CENTER) with P3D and OPENGL produces messy result
_ probably rounding error with the images
_ http://dev.processing.org/bugs/show_bug.cgi?id=475
_ loadBytes() needs optimization
_ don't bother using a buffering stream, just handle internally. gah!
_ copy() should automatically call updatePixels()
_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1173394373
_ disable key repeat? http://www.cokeandcode.com/node/9
KeyEvent nextPress = (KeyEvent) Toolkit.getDefaultToolkit().
getSystemEventQueue().
peekEvent(KeyEvent.KEY_PRESSED);
if ((nextPress == null) ||
(nextPress.getWhen() != e.getWhen()) ||
(nextPress.getKeyCode() != e.getKeyCode())) {
keys[e.getKeyCode()] = false;
}
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -218,6 +215,9 @@ _ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
_ loadBytes() needs optimization
_ don't bother using a buffering stream, just handle internally. gah!
_ modelX/Y/Z still having trouble
_ http://dev.processing.org/bugs/show_bug.cgi?id=486
@@ -236,15 +236,6 @@ _ since camera functions don't even look at it or set it
_ add notes about fixing serial on the mac to the faq (and link to bug)
_ beginFrame()/beginDraw() and defaults()
_ when should these be called, when not?
_ seems as though the begin/end should happen inside beginRaw/Record
_ defaults() gets called by the size() command in PApplet
_ endRaw() is a problem with hint(ENABLE_DEPTH_SORT)
_ because the triangles won't be rendered by the time endRaw() is called
_ force depth sorted triangles to flush
_ should beginRecord inherit settings from its parent renderer?
_ textFont() is null on beginRecord
_ same would be the case for strokeWeight, background, etc.
@@ -1930,25 +1930,10 @@ public class PGraphicsOpenGL extends PGraphics3D {
public void clear() {
if (raw != null) {
raw.colorMode(RGB, 1);
raw.noStroke();
raw.fill(backgroundR, backgroundG, backgroundB);
raw.beginShape(TRIANGLES);
raw.vertex(0, 0);
raw.vertex(width, 0);
raw.vertex(0, height);
raw.vertex(width, 0);
raw.vertex(width, height);
raw.vertex(0, height);
raw.endShape();
}
gl.glClearColor(backgroundR, backgroundG, backgroundB, 1);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
clearRaw();
}
+3 -15
View File
@@ -6,6 +6,9 @@ X cmd-w doesn't close window of opened applet
X both when running inside p5, or elsewhere
X add variable 'external' set to true when running tethered
X make note of new/open behavior (and toolbar) in the getting started ref
o make more fixes to the key bindings
o http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc/html/atg_keyboardshortcuts.asp
o http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGUserInput/chapter_11_section_3.html#//apple_ref/doc/uid/TP30000361-TPXREF61
_ pdf examples are shot
@@ -180,24 +183,9 @@ _ so should make the external version use the actual sketch name not temp
_ can't use PApplet.this, doesn't seem to like that
_ instead, must pass variable to inner class
_ make more fixes to the key bindings
_ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc/html/atg_keyboardshortcuts.asp
_ http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGUserInput/chapter_11_section_3.html#//apple_ref/doc/uid/TP30000361-TPXREF61
_ install astyle formatter
_ build on each platform, then "lipo -create astyle.* -output astyle"
Must have for 1.0:
> a,c) P2D to return, P2D to simply return in its previous form
> f) Java 1.5 support (jikes won't let you use Java 1.5 constructs)
> h) fix auto-format
For 2.0
> b) P2D to be accurate like JAVA2D
> e) Java 1.1 support (we're now limited to 1.3)
> g) support for running with user accounts that have umlauts/accents/etc
> d) strokeWeight() for 3D objects, even if it's ugly
LIBRARIES / svg
_ when using get(), reset the bounds for the objects