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.
TOpenGLAPPanel-1.2.0.zip (4145 downloads)
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.
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
#endif
this ensures only one interpretation of the linker.
Hi
All working very well. I would appreciate any clues regarding copying my OpenGLAPP image to clipboard please.
Thanks
Here is a clue….:-)
//—- begin
// Get client geometry
int ii, Bytes, bb;
SIZE glsize;
unsigned char *pPixelData;
OpenGLPanel->MakeOpenGLPanelCurrent();
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 RGBHandle);
for (ii=0; ii
EmptyClipboard();
SetClipboardData(CF_DIB, handle);
CloseClipboard();
}
delete [] pPixelData;
// —- End