Board index » delphi » OpenGL rendering outside form

OpenGL rendering outside form

I'm developing a subclass of TGraphic that handles SVG files, using OpenGL
to render the image.

I have a test program that has on the main form
- a TPaintbox top left
- a TImage bottom left with autosize true and stretch false
- a custom windowed control (TPanel with a canvas) top right

I can load an SVG file at will and draw it in all three components.

If the size of the SVG image is big enough the image stretches beyond the
boundaries of the form, which quite properly goes into autoscroll mode.

So far so good.

If I scroll down the top two images disappear and the whole image comes into
view. So far also so good.

When I scroll back up again the paintbox and the image are OK BUT then
windowed control is not rendered (the borders show but not the image) and a
rectangle the same size as the windowed control, offset from the top left of
the SCREEN the same distance as it should be from the top left of the form,
is cleared to the background colour of the image (done by glClear).

I'd love to know how this happens: I can't even think of a way to debug it.

 

Re:OpenGL rendering outside form


Quote
> I have a test program that has on the main form
> - a TPaintbox top left
> - a TImage bottom left with autosize true and stretch false
> - a custom windowed control (TPanel with a canvas) top right

TPaintBox and TImage is not windowed control, then they paint in same
window(GLRC->DC->Wnd). So that ,they iteractive underground is possible.

Re:OpenGL rendering outside form


I know this - my TImage and my TPaintbox work fine. To render to them I use
the Form window DC and render to that, suitably offset and clipped.

My problem is with the windowed control, which has its own window handle and
device context. After scrolling it out of sight and then scrolling it back
in view the device context of the window control appears to point outside
the form's (application's) device context.

I had another problem before that turned out to be OS/graphics card related.
This may be another one - I haven't checked on any other machine yet.

Thanks anyway.

Quote
forums.borland.com <pin...@hotmail.com> wrote in message

news:3d65a926@newsgroups.borland.com...
Quote

> > I have a test program that has on the main form
> > - a TPaintbox top left
> > - a TImage bottom left with autosize true and stretch false
> > - a custom windowed control (TPanel with a canvas) top right

> TPaintBox and TImage is not windowed control, then they paint in same
> window(GLRC->DC->Wnd). So that ,they iteractive underground is possible.

Re:OpenGL rendering outside form


Like I suspected, this turns out to be graphic card related. All I can say
for now is it works for some and doesn't for others.

Re:OpenGL rendering outside form


I guess your program keep the DC in a var, try to call GetDC to get the dc
before paint , or override CreateParam method of the windowed control to add
WS_OWNDC in Style.

"Cleverley Graham" <g...@pt.lu> D????D???
:3d65f...@newsgroups.borland.com...

Quote
> I know this - my TImage and my TPaintbox work fine. To render to them I
use
> the Form window DC and render to that, suitably offset and clipped.

> My problem is with the windowed control, which has its own window handle
and
> device context. After scrolling it out of sight and then scrolling it back
> in view the device context of the window control appears to point outside
> the form's (application's) device context.

> I had another problem before that turned out to be OS/graphics card
related.
> This may be another one - I haven't checked on any other machine yet.

> Thanks anyway.

Other Threads