0
votes

I try to convert an existing OpenGL-Application from VCL-based forms to FMX-based forms in C++ Builder XE3.

For this purpose I use the handle of a Firemonkey-form to create the OpenGL device context and make this form a child of another form to mimic the panel inside the form which I had in my VCL-based application.

The problem is now that after a resize-event or in general after calling Invalidate() the form is rendered with its background. This causes a flickering or even worse: sometimes the background is shown instead of my OpenGL rendered scene.

How can I prevent the repaint of the region at the position of my Firemonkey-OpenGL-form. Alternatively, can I define an Ownerdraw-function or something else?

Please note, that it is no option for me to use a Firemonkey-3d-Form.

2
Not sure what "Firemonkey" is, but presumably it has a method for painting and the method for erasing the background, like a Windows Form would have. You need to find the erase background message, override it and make sure it does nothing.Robinson
@Robinson: Firemonkey similar to Windows Forms but the controls are painted with OpenGL (MacOS) or DirectX (Win). Therefore it behaves in a completely different way.David B.

2 Answers

0
votes

Have tried giving the form a transparent background? Then you can paint whatever you want 'over the top'.

The quick way is to set the forms Transparent property to True, but this creates issues with ComboBoxes.

Another way is to place a TRectangle on the form. Set it's StyleName to 'backgroundstyle'. Set it's Fill.Color to claNull. Set Stroke.Thickness to 0. This will replace the default background styling for the form.

If you want to paint your own borders too you'll need to investigate non-client area styling but I don't have a pointer to a good resource at present.

0
votes

After hours of experimenting I found the solution: The "TCommonCustomForm" has the needed properties: (1) it does not draw itself, (2) it has a handle which can be used for OpenGL initialization.

I hope this information will help others.