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.
Page Index Toggle Pages: 1
VBO & Point Sprites (Read 1259 times)
VBO & Point Sprites
Mar 27th, 2009, 8:07am
 
I'm trying to turn this display list into a VBO, and I'd like to turn the QUAD into a Point Sprite.  Having trouble making it happen.  Any help would be appreciated.  Thanks

Code:

gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE);
...
int nodeList;
void initNodes(){
 nodeList = gl.glGenLists(1);
 gl.glNewList(nodeList, GL.GL_COMPILE);
 textureImg.bind();
 textureImg.enable();
 noStroke();
 shader.startShader();
 gl.glBegin(gl.GL_QUADS);
 gl.glColor3f(1, 1, 1);
 for (int i = 0; i < Nodes.length; i++) {
   gl.glTexCoord4f(Nodes[i].x, Nodes[i].y, Nodes[i].z, Nodes[i].w );
   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.glEnd();
shader.endShader();
textureImg.disable();
gl.glEndList();
}


I've tried this to get sprites working with no luck.  I'll see if I can dig up my VBO tests.  Sad

Code:

gl.glEnable(GL.GL_TEXTURE_2D);
gl.glBindTexture(GL.GL_TEXTURE_2D,mapPointTexture.getTextureID());
gl.glEnable(GL.GL_POINT_SPRITE);
gl.glTexEnvi(GL.GL_POINT_SPRITE, GL.GL_COORD_REPLACE, GL.GL_TRUE);
gl.glPointSize(15);
gl.glBegin(GL.GL_POINTS);
 for (int i = 0; i < Nodes.length; i++) {
   gl.glTexCoord3f(Nodes[i].x, Nodes[i].y, Nodes[i].z);
 }
gl.glEnd();
gl.glDisable(GL.GL_POINT_SPRITE);
gl.glDisable(GL.GL_TEXTURE_2D);
Page Index Toggle Pages: 1