I've stumbled into something weird, i can't seem to run any sketch that uses opengl as a renderer anymore. i'm getting this error:
"classformat error illegal utf8 string in constant pool in class file com/sun/opengl/impl/GLImpl"
I never had any problems before , sketches that ran yesterday won't run now :( a quick search reveals that:
"
This can occur when the JDK version that you have does not match or it is older than the JDK version that the project has been developed on." >>What?? i didn't update or anything overnight and if so i've never had any problems before.
Any help on this is very very much appreciated...
FRid
(can you catch the input of the crashreport in the console to a txt-file?)
I'm trying to use noise() to create a colormap but instead of "blobs" of color(/white) i get stripes and i can't really figure out why. As always help will be greatly appreciated.
I have sketch with a size of 1000*500 pixels running 30.fps and i'm trying to capture the scene with GsVideo but i'm getting a lot of dropped frames. Anybody experience with that? Would it be wise to set the queueSize to 0, javadoc says it can "grow arbitarily large". In my case i think very (undoable?) large because after 30-something seconds my sketch has already dropped about 500 frames and i need about 5 min. of video. Advice on how to avoid this would be very much appreciated.
Great library but i can't seem to find out why geometry facing the camera is "cut off", i've added a picture which i think shows better what i mean. It's part of a 50*50 grid
I've modified the chatserver-example to write incoming data to a textfile but as easy as that sounds it doesn't really return anything. The weird thing is that the incoming messages are displayed in the draw-window as "text"-objects but i can't get the strings to print in either the outputfile or the console, it always seems to returns null. Any clue?
Thanks,
FRid
The client
import processing.net.*;
Client c; String data;
void setup() { size(200, 200); background(50); fill(200); c = new Client(this, "127.0.0.1", 8888); // Connect to server on port 80 c.write("GET http://localhost:8888/foursquare?code=CODE/ HTTP/1.1\n"); // Use the HTTP "GET" command to ask for a Web page c.write("Hello, anybody"); // Be polite and say who we are c.write("out there?"); }
void draw() { if (c.available() > 0) { // If there's incoming data from the client... data = c.readString(); // ...then grab it and print it //println(data); } }
The server:
import processing.net.*;
int port = 8888; boolean myServerRunning = true; int bgColor = 0; int direction = 1; int textLine = 60;
Server myServer; ArrayList strings; PrintWriter output;
void setup() { size(1000, 500); textFont(createFont("SanSerif", 16)); strings = new ArrayList(); myServer = new Server(this, port); // Starts a myServer on port 10002 output = createWriter("output.txt"); background(0); }
void mousePressed() { // If the mouse clicked the myServer stops for (int i=0;i<strings.size();i++) { String s = (String) strings.get(i); output.println(s); } output.flush(); // Writes the remaining data to the file output.close(); // Finishes the file myServer.stop(); myServerRunning = false; exit(); // Stops the program }
I'm trying to get foursquare-data into processing but i'm running into troubles. I've downloaded two java-api's, "foursquare4j" and the official (i believe) "foursquare V2 api for Java" but i'm a bit lost. The focus seems to lie on development for mobile devices and user-interaction while i'm creating (well, trying to ...) a desktop-application without any user-interaction or login. All i'm after is checking when/who checks in to a certain venue.
The/my problem seems to lie with the authorizing, i can't get it to work and because it's all over https i can't see what's going with wireshark for example. Plus the whole concept of a callback-url is new to me.
I feel i'm a bit in over my head, i've worked with twitter in processing before but i feel that is better documented and takes care of all the Oauth-stuff automatically (or at least i didn't see it) If anyone can offer some insight into this i would be very, very gratefull.
Thanks a bunch in advance,
FRid
This example uses the foursquare4j-api but it gives the error- "cannot find anything named response". A quick search reveals it has something to do with servlets).
String id = "<ClientId>"; String secret = "<ClientSecret>"; int port = 8888;
void setup() { size(200,200);
FoursquareApi foursquareApi = new FoursquareApi(id, secret, "Localhost:port"); try { // First we need to redirect our user to authentication page. response.sendRedirect(foursquareApi.getAuthenticationUrl()); } catch (IOException e) { println(e);// TODO: Error handling } }
void draw() {
}
This is something i've pieced together from the official api-website but it's giving me a java.lang.NullpointerException and i have no idea why. This one is using the official java-api.
FoursquareApi foursquareApi = new FoursquareApi(id, secret, "Localhost:port"); //FoursquareApi foursquareApi = new FoursquareApi(id, secret); try { Result<VenuesSearchResult> result = foursquareApi.venuesSearch(ll, null, null, null, null, null, null, null, null, null, null);
if (result.getMeta().getCode() == 200) { // if query was ok we can finally we do something with the data for (CompactVenue venue : result.getResult().getVenues()) { // TODO: Do something we the data println(venue.getName()); } } else { // TODO: Proper error handling println("Error occured: "); println(" code: " + result.getMeta().getCode()); println(" type: " + result.getMeta().getErrorType()); println(" detail: " + result.getMeta().getErrorDetail()); } } catch(FoursquareApiException e) { println(e); }
Deep in my archives i've found a sketch i made a while ago which tries to load raw movie data with gsvideo. As for the sketch, i can display movie-data in the top-half of the window and it is somewhat intermixed (both the location and colorchannels) which results in a nice effect but not really what i'm after. In short i'd basically like to know how to properly display the movie in the window, after that i can probably manage the byte-rearranging/glitching.
Help will always be greatly appreciated, thanks!
FRid
(tested with an .avi and (3) .mov-files)
import codeanticode.gsvideo.*; GSPlayer video;
PImage img; PrintWriter output;
void setup() { size(640, 480); video = new GSPlayer(this, "Tron1.avi", GSVideo.RAW); video.loop(); video.volume(0);
I'm destroying jpegs but i'm running into trouble when i try to visualize each step, Basically it's
- Load in the jpeg
- Display it with image
- Load in the bytes
- Rearrange the bytes
- Save the bytes to jpeg
- And start over again
I've basically tried porting the OF-example "imagecompressionexample" to processing. In OF it's running inside "update" so you can see the jpeg gradually deterioriating (if you press "g").
In processing nothing happens, no artefacts or anything. The image just stays the same. I presume it has something to do with the file-i/o because it is running fine if it's run without looping file-i/o.
Any help on this is greatly appreciated!
FRid
Btw. inside the OF-example there is this (commented) function;
// using the OR operator |, if the bit isn't already on this will turn it on
buffer[whichByte] |= bitMask;
What does this do? Use "whichByte" OR "bitMask" as index for buffer? Then on what is this choice depending on?
import java.io.*;
byte[] b; PImage img;
void setup() { size(700,700); frameRate(1 );
}
void draw() {
img = loadImage("mod.jpg"); image(img, 0, 0);
b = loadBytes("mod.jpg");
int whichByte = int(random(b.length*0.1, b.length)); int whichBit = int(random(0,8)); byte bit = byte(1 << whichBit); b[whichByte] = bit;
I've been experimenting with glgraphics because i need to have the models run on the gpu for obvious (speed) reasons but i am quite unsuccesful in my atempts to do so. In the attached code i have a glModel which is made up of class punt(), and is the point you see on the screen but if i try to add more than 1 there's is an "arrayindexoutofboundsexp: 4". Weird thing is, it's always four even when the array is not larger than 2. Why i don't know...
In the code you'll also see i add the point to glmodel inside the class, is it the "correct" way to instantiate the point like that? Create a glModel for every point seems too much, is there a way too create all the points seperate and bind them to a single glModel? Seems much more efficient. Also another question regarding the ammount of points. Can you change this in the draw function or is this a static ammount set only in the setup?
For example what if i have glModel test which is made up of class punt() which holds another class which itself is creating points, will they be automatically added to the glmodel too?
I hope i've been succesfull in explaining the questions. If not i can always try to elaborate :) Thanks for reading/helping (i hope ofcourse),
FRid
Almost forgot; why isn't the color working properly? Should be white right?
Title sums it up really. I'm using toxilibs to draw a voronoi diagram and basically i want to use a texture on the triangle2D created by the voronoi diagram but trying to do so results in an error -
- texture() not available with this renderer.
This was without any renderer specified so i've tried P2D, JAVA2D, P3D and OPENGL but all without any luck. My guess is this is because of the toxilibssupport-library somehow so i've tried to bypass that by just getting the vectors from the triangle2D and use those on new vertices (processing native) but that didn't work either. I then tried searching the docs for any mention of textures and triangle2D but again without luck. By now i've ran out of clues or workarounds.
ToxiclibsSupport gfx; Voronoi voronoi = new Voronoi();
PImage img;
int num = 25; Vec2D[] punt = new Vec2D[num]; Vec2D[] direction = new Vec2D[num]; Vec2D[] loc = new Vec2D[num];
void setup() { size(600, 600);
gfx = new ToxiclibsSupport(this); img = loadImage("5.jpg");
for (int i = 0; i < num; i++) { direction[i] = new Vec2D(random(0.5,1.5),random(0.5,1.5)); loc[i] = new Vec2D(random(0,width),random(0,height)); punt[i] = new Vec2D(loc[i]); voronoi.addPoint(punt[i]); }
for (int i = 0; i < num; i++) { loc[i].x = (loc[i].x+direction[i].x) % width; loc[i].y = (loc[i].y+direction[i].y) % height; punt[i] = new Vec2D(loc[i]); voronoi.addPoint(punt[i]); }
fill(0, 0, 255, 100); noStroke(); for (Vec2D c : voronoi.getSites()) { ellipse(c.x, c.y, 5, 5); }
stroke(0, 0, 255, 50); beginShape(TRIANGLES); //texture(img); //Uncommenting this gives me "texture() is not available with this renderer" for (Triangle2D t : voronoi.getTriangles()) {
I'm trying to get a better understanding of the toxilibs and physics in particular but it's not really working out. Taking small steps so i started with 2d first. After modifying the attract2d-example i'm trying to add a barrier when they fall down so i need to implement a (circular) particleconstraint on the particles and this is where things go wrong. I've tried (the commented lines) but i'ts saying it cannot find the class? So my guess is i'm totally wrong here and before i lose all hope i turn to you...
And some small things-
This "for"-structure, is this processing-native or only available in toxi? I assume it says increase verletparticle p untill it is equal to physics.particles?
for (VerletParticle2D p : physics.particles) {
ellipse(p.x, p.y, 5, 5);
point(p.x,p.y);
Anyway sorry for the long post but i'd like to understand this (amazing) library so i really appreciate all the help and i hope i've been clear enough in explaining the issues. Thanks
FRid
And on a sidenote: are there any good tutorials regarding the toxilibs (physics in particular)? The javadocs are not really working for me, i see all the very nice features available but i have no knowledge of how to implement them.
//CirculrConstraint myConstraint; // This gives me "cannot find class or type named "CircularConstraint"" //ParticleConstraint2d myConstraint; // This gives me "cannot find class or type named "ParticleConstraint2d""
Sorry for the wacky title but i couldn't think of a better one. First time poster so go easy :)
From the tutorials (
http://processing.org/learning/pixels/) i understand how to get the location of a pixel using x/y-coordinates but what to do when you have unequal dimensions?
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
int loc = x + y * width;
}