Skip to content
Snippets Groups Projects
Select Git revision
  • ef83848c5821f68f049929795df615f2c57e8e22
  • master default protected
  • hierarchical-basis
  • revert-ef4a3a4f
  • patch_releases_4_14
  • overlaps_tags_and_distributed_export
  • overlaps_tags_and_distributed_export_rebased
  • relaying
  • alphashapes
  • steplayer
  • bl
  • pluginMeshQuality
  • fixBugsAmaury
  • new_export_boris
  • oras_vs_osm
  • reassign_partitions
  • distributed_fwi
  • rename-classes
  • fix/fortran-api-example-t4
  • robust_partitions
  • reducing_files
  • gmsh_4_14_0
  • gmsh_4_13_1
  • gmsh_4_13_0
  • gmsh_4_12_2
  • gmsh_4_12_1
  • gmsh_4_12_0
  • gmsh_4_11_1
  • gmsh_4_11_0
  • gmsh_4_10_5
  • gmsh_4_10_4
  • gmsh_4_10_3
  • gmsh_4_10_2
  • gmsh_4_10_1
  • gmsh_4_10_0
  • gmsh_4_9_5
  • gmsh_4_9_4
  • gmsh_4_9_3
  • gmsh_4_9_2
  • gmsh_4_9_1
  • gmsh_4_9_0
41 results

Chain.h

Blame
  • gl2ppm.cpp 1001 B
    
    #include "Gmsh.h"
    #include "GmshUI.h"
    
    void create_ppm(FILE *outfile, int width, int height){
      unsigned char *red, *green, *blue;
      register int x, y;
      unsigned char   r, g, b;
    
      red = (unsigned char *)malloc(height*width*sizeof(unsigned char));
      green = (unsigned char *)malloc(height*width*sizeof(unsigned char));
      blue = (unsigned char *)malloc(height*width*sizeof(unsigned char));
    
      glReadPixels(0,0,width,height,GL_RED,GL_UNSIGNED_BYTE,red);
      glReadPixels(0,0,width,height,GL_GREEN,GL_UNSIGNED_BYTE,green);
      glReadPixels(0,0,width,height,GL_BLUE,GL_UNSIGNED_BYTE,blue);
    
      fprintf(outfile, "P6\n");
      fprintf(outfile, "%d %d\n", width, height);
      fprintf(outfile, "%d\n", 255);
    
      for ( y = height-1; y >= 0; y-- ){
        for ( x = 0; x < width; x++ ){
          r = red[y*width+x];
          g = green[y*width+x];
          b = blue[y*width+x];
          fwrite(&r, 1, 1, outfile);
          fwrite(&g, 1, 1, outfile);
          fwrite(&b, 1, 1, outfile);
        }
      }
    
      Free(red);
      Free(green);
      Free(blue);
    }