Forums > Java

problem with opengl screentoworld java method

January 13, 2011 | 9:18 am

I’m quite new to java and mxj programming and y try to make a simple opengl GUI
drawing linesegments with mouse. That’s why i have to translate screencoordinates of an array of segments in opengl coordinates, but when i try to use the screentoworld method like that:

Atom[] a = render.send("screentoworld", new float[] {(float)this.a.xe, (float)this.a.ye, 0.0f});
float worldpoint_a[] = new float[] { a[0].toFloat(),
a[1].toFloat(), a[2].toFloat() };
outlet(0, worldpoint_a); //for debugging

i can’t recover anything but 0. 0. 0. from outlet 0.

My java class is constructed like the exemple cycling 74 jitgldock and a function bang():

public void bang() {

for (int i = 0; i < Drawn.size() - 1; i++) {
sketch.send("reset");
Segment tempor = (Segment) Drawn.get(i);
tempor.Display();
}
render.send("erase");
render.send("drawclients");
render.send("swap");

}

and i make the coordinates translation in the Segment.Display() method.

Is there something i do wrong, or special render (jit.gl.render) attributes to set up or a very strict way to do this in order to make the screentoworld translation efficient?


Viewing 1 post (of 1 total)