I would like to resize my sketch window dynamically using an osc message. I had it working fine until I added shaders and an opengl off screen buffer. Here is my code:
void winSize(int w, int h) {
frame.setResizable(true);
frame.setSize(w, h);
//OPENGL STUFF
destTex.width = w;
destTex.height = h;
bloomMask.width = w;
bloomMask.height = h;
tex0.width = w;
tex0.height = h;
tex2.width = w/2;
tex2.height = h/2;
tmp2.width = w/2;
tmp2.height = h/2;
tex4.width = w/4;
tex4.height = h/4;
tmp4.width = w/4;
tmp4.height = h/4;
tex8.width = w/8;
tex8.height = h/8;
tmp8.width = w/8;
tmp8.height = h/8;
tex16.width = w/16;
tex16.height = h/16;
tmp16.width = w/16;
tmp16.height = h/16;
pgl.setSize(w, h);
offscreen.setSize(w, h);
pgl = (GLGraphics) g;
gl = offscreen.gl;
canvasWG = w;
canvasHG = h;
}
I get two different errors, sometimes one and sometimes the other, not sure why this is either:
1)
Frame buffer is incomplete (GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT)
2)
Exception in thread "Animation Thread" javax.media.opengl.GLException: Attempt to make context current on thread Thread[Animation Thread,5,main] which is already current on thread Thread[Thread-2,5,main]
at com.sun.opengl.impl.GLContextLock.lock(GLContextLock.java:68)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:131)
at processing.opengl.PGraphicsOpenGL.detainContext(PGraphicsOpenGL.java:230)
at processing.opengl.PGraphicsOpenGL.beginDraw(PGraphicsOpenGL.java:275)
at codeanticode.glgraphics.GLGraphics.beginDraw(GLGraphics.java:208)
at processing.core.PApplet.handleDraw(PApplet.java:1573)
Something I've been wanting to do for a while is to be able to dynamically populate an ArrayList with instances of different classes and then use these class instances. For example, here I create two different classes. Each class has a method named drawClass(). I hope to be able to pull instances out of an ArrayList, no matter what the class, and run drawClass(), as long as a method with that name exists in the class:
Another related question is, is there a method in Processing/Java where you can get a list of all of the classes/class methods/class variables within a sketch? I would guess oscPlug perhaps engages something like this to automatically pass on osc commands to methods within classes.
Hello list,
I'm still at it with the glowing line. My problem now is that to achieve the 'glow' effect, the code I found must do a get on a PGraphics render context to create a PImage then perform some effects and then render. The problem is that at the .get stage the created PImage's background is opaque and I cannot seem to find a way to make it transparent.
Hi list,
I've distilled the harukit example to just the glowing line for a lightsaber effect. My question is, is there a way to use it like the line object, ie glowingLine(0, 0, 200, 200)?
Thanks,
Justin
public int lmode = 2;
public int by = 8; //line thickness
PGraphics pg;
public color [] A;
float rr, gg, bb, dis;
int gain = 5;
float[] cc = new float[3];
for(int x=0; x<pg.width; x++) {
// kx+=0.5;
int pos = y*pg.width + x;
// int ka =int(ky)*pg.width+int(kx);
color col = pg.pixels[pos];
// color col =A[pos];
rr = col >> 16 & 0xff;
gg = col >> 8 & 0xff;
bb = col & 0xff;