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: prBM = new Graphics::TBitmap; prBM->PixelFormat = pf24bit; hdc = prBM->Canvas->Handle; // is this the right handle to use here? PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_BITMAP | PFD_SUPPORT_OPENGL | PFD_SUPPORT_GDI, PFD_TYPE_RGBA, 24, 0,0,0,0,0,0, 0,0, 0,0,0,0,0, 32, 0, 0, PFD_MAIN_PLANE, 0, 0,0,0 }; PixelFormat = ChoosePixelFormat(hdc, &pfd); if (!SetPixelFormat(hdc, PixelFormat, &pfd)) ShowMessage("Pixel format not set");
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.
|