Recent

Author Topic: OpenGLControl - Restart after change BorderStyle  (Read 432 times)

Milsa

  • Sr. Member
  • ****
  • Posts: 251
OpenGLControl - Restart after change BorderStyle
« on: April 02, 2021, 01:48:24 pm »
Please help me with this application. When I push BorderStyle button then OpenGLControl crashes. This is old bug:
https://bugs.freepascal.org/view.php?id=29141

I need switch OpenGLControl to full screen or window during application running. I still wait for fix but I need any solution.
I work with Lazarus 2.0.10, FPC 3.2.0, SVN 63526
This information is actual to: 1st Aug 2020

jamie

  • Hero Member
  • *****
  • Posts: 4440
Re: OpenGLControl - Restart after change BorderStyle
« Reply #1 on: April 02, 2021, 02:24:29 pm »
Most likely the host window is getting recreated when you change the border style. This most likely leads to a GL window not having a parent to get it's specs from.

 Technically a GL window does not need a form in real life but I suppose it still needs one as a measure to know where to show.

 If this is the case then you could in windows try using the SETWINDOWLONG to enable or disable the border, this way the handle will remain the same.

 Or, you could close the GL window, change your size then reopen the GL window. This way it will now have the new handle..


  Report back if that leads you anywhere cause I don't feel like loading up to app you posted to most likely find what I already think.
The only true wisdom is knowing you know nothing

jamie

  • Hero Member
  • *****
  • Posts: 4440
Re: OpenGLControl - Restart after change BorderStyle
« Reply #2 on: April 02, 2021, 04:12:50 pm »
I just got thinking....

What you need to do is not change the window style so that lcl does not recreate it...

use a TPanel inside a form as the host for the GL window and make the panel stay stuck to the side walls of the form.

After that yo should be able to do what you want with the form, I don't think the panel will recreate but just change its parent to the new handle of the form.
The only true wisdom is knowing you know nothing

Milsa

  • Sr. Member
  • ****
  • Posts: 251
Re: OpenGLControl - Restart after change BorderStyle
« Reply #3 on: April 02, 2021, 06:52:42 pm »
Thank you for your answer.

This application is only modified example from Lazarus but I have my application with TPanel and TOpenGLControl is in it.

I found the solution. It is similar to what you write: It is necessary to free OpenGLControl and recreate it again with all properties.
I work with Lazarus 2.0.10, FPC 3.2.0, SVN 63526
This information is actual to: 1st Aug 2020

 

TinyPortal © 2005-2018