About: Allan

4 thoughts on “VCL Component (TOpenGLAPPanel)”

  1. Hi
    OpenGLAP working well so far but my new installation of Builder2010 forces certain include files to appear in the header files of units containing forms, and forces #include “TOpenGLAPPanel.h” to appear before pragma hdrstop in the main unit, although it is already called in a subsequent header file (I have them daisychained to minimise repeated calls). Can anyone explain the logic behind this and whether it should be a problem.

    I am also getting Linker warnings “Public symbol -gtd appearing in both module… and module…, and similarly for _dfb and _m but I think this is a legacy problem.

  2. Builder is including the headers to make sure no compiler errors occur when we compile.
    unfortunally it is not very good to remove them when we delete a component again.

    for repeated calls, headers normally include defines like

    #ifndef TOpenGLAPPanelH
    #define TOpenGLAPPanelH
    … code

    this ensures only one interpretation of the linker.

  3. Hi

    All working very well. I would appreciate any clues regarding copying my OpenGLAPP image to clipboard please.


  4. Here is a clue….:-)

    //—- begin
    // Get client geometry
    int ii, Bytes, bb;
    SIZE glsize;
    unsigned char *pPixelData;

    ClearSelection ();
    Redraw ();

    glsize.cx = OpenGLPanel->ClientWidth;
    glsize.cy = OpenGLPanel->ClientHeight;

    // —- Lines have to be 32 bytes aligned, suppose 24 bits per pixel
    // —- just cropped it
    glsize.cx -= glsize.cx % 4;

    // —- Create a bitmap and select it in the device context
    // —- Note that this will never be used 😉 but no matter

    // —- Alloc pixel bytes
    Bytes = 3 * glsize.cx * glsize.cy;
    pPixelData = new unsigned char [Bytes];

    // —- Copy from OpenGL
    glReadPixels (0,0,glsize.cx,glsize.cy, GL_RGB, GL_UNSIGNED_BYTE, pPixelData);

    // —- Pixel data is stored as GRB, not RGB
    for (ii=0; iiHandle);
    SetClipboardData(CF_DIB, handle);

    delete [] pPixelData;
    // —- End

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.