0

Trying to set up an Opengl context to render into a bitmap but I've found the handle returned from the Tbimap canvas object keeps changing so the rendering context keeps throwing an exception because it doesn't match the handle the rendering context was created with.

I found changing the bitmaps width or height will change the handle value, and if the bitmap is created outside of the procedure that does the rendering, you get a different handle each time you enter the procedure.

I need this to stay static or its all a bit pointless having the ability to render to a bitmap in the first place.

Any clues how to fix the handle?

4

1 回答 1

6

Windows bitmap objects have fixed width and height. When you create an HBITMAP you have to decide once and for all on the height, width and indeed other properties such as pixel format. So, of course when you modify the Width and Height property of a Delphi TBitmap, then the implementing HBITMAP will need to be re-created.

It seems that you are asking to be able to create an HBITMAP that has width and height properties that can be modified. No such thing exists.

于 2013-03-11T10:08:03.203 回答