VCL Component (TOpenGLAPPanel)

It seems like people still want a small upgrade/compiling for the new Embarcadero RAD Studio XE2.

Download TOpenGLAPPanel 1.4.0
(290.65 kB Downloaded 2559 times)
OpenGL VCL Component for Embarcadero RAD Studio XE2

4 comments to VCL Component (TOpenGLAPPanel)

  • Marcio

    Hi.
    Thank you for sharing this component but could ask you a tutorial how to install this package. I am getting some stranges messages and nothing happens after. (using XE2 update 3)
    Thank ypu

  • John

    Having a problem with SaveOpenGLPanelToFile. It is saving a blank image. Have you seen that before, or is it my implementation. BTW, love this component.

    John

  • Hi John

    It is an implementation that might not work like you expect, I have personally replaced it with something like this:

    bool CopyToBitmap (Graphics::TBitmap *BitMap)
    {
    // —- Creating Directly into bitmap
    int Bytes, yy;
    SIZE glsize;
    unsigned char *pPixelDataStart;
    unsigned char *pPixelData;
    Byte *Ptr;

    OpenGLPanel->MakeOpenGLPanelCurrent();

    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;
    glsize.cy -= glsize.cy % 4;

    // —- Alloc pixel bytes
    Bytes = ((glsize.cx*24+31)/32 * 4)*glsize.cy;
    if (Bytes < 4 || glsize.cy < 1) {
    return (false);
    }

    pPixelData = new unsigned char [Bytes];

    // ---- Copy from OpenGL
    glReadPixels (0,0,glsize.cx,glsize.cy, GL_BGR_EXT, GL_UNSIGNED_BYTE, pPixelData);
    /*
    int rc = glGetError ();
    if (rc != GL_NO_ERROR) {
    return (false);
    }
    */
    BitMap->PixelFormat = pf24bit;
    BitMap->HandleType = bmDIB;
    BitMap->Width = glsize.cx;
    BitMap->Height = glsize.cy;

    Bytes = (24*glsize.cx) >> 3;
    while (Bytes%4) Bytes++;

    pPixelDataStart = pPixelData;
    for (yy=glsize.cy-1; yy>=0; yy–) {
    Ptr = (Byte *) BitMap->ScanLine[yy];
    memcpy (Ptr, pPixelData, Bytes);
    pPixelData += Bytes;
    }
    delete [] pPixelDataStart;

    return (true);
    }

    Best Regards
    Allan

  • C. T. Liu

    Hi:

    This component would crash in MDI application under XE3.

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>