Permalink
Browse files

changed to simpler draw routine for updating position and velocity pi…

…ngPongBuffers, also fixes a strange bug where the last particle overlaps position with another causing one extra bright particle
  • Loading branch information...
1 parent 306f8bc commit 81d71860f6b60f368afcdd63c3b327973b631db3 @timscaffidi timscaffidi committed Nov 2, 2012
Showing with 4 additions and 16 deletions.
  1. +4 −16 examples/gl/GPUparticleSystemExample/src/testApp.cpp
@@ -93,14 +93,8 @@ void testApp::update(){
updateVel.setUniform2f("screen", (float)width, (float)height);
updateVel.setUniform1f("timestep", (float)timeStep);
- // Just a frame to put pixels on
- ofSetColor(255,255,255,255);
- glBegin(GL_QUADS);
- glTexCoord2f(0, 0); glVertex3f(0, 0, 0);
- glTexCoord2f(textureRes, 0); glVertex3f(textureRes, 0, 0);
- glTexCoord2f(textureRes, textureRes); glVertex3f( textureRes, textureRes, 0);
- glTexCoord2f(0, textureRes); glVertex3f(0, textureRes, 0);
- glEnd();
+ // draw the source velocity texture to be updated
+ velPingPong.src->draw(0, 0);
updateVel.end();
velPingPong.dst->end();
@@ -119,14 +113,8 @@ void testApp::update(){
updatePos.setUniformTexture("velData", velPingPong.src->getTextureReference(), 1); // Velocity
updatePos.setUniform1f("timestep",(float) timeStep );
- // Just a frame to put pixels on
- ofSetColor(255,255,255,255);
- glBegin(GL_QUADS);
- glTexCoord2f(0, 0); glVertex3f(0, 0, 0);
- glTexCoord2f(textureRes, 0); glVertex3f(textureRes, 0, 0);
- glTexCoord2f(textureRes, textureRes); glVertex3f( textureRes, textureRes, 0);
- glTexCoord2f(0, textureRes); glVertex3f(0, textureRes, 0);
- glEnd();
+ // draw the source position texture to be updated
+ posPingPong.src->draw(0, 0);
updatePos.end();
posPingPong.dst->end();

0 comments on commit 81d7186

Please sign in to comment.