Board index » delphi » Canvas Handle, TPaintBox and OpenGL

Canvas Handle, TPaintBox and OpenGL

I'm just trying out my first bit of OpenGL...

I've successfully managed to output something into my main form using the
main form's Canvas.Handle, but if I want to output in a TPaintBox object
that I've placed on that form (using TPaintBox1.Canvas.Handle) nothing
appears.  Can anyone help me understand why not?

Many thanks

Nigel

--
See me here: http://www.minddata.co.uk/

 

Re:Canvas Handle, TPaintBox and OpenGL


You can save a lot of time by using existing code :

http:\\glscene.org

Rene
--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com

Re:Canvas Handle, TPaintBox and OpenGL


You don't want to use Canvas.Handle. I know that the Canvas.Handle is the
handle to the device context, but it is very transitory, so your rendering
context will become invalid at some point; instead use GetDC and keep the
result. I discuss this fact early on in "Delphi Developers' Guide to
OpenGL." (see link below).
Jon
http://home1.gte.net/jqjacobs/index.htm
"Follow not the null pointer, for therein lies chaos and madness" (Author
Unknown)
Quote
> I've successfully managed to output something into my main form using the
> main form's Canvas.Handle, but if I want to output in a TPaintBox object
> that I've placed on that form (using TPaintBox1.Canvas.Handle) nothing
> appears.  Can anyone help me understand why not?

Re:Canvas Handle, TPaintBox and OpenGL


Quote
Rene Tschaggelar <tschagge...@dplanet.ch> wrote in message

news:3996F795.A3C7E9BB@dplanet.ch...

Quote
> You can save a lot of time by using existing code :

That may be right ;-)   - but I'm doing this to help understand some OpenGL
and I think I get a better understanding by making my own mistakes first...
however..

Quote
> http:\\glscene.org

I'll certainly check this out...

Thanks alot,

Nigel

--
See me here: http://www.minddata.co.uk/

Re:Canvas Handle, TPaintBox and OpenGL


Jon Q. Jacobs <jqjac...@gte.net> wrote in message news:39970d48_2@dnews...

Quote
> You don't want to use Canvas.Handle. I know that the Canvas.Handle is the
> handle to the device context, but it is very transitory, so your rendering
> context will become invalid at some point; instead use GetDC and keep the
> result. I discuss this fact early on in "Delphi Developers' Guide to
> OpenGL." (see link below).

I did try that as well - maybe there was something else wrong there...
anyhow I'll follow the link - thanks very much

Nigel.
--
See me here: http://www.minddata.co.uk/

Re:Canvas Handle, TPaintBox and OpenGL


This is not OpenGL yet. It is getting OpenGL running on Windows
and Delphi. OpenGL itself is platform independant, these are
points to get there.

Rene
--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com

Re:Canvas Handle, TPaintBox and OpenGL


Quote
> that I've placed on that form (using TPaintBox1.Canvas.Handle) nothing

By the way, TPaintBox is not a descendant of TWinControl, so you don't have
a window handle from which to get a device context, from which to build a
rendering context. Forget using TPaintBox. With great effort you might be
able to kludge a way to use TPaintBox, but it definitely would not be worth
the effort. Many people have successfully used descendants of TCustomPanel
to use for rendering on a portion of a form, if that is what you are after.
--
Jon
http://home1.gte.net/jqjacobs/index.htm
"Follow not the null pointer, for therein lies chaos and madness" (Author
Unknown)

Other Threads