VCL Component (TOpenGLAPPanel)

Fixes for typecasting error in Get3DTextSize, DrawText2D and DrawText3D.

Remember to change the range for FirstGlyph and NumGlyph to 0 and 255 to get the full range of characters.

Download TOpenGLAPPanel 1.2.0
(274.37 kB Downloaded 1892 times)
OpenGL VCL Component for Embarcadero RAD Studio 2010

4 comments to VCL Component (TOpenGLAPPanel)

  • Phil

    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.

  • 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.

  • Phil


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


  • Here is a clue….:-)

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

    ClearSelection ();
    Redraw (); = OpenGLPanel->ClientWidth; = OpenGLPanel->ClientHeight;

    // —- Lines have to be 32 bytes aligned, suppose 24 bits per pixel
    // —- just cropped it -= % 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 * *;
    pPixelData = new unsigned char [Bytes];

    // —- Copy from OpenGL
    glReadPixels (0,0,,, GL_RGB, GL_UNSIGNED_BYTE, pPixelData);

    // —- Pixel data is stored as GRB, not RGB
    for (ii=0; ii bb = pPixelData[ii+1];
    pPixelData[ii+1] = pPixelData[ii];
    pPixelData[ii] = bb;

    // ---- Fill header
    // --- BITMAPINFOHEADER header;
    BITMAPINFO header;

    header.bmiHeader.biWidth =;
    header.bmiHeader.biHeight =;
    header.bmiHeader.biSizeImage = Bytes;
    header.bmiHeader.biSize = 40;
    header.bmiHeader.biPlanes = 1;
    header.bmiHeader.biBitCount = 24; // RGB
    header.bmiHeader.biCompression = 0;
    header.bmiHeader.biXPelsPerMeter = 0;
    header.bmiHeader.biYPelsPerMeter = 0;
    header.bmiHeader.biClrUsed = 0;
    header.bmiHeader.biClrImportant = 0;

    // ---- Generate handle
    HANDLE handle = (HANDLE)GlobalAlloc (GHND,sizeof(BITMAPINFO) + Bytes);
    if (handle != NULL) {
    // Lock handle
    char *pData = (char *) ::GlobalLock((HGLOBAL)handle);
    // Copy header and data
    // Unlock

    // Push DIB in clipboard
    SetClipboardData(CF_DIB, handle);

    delete [] pPixelData;
    // —- End

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>