DGL
https://delphigl.com/forum/

render on TBitmap - pixelformat troubles
https://delphigl.com/forum/viewtopic.php?f=19&t=3117
Seite 1 von 1

Autor:  Lelik [ Di Aug 03, 2004 12:01 ]
Betreff des Beitrags:  render on TBitmap - pixelformat troubles

Hi all,

I'm not really into Delphi, in fact I use Borland C++ Builder, but it shouldn't be a problem. I'm trying to render on a bitmap in BC++ Builder 5.0. I read in MSDN (which, unfortunately, deals with M$ stuff, not Borland) that the number of bits per pixels for the bitmap should be equal to that in the PIXELFORMATDESCRIPTOR. So here's the code:

Code:
  1.  
  2. prBM = new Graphics::TBitmap;
  3. prBM->PixelFormat = pf24bit;
  4. hdc = prBM->Canvas->Handle;   // is this the right handle to use here?
  5.  
  6. PIXELFORMATDESCRIPTOR pfd = {
  7.  sizeof(PIXELFORMATDESCRIPTOR),
  8.  1,
  9.  PFD_DRAW_TO_BITMAP | PFD_SUPPORT_OPENGL | PFD_SUPPORT_GDI,
  10.  PFD_TYPE_RGBA,
  11.  24,
  12.  0,0,0,0,0,0,
  13.  0,0,
  14.  0,0,0,0,0,
  15.  32,
  16.  0,
  17.  0,
  18.  PFD_MAIN_PLANE,
  19.  0,
  20.  0,0,0
  21. };
  22.  
  23. PixelFormat = ChoosePixelFormat(hdc, &pfd);
  24. if (!SetPixelFormat(hdc, PixelFormat, &pfd))
  25.     ShowMessage("Pixel format not set");
  26.  
  27.  


I guess that I got the flags alright. ChoosePixelFormat returns some stuff (so it's not NULL), but SetPixelFormat doesn't work. So I wonder what I did wrong?

So far, my main doubts are about the handle "hdc". In MSDN they operate with DIBsections. - But here, I use Borland's own TBitmap. Borland fans - does anyone know where's the problem? Thanx!

I absolutely need to render stuff on a TBitmap (my supervisor requires that, so...), and I couldn't get help on opengl.org forums :( Please help me, or at least drop a link where to look for a solution.

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/