We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProcessing DevelopmentLibraries,  Tool Development › New Library: SuperPoint & SuperTri
Pages: 1 2 
New Library: SuperPoint & SuperTri (Read 9176 times)
New Library: SuperPoint & SuperTri
Jul 1st, 2008, 11:57pm
 
I've wrapped my OpenGL Vertex Buffer points code into a library to make it easier to use.

http://www.hardcorepawn.com/SuperPoint/ contains the library, JavaDoc and a couple of examples.

If people could test this for me I'd be very grateful.

Edit I think this might require a recent version of processing which is built with java 1.5...

Edit 2nd July: Now with SuperTri powers! Speedy triangles for all your needs. Only supports coloured triangles currently, not textured.
Re: New Library: SuperPoint
Reply #1 - Jul 2nd, 2008, 7:02am
 
D'oh! Aaron Koblin and I were working on something similar!

Yours is pretty clean. Any way to integrate this with an obj loader type of thing? That way we can import models... Smiley
Re: New Library: SuperPoint
Reply #2 - Jul 2nd, 2008, 8:42am
 
Haha... yes you did beat us to it!

Definitely a great thing for Processing. Yours is cleaner and I like it.

The only thing ours was going to have which is really useful is a VBO version which accepts not only points and colors, but also normals for TRIANGLE rendering in addition to POINTS.

I've got a little something up my sleeve that uses my library coming out in a week. If I have time I'll switch it your lib tho.

Cool stuff, love to see more! Great to have Processing harnessing some of the really powerful OpenGL tools!
Re: New Library: SuperPoint
Reply #3 - Jul 2nd, 2008, 11:25am
 
I've added a SuperTri class to a test version, but I'm not getting the performance I'd expect. I'm going to try a slightly different way of building the data internally to see if I can speed it up.

By low performance I mean I'm "only" getting ~600,000 tri/sec out of it, where I'd expect a few million.

Edit a bit quicker now. Also it seems to be quicker drawing the same 5000 tri object 5 times, than one 25,000 tri object. Which better represents real usage I think.
Re: New Library: SuperPoint & SuperTri
Reply #4 - Jul 2nd, 2008, 8:21pm
 
Yes.

I used the same method for the particles on the New York Talk Exchange project. I just loaded a triangulated sphere into a VBO and drew it hundreds of times. Drawing that many spheres wouldn't have been possible without help, display lists were ok, but w/ VBOs huge improvement.
Re: New Library: SuperPoint & SuperTri
Reply #5 - Jul 7th, 2008, 9:16am
 
It seems there's some kind of bug when I try drawing one triangle.  I have to call addTri three times to get a triangle to show up.

I've been over your source several times and I cant find any problems.  Am I doing something wrong?


 t.addPoint(500, 0, 0, 1, 0, 0, 1,0,0,.5);
 t.addPoint(0, 500, 0, 1, 0, 0, 1,0,0,.5);
 t.addPoint(0, 0, 500, 1, 0, 0, 1,0,0,.5);


 t.addTri( 0, 1, 2 );
 t.addTri( 0, 1, 2 ); // <-- Extra needed
 t.addTri( 0, 1, 2 ); // <-- Extra needed


Re: New Library: SuperPoint & SuperTri
Reply #6 - Jul 7th, 2008, 3:08pm
 
Looks like I misunderstood one of the OpenGL commands I was using, and I needed to multiply a number by 3. I've updated the library, and now it will draw all triangles.
Re: New Library: SuperPoint & SuperTri
Reply #7 - Jul 7th, 2008, 7:01pm
 
It still doesn't seem to work.  Looking for the change I notice that glNormalPointer is only passed 3 values -- could that be part of the problem?

gl.glVertexPointer(3, 5126, 0, v);
gl.glColorPointer(4, 5126, 0, c);
gl.glNormalPointer(5126, 0, n);
Re: New Library: SuperPoint & SuperTri
Reply #8 - Jul 7th, 2008, 7:05pm
 
The problem line I fixed was:
gl.glDrawArrays(GL.GL_TRIANGLES,0,numTris);
which should have been
gl.glDrawArrays(GL.GL_TRIANGLES,0,numTris*3);

glNormalPointer only takes 3 parameters, as a normal is always 3 values, whereas colour and vertex can be various number of elements per vertex.
Re: New Library: SuperPoint & SuperTri
Reply #9 - Jul 7th, 2008, 7:15pm
 
Yeah, it works great with the change.  Thanks for the library!
Re: New Library: SuperPoint & SuperTri
Reply #10 - Jul 16th, 2008, 10:44pm
 
I found the time to make an example that tests super tri:

http://users.design.ucla.edu/~ptierney/kaleidoscope/examples/super_tri/Archive.zip

Mouse looks around, arrows navigate.
Re: New Library: SuperPoint & SuperTri
Reply #11 - Feb 25th, 2009, 8:53pm
 
"You're a John G" -- Memento

Hey there,

I was poking around elsewhere in the "Discourse" section and found a mention you made to your SuperPoint library, so came on over to check it out.

I made my own demo with some phat pointy points...

http://subpixels.com/blog/2009/02/spxlspikyball-v10.html

It also has some minimal VJ controls, so put on some music for maximum enjoyment (note: not audio reactive - you need to control it).

-spxl
Re: New Library: SuperPoint & SuperTri
Reply #12 - Mar 26th, 2009, 2:24pm
 
Any plans for SuperQuad?  As well as textures. Smiley
Re: New Library: SuperPoint & SuperTri
Reply #13 - Mar 26th, 2009, 4:37pm
 
The latest objLoader library should do all the VBO stuff for quads and textures and the like. It doesn't let you create shapes programatically, but will draw things fast I think.
Re: New Library: SuperPoint & SuperTri
Reply #14 - Mar 26th, 2009, 10:33am
 
addTri doesn't accept 4 arguments, unless your talking about creating two triangles back to back.  What I'm trying to do is use VBO for my 3d points.  Create squares around each point, then apply a texture to it.  So SuperPoint may apply but I'm not sure how to do it.  I'm also not sure how to apply a texture to a VBO.  Normally I would use a glTexCoord4f(x, y, z, w );

This is what I'm currently using for the square.

Code:

pgl.beginGL();
squareList = gl.glGenLists(1);
gl.glNewList(squareList, GL.GL_COMPILE);
gl.glVertex2f( -1.0f, -1.0f );
gl.glVertex2f( +1.0f, -1.0f );
gl.glVertex2f( +1.0f, +1.0f );
gl.glVertex2f( -1.0f, +1.0f );
gl.glEndList();
pgl.endGL();
Pages: 1 2