Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /examples/vr-demo/main.c
ViewVC logotype

Diff of /examples/vr-demo/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2061, Tue Oct 30 21:55:10 2012 UTC revision 2062, Wed Oct 31 17:59:30 2012 UTC
# Line 69  Line 69 
69      glDisable(GL_CULL_FACE);      glDisable(GL_CULL_FACE);
70    
71    // Draw image    // Draw image
72      glEnable (GL_TEXTURE_2D);      glDrawPixels (Width, Height, GL_RGBA, GL_FLOAT, img->data);
     glActiveTexture (GL_TEXTURE0);  
     glBindTexture (GL_TEXTURE_2D, ImageTexture);  
     glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);  
     glBegin (GL_QUADS);  
         glColor3f (0.1, 0.1, 0.1);  
         glTexCoord2f (0.0, 0.0);  
         glVertex2f (WrldOrigin[0], WrldOrigin[1]);  
         glTexCoord2f (1.0, 0.0);  
         glVertex2f (WrldOrigin[0]+WrldDim[0], WrldOrigin[1]);  
         glTexCoord2f (1.0, 1.0);  
         glVertex2f (WrldOrigin[0]+WrldDim[0], WrldOrigin[1]+WrldDim[1]);  
         glTexCoord2f (0.0, 1.0);  
         glVertex2f (WrldOrigin[0], WrldOrigin[1]+WrldDim[1]);  
     glEnd();  
     glDisable (GL_TEXTURE_2D);  
73      CheckError ();      CheckError ();
74    
   // Draw current particle state  
     glEnable (GL_POINT_SMOOTH);  
 //    glPointSize (2.0);  
 // it would be more efficient to do this as a single buffer, but it is fast enough  
     float *p = (float *)(positions->data);  
     unsigned int nPoints = positions->axis[1].size;  
     glBegin (GL_POINTS);  
       // first draw some points at known locations for testing purposes  
 //      glColor3f (1.0, 0.0, 0.0);  
 //      glVertex2f (WRLD_MIN_X, WRLD_MIN_Y);  
 //      glVertex2f (WRLD_MAX_X, WRLD_MIN_Y);  
 //      glVertex2f (WRLD_MAX_X, WRLD_MAX_Y);  
 //      glVertex2f (WRLD_MIN_X, WRLD_MAX_Y);  
         glColor3f (0.2, 1.0, 0.2);  
         for (int i = 0;  i < nPoints;  i++) {  
             glVertex2fv(p);  
             p += 2;  
         }  
     glEnd ();  
   
   // Draw tweak bars  
     TwDraw();  
   
75    // Present frame buffer    // Present frame buffer
76      glfwSwapBuffers();      glfwSwapBuffers();
77  }  }
# Line 243  Line 205 
205      Draw (nData);      Draw (nData);
206    
207    // Main loop (repeated while window is not closed and [ESC] is not pressed)    // Main loop (repeated while window is not closed and [ESC] is not pressed)
208        NeedsRecompute = true;
209      while (glfwGetWindowParam(GLFW_OPENED) && !glfwGetKey(GLFW_KEY_ESC)) {      while (glfwGetWindowParam(GLFW_OPENED) && !glfwGetKey(GLFW_KEY_ESC)) {
210          if (NeedsRecompute) {          if (NeedsRecompute) {
211            // recompute            // recompute

Legend:
Removed from v.2061  
changed lines
  Added in v.2062

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0