Hi
Im rendering a pointcloud coming from simpleopenni library. I create an arraylist of points using toxi Vec3D
And to render the arraylist, i create a GLModel
points = new GLModel(this, maxPuntos, POINTS, GLModel.STREAM);
I want to know how can i improve my render settings to get a better output (now seeems like pixelated and make a extrange effect like "moire").
But when i render the model, it looks like hard edges arround points.
For example i tried to set an smooth to render the points, but i dont see any difference
gl.glEnable(GL.GL_POINT_SMOOTH);
My goal is to get something like the house of cards pointcloud or at least i want to recognize myself in the pointcloud.
I know that this is generic cuestion, but i have spend a week trying to understand how can i improve that....but i dont find a way. Where can i find docs about that??? And i would be very happy if someone says me what im doing wrong.
Puntos is a class where i track the pointcloud
Im rendering a pointcloud coming from simpleopenni library. I create an arraylist of points using toxi Vec3D
And to render the arraylist, i create a GLModel
points = new GLModel(this, maxPuntos, POINTS, GLModel.STREAM);
I want to know how can i improve my render settings to get a better output (now seeems like pixelated and make a extrange effect like "moire").
But when i render the model, it looks like hard edges arround points.
For example i tried to set an smooth to render the points, but i dont see any difference
gl.glEnable(GL.GL_POINT_SMOOTH);
My goal is to get something like the house of cards pointcloud or at least i want to recognize myself in the pointcloud.
I know that this is generic cuestion, but i have spend a week trying to understand how can i improve that....but i dont find a way. Where can i find docs about that??? And i would be very happy if someone says me what im doing wrong.
Puntos is a class where i track the pointcloud
- import SimpleOpenNI.*;
import toxi.geom.*;
import javax.media.opengl.*;
import codeanticode.glgraphics.*;
import remixlab.proscene.*;
Puntos pts;
int cantos = 0;
int maxPuntos = 100000;
ArrayList<Vec3D> puntosUsuarios;
GLModel points;
Scene scene;
KeyFrameInterpolator kfi;
void setup() {
size(1280, 768, GLConstants.GLGRAPHICS);
hint(ENABLE_OPENGL_2X_SMOOTH);
pts = new Puntos(this);
puntosUsuarios = new ArrayList();
ponPuntos();
//smooth();
}
void draw() {
background(0);
rotateX(radians(180));
pts.actualiza();
cantos = pts.cuantosUsers();
if (cantos>0) {
puntosUsuarios = pts.dimePuntosUser(cantos);
}
// image(pts.todoRGB(), 160, 0, 160, 120);
///// TRABAJA CON LOS PUNTOS
GLGraphics renderer = (GLGraphics)g;
renderer.beginGL();
translate(1280/2,-300,-1000);
GL gl = renderer.gl;
if (cantos>0) {
points.beginUpdateVertices();
for (int p = 0;p<maxPuntos;p++)
{
if (p<puntosUsuarios.size())
{
Vec3D temp = (Vec3D)puntosUsuarios.get(p);
points.updateVertex(p, temp.x, temp.y, temp.z);
}
else {
points.updateVertex(p, 0, 0, 0);
}
}
points.endUpdateVertices();
points.beginUpdateColors();
for (int i = 0; i < maxPuntos; i++)
{
if (i<puntosUsuarios.size())
{
points.updateColor(i,255,255,255,255);
}else{
points.updateColor(i, 255, 0, 0, 255);
}
}
points.endUpdateColors();
}
gl.glDepthMask(false);
points.render();
gl.glDepthMask(true);
renderer.endGL();
frame.setTitle(str(round(frameRate))+"fps");
}
void ponPuntos()
{
points = new GLModel(this, maxPuntos, POINTS, GLModel.STREAM);
points.initColors();
points.setPointSize(3);
/////////////////////////////
// Update (load) Vertex data
/////////////////////////////
points.beginUpdateVertices();
for (int i = 0; i < maxPuntos; i++)
{
points.updateVertex(i, random(width), random(height), random(width));
}
points.endUpdateVertices();
/////////////////////////////
// Update Vertex Colour
/////////////////////////////
points.beginUpdateColors();
for (int i = 0; i < maxPuntos; i++)
{
points.updateColor(i, 255, 255, 255, 255);
}
points.endUpdateColors();
}
void mousePressed(){
saveFrame("pantallazo.png");
}
1