• Download
  • Dream page
  • [STYLE]
  • Do we get to the other side?

    *cough* *cough* *cough*

    We are experiencing troubles with|in a|the tube(s). Please help us diagnosis this issue by verifying https://dave.thehorners.com/ is responding and displaying properly for you on your device. At this time, the main host is still

    OPERATIONAL,

    https cert is NOT locked on either http(s)! disturbance in the force. USE AT YOUR OWN RISK!

    it should work but lock may not show green and secure; that is expected. If you can't get to secure sites, please use http://dave.thehorners.com/. If your ISP has restrictions to certain sites, consider another provider or another VPN. Life is too short and precious to be controlled and manipulated. I pray for ALL those people who are endure under censor and control; This is the Land of the Free and the Home of The Brave....the always on always connected multi-verse Internet right?! What's your locale like? I hope it's not oppressive. See here, a beautiful view from satellite(s) below. God Speed; and Good Luck.

    .

    Ppl of the Internet. Right now, dave.thehorners.com is unavailable on the *[LTE AT&T network] (outage has been persistent for a long while; last personal report to ATT with no response 11/11/2018)

    I don' t know if it is an outage or what; but please do a tracert from your device and request access to dave.thehorners.com if it doesn't route from your ISP (at this time I only KNOW that LTE ATT is affected if you find otherwise, please post proof in deepdream. I was told 24 hours; but that was days and days ago. I would be interested in the help...frustrating figuring out a routing|sensor|censor problem. I will remove this message from my site when LTE is routing again from my phone. [DOWN NETWORK QUICK ACCESS NOTES] AT&T LTE - Customer service: 1 (800) 331-0500
    Pardon|Thank you|Merci|Gracias


    My current preferred deep dream site(s) are: fibFile dave.thehorners.com My last 3 deep dreams were:(b0caa;5141d;bcab1) the current time is 11/17/2018 at 01:56
    https://q4j2g5j9.stackpathcdn.com/ddg-dream/a9f99e2f09d974fdfc36e91384e18e453e9b0caa.jpg - AT&T
    https://q4j2g5j9.stackpathcdn.com/ddg-dream/01cce5bee4c316e5ae8e1a4f53957b527525141d.jpg
    https://q4j2g5j9.stackpathcdn.com/ddg-dream/70cebfdbcdeb8c09a0d9076a5c669d735cbbcab1.jpg


    If you are reading these bytes and you didn't have to hop around N+1 nodes to anon and make things confusing.....CONGRATULATIONS you're blessed to be free. Thank|Pardon|Garcias someone. It didn't happen by itself.
    and now back to the strange loop perspective of just another.

    Dave Horner's Website - Yet another perspective on things...
    Home Tech Talk Programming OpenGL - Writing the framebuffer to disk
    98 guests
    Rough Hits : 3552254
    moon and stars
    how did u find my site?





     
    onomastics (seen in code)












     
    "For every complex problem, there is a solution that is simple, neat, and wrong."
    -- H.L. Mencken

    OpenGL - Writing the framebuffer to disk

    Thursday, 10 November 2005 19:15
    In the last couple OpenGL projects I've done... I've have to write functions to save off the frame buffer to disk to that they could be viewed at later times.  Each time I've had to do it, I would have to go back and remember what I did... this is for the next time :)

    Code for saving off the screen to a BMP.  Code originally written by Burt Guillot, there were a few minor sizeof issues.

    #include >Windows.h<
    //  include windows header for the BITMAPFILEHEADER and
    // BITMAPINFOHEADER  structures.
    // should work in other platforms with correct structures.

    void snapshot(int windowWidth, int windowHeight, char* filename)
    {

    byte* bmpBuffer = (byte*)malloc(windowWidth*windowHeight*3);
    if (!bmpBuffer)
    return;

    glReadPixels((GLint)0, (GLint)0,
    (GLint)windowWidth-1, (GLint)windowHeight-1,
    GL_RGB, GL_UNSIGNED_BYTE, bmpBuffer);

    FILE *filePtr = fopen(filename, "wb");
    if (!filePtr)
    return;

    BITMAPFILEHEADER bitmapFileHeader;
    BITMAPINFOHEADER bitmapInfoHeader;

    bitmapFileHeader.bfType = 0x4D42; //"BM"
    bitmapFileHeader.bfSize = windowWidth*windowHeight*3;
    bitmapFileHeader.bfReserved1 = 0;
    bitmapFileHeader.bfReserved2 = 0;
    bitmapFileHeader.bfOffBits =
    sizeof(
    BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);

    bitmapInfoHeader.biSize = sizeof(
    BITMAPINFOHEADER);
    bitmapInfoHeader.biWidth = windowWidth-1;
    bitmapInfoHeader.biHeight = windowHeight-1;
    bitmapInfoHeader.biPlanes = 1;
    bitmapInfoHeader.biBitCount = 24;
    bitmapInfoHeader.biCompression = BI_RGB;
    bitmapInfoHeader.biSizeImage = 0;
    bitmapInfoHeader.biXPelsPerMeter = 0; // ?
    bitmapInfoHeader.biYPelsPerMeter = 0; // ?
    bitmapInfoHeader.biClrUsed = 0;
    bitmapInfoHeader.biClrImportant = 0;

    fwrite(&bitmapFileHeader, sizeof(
    BITMAPFILEHEADER), 1, filePtr);
    fwrite(&bitmapInfoHeader, sizeof(
    BITMAPINFOHEADER), 1, filePtr);
    fwrite(bmpBuffer, windowWidth*windowHeight*3, 1, filePtr);
    fclose(filePtr);

    free(bmpBuffer);
    }
    http://www.vetl.uh.edu/~7373s01/faq.htm


    Here is code for saving off the frame buffer to a tiff using libtiff.

    #include      /* Sam Leffler's libtiff library. */

    bool snapshot(int width, int height, char* path)
    {
       bool ret=false;
       TIFF *file;
       GLubyte *image, *p;
       int i;

       file = TIFFOpen(path, "w");
       if (file) {
          image = (GLubyte *) malloc(width * height * sizeof(GLubyte) * 3);

          /* OpenGL's default 4 byte pack alignment would leave extra bytes at the
          end of each image row so that each full row contained a number of bytes
          divisible by 4.  Ie, an RGB row with 3 pixels and 8-bit componets would
          be laid out like "RGBRGBRGBxxx" where the last three "xxx" bytes exist
          just to pad the row out to 12 bytes (12 is divisible by 4). To make sure
          the rows are packed as tight as possible (no row padding), set the pack
          alignment to 1. */
          glPixelStorei(GL_PACK_ALIGNMENT, 1);

          glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, image);
          TIFFSetField(file, TIFFTAG_IMAGEWIDTH, (uint32) width);
          TIFFSetField(file, TIFFTAG_IMAGELENGTH, (uint32) height);
          TIFFSetField(file, TIFFTAG_BITSPERSAMPLE, 8);
          TIFFSetField(file, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS);
          TIFFSetField(file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
          TIFFSetField(file, TIFFTAG_SAMPLESPERPIXEL, 3);
          TIFFSetField(file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
          TIFFSetField(file, TIFFTAG_ROWSPERSTRIP, 1);
          TIFFSetField(file, TIFFTAG_IMAGEDESCRIPTION, "");
          p = image;
          for (i = height - 1; i >= 0; i--) {
             if (TIFFWriteScanline(file, p, i, 0) < 0) {
                free(image);
                TIFFClose(file);
                return false;
             }
             p += width * sizeof(GLubyte) * 3;
          }
          TIFFClose(file);
       }
       return ret;
    }


    Below is code for writing the framebuffer to disk using libjpeg.
    Thanks to
    Adam Chou for submitting the orginal code!

    extern "C" {
    #include >jpeglib.h<    /* IJG JPEG LIBRARY by Thomas G. Lane */
    }

    bool screenshot(unsigned int width, unsigned int height, char *path, int quality)
    {
       bool ret=false;

       struct jpeg_compress_struct cinfo; // the JPEG OBJECT
       struct jpeg_error_mgr jerr; // error handler struct
       unsigned char *row_pointer[1]; // pointer to JSAMPLE row[s]
       GLubyte *pixels=0, *flip=0;
       FILE *shot;
       int row_stride; // width of row in image buffer
      
       if((shot=fopen(path, "wb"))!=NULL) { // jpeg file
          // initializatoin
          cinfo.err = jpeg_std_error(&jerr); // error handler
          jpeg_create_compress(&cinfo); // compression object
          jpeg_stdio_dest(&cinfo, shot); // tie stdio object to JPEG object
          row_stride = width * 3;

          pixels = (GLubyte *)malloc(sizeof(GLubyte)*width*height*3);
          flip = (GLubyte *)malloc(sizeof(GLubyte)*width*height*3);

          if (pixels!=NULL && flip!=NULL) {
             // save the screen shot into the buffer
             //glReadBuffer(GL_FRONT_LEFT);
             glPixelStorei(GL_PACK_ALIGNMENT, 1);
             glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);

             // give some specifications about the image to save to libjpeg
             cinfo.image_width = width;
             cinfo.image_height = height;
             cinfo.input_components = 3; // 3 for R, G, B
             cinfo.in_color_space = JCS_RGB; // type of image

             jpeg_set_defaults(&cinfo);
             jpeg_set_quality(&cinfo, quality, TRUE);
             jpeg_start_compress(&cinfo, TRUE);

             // OpenGL writes from bottom to top.
             // libjpeg goes from top to bottom.
             // flip lines.
             for (int y=0;y             for (int x=0;x                flip[(y*width+x)*3] = pixels[((height-1-y)*width+x)*3];
                   flip[(y*width+x)*3+1] = pixels[((height-1-y)*width+x)*3+1];
                   flip[(y*width+x)*3+2] = pixels[((height-1-y)*width+x)*3+2];
                }
             }

             // write the lines
             while (cinfo.next_scanline < cinfo.image_height) {
                row_pointer[0] = &flip[cinfo.next_scanline * row_stride];
                jpeg_write_scanlines(&cinfo, row_pointer, 1);
             }

             ret=true;
             // finish up and free resources
             jpeg_finish_compress(&cinfo);
             jpeg_destroy_compress(&cinfo);
          }
          fclose(shot);
       }
      
       if(pixels!=0)
          free(pixels);
       if(flip!=0)
          free(flip);

       return ret;
    }


    < Prev  Next >
    Last Updated on Sunday, 09 August 2009 07:37