From 363243dc6398549137b0f98aff3c20f2bedaff32 Mon Sep 17 00:00:00 2001 From: pgovyadi Date: Mon, 12 Sep 2016 17:12:11 -0500 Subject: [PATCH] More comments --- stim/gl/gl_spider.h | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/stim/gl/gl_spider.h b/stim/gl/gl_spider.h index 153757e..7c5d5d5 100644 --- a/stim/gl/gl_spider.h +++ b/stim/gl/gl_spider.h @@ -1560,31 +1560,30 @@ class gl_spider // : public virtual gl_texture gpuStartTimer(); #endif -// float s = 3.0; - GLuint selectBuf[2048]; - GLint hits; - glSelectBuffer(2048, selectBuf); - glDisable(GL_CULL_FACE); - (void) glRenderMode(GL_SELECT); + GLuint selectBuf[2048]; ///size of the selection buffer in bytes. + GLint hits; ///hit fibers + glSelectBuffer(2048, selectBuf); ///bind the selection mode to the selection buffer. + glDisable(GL_CULL_FACE); ///Disable cullFace + (void) glRenderMode(GL_SELECT); ///initialize GL select mode. //Init Names stack - glInitNames(); - glPushName(1); + glInitNames(); ///Initialize the naming array. + glPushName(1); ///Push a single name to the stack. CHECK_OPENGL_ERROR //What would that vessel see in front of it. - camSel.setPosition(loc); - camSel.setFocalDistance(mag/stepsize); + camSel.setPosition(loc); ///Set the viewing camera + camSel.setFocalDistance(mag/stepsize); ///Set how far the fiber looks forward. camSel.LookAt((loc[0]+dir[0]*mag/stepsize), (loc[1]+dir[1]*mag/stepsize), - (loc[2]+dir[2]*mag/stepsize)); - ps = camSel.getPosition(); + (loc[2]+dir[2]*mag/stepsize)); ///Set the look direction + ps = camSel.getPosition(); ///get all the necessary rotation variable for openGL ups = camSel.getUp(); ds = camSel.getLookAt(); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); + glMatrixMode(GL_PROJECTION); ///Push the projection matrix. + glPushMatrix(); ///Reset the current projection matrix glLoadIdentity(); - glOrtho(-mag/stepsize/2.0, mag/stepsize/2.0, -mag/stepsize/2.0, mag/stepsize/2.0, 0.0, mag/stepsize/2.0); + glOrtho(-mag/stepsize/2.0, mag/stepsize/2.0, -mag/stepsize/2.0, mag/stepsize/2.0, 0.0, mag/stepsize/2.0); ///Finalize the look paramenters glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); @@ -1593,36 +1592,36 @@ class gl_spider // : public virtual gl_texture gluLookAt(ps[0], ps[1], ps[2], ds[0], ds[1], ds[2], ups[0], ups[1], ups[2]); - - sk.Render(); + ///Set the look at distance + sk.Render(); ///Render the network // nt.Render(); CHECK_OPENGL_ERROR - glLoadName((int) sk.numL()); + glLoadName((int) sk.numL()); ///Load all the names // glLoadName(nt.sizeE()); - sk.RenderLine(cL); + sk.RenderLine(cL); ///Render the current line. // nt.RenderLine(cL); // glPopName(); - glFlush(); + glFlush(); ///Flush the buffer glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); CHECK_OPENGL_ERROR - glPopMatrix(); + glPopMatrix(); ///clear the vis matrices and pop the matrix // glEnable(GL_CULL_FACE); - hits = glRenderMode(GL_RENDER); - int found_hits = processHits(hits, selectBuf); + hits = glRenderMode(GL_RENDER); ///Check for hits. + int found_hits = processHits(hits, selectBuf); ///Process the hits. #ifdef TIMING hit_time += gpuStopTimer(); #endif - return found_hits; + return found_hits; ///return whether we hit something or not. } //Given a size of the array (hits) and the memory holding it (buffer) @@ -1630,7 +1629,7 @@ class gl_spider // : public virtual gl_texture int processHits(GLint hits, GLuint buffer[]) { - GLuint *ptr; + GLuint *ptr; ///pointer to the detection buffer ptr = (GLuint *) buffer; ptr++; ptr++; //Skip the minimum depth value. -- libgit2 0.21.4