Friday 15 July 2011

Attempted improvement

Have made an attempt to improve the program by using a simple hard-coded texture generator for the particles instead of relying on an outside texture file. somthing like this one Particle Sytems Rendered as OpenGL Points .

void particles::makeFloorTexture(void)
{

     char circles[17][17]= {
  "xxxxxxxxxxxxxxxx",
  "xxxxxxxxxxxxxxxx",
  "xxxxxxxxxxxxxxxx",
  "xxxx....xxxxxxxx",
  "xxx......xxxxxxx",
  "xxx......xxxxxxx",
  "xxx......xxxxxxx",
  "xxx......xxxxxxx",
  "xxxx....xxxxxxxx",
  "xxxxxxxxxxxxxxxx",
  "xxxxxxxxxxxxxxxx",
  "xxxxxxxxxxxxxxxx",
  "xxxxxxxxxxxxxxxx",
  "xxxxxxxxxxxxxxxx",
  "xxxxxxxxxxxxxxxx",
  "xxxxxxxxxxxxxxxx",
     };

  //GLubyte
   //floorTexture[16][16][3];
  GLubyte *loc;
  int s, t;

  /* Setup RGB image for the texture. */
  loc = (GLubyte*) floorTexture;
  for (t = 0; t < 16; t++) {
    for (s = 0; s < 16; s++) {
      if (circles[t][s] == 'x') {
        /* Nice blue. */
        loc[0] = 0x0;//0x1f;
        loc[1] = 0x0;//0x1f;
        loc[2] = 0x0;//0x8f;
      } else {
        /* Light gray. */
        loc[0] = 0xca;
        loc[1] = 0xca;
        loc[2] = 0xca;
      }
      loc += 3;
    }
  }




result not good

No comments:

Post a Comment