× Components and Libraries for Graphics 3D Development, discussions, problems and suggestions

Question GLScene errors

  • 4aiman
  • 4aiman's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Comix creator
More
9 years 3 months ago #1404 by 4aiman
GLScene errors was created by 4aiman
Hello everybody!
Some time ago I've posted message about GLSceneError.

And I've found a solution that will work out for me ;)

There're several things you probably want to do:
Do NOT create GLSceneViewer in the Design-time. That will cause IDE's crash once you've opened your project after closing Lazarus.
Instead you should add global variable and create GLSceneViewer on main-form-create.
But do NOT assign parent for GLScene Viewer at main-form-create event! Do it at main-form-on-show event instead and that'll do the trick ;)

It seems that ubuntu (x-system to be exact) is unable to create OGL context while containing form yet had to be shown. And, once containing form has been shown, it can.

Still I'd prefer to use GLSceneVievwer at design time (well, It's usefull to be able to check how an object would look like without building), but afaik we cannot create GlSceneViewer at container-component-on-show event without changing all of it's ancestors creation time. And that's way too hard (and too wrong) to implement. Or am I wrong? (Earlier versions of GL scene worked fine - the one in CT 1.6, for example.)

Totay I'll update my nvidia driver from 280 to 285 version and will do tests again.

コンソールマニアック

Please Log in or Create an account to join the conversation.

  • avra
  • Visitor
  • Visitor
9 years 2 months ago #1421 by avra
Replied by avra on topic Re: GLScene errors
Nice report, but you should put a link to your message in the original thread too.

Please Log in or Create an account to join the conversation.

  • 4aiman
  • 4aiman's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Comix creator
More
9 years 2 months ago #1425 by 4aiman
Replied by 4aiman on topic Re: GLScene errors
Ok, now I've 290 driver for v-card and could tell this: There's no difference :)
I've already said about problems and here's what I've done to work around it:
procedure TForm1.FormCreate(Sender: TObject);

begin
     ...
     {$ifdef UNIX}
       glsceneviewer1:=Tglsceneviewer.Create(self);
     {$endif}
     {$ifdef MSWindows}
       glsceneviewer1:=Tglsceneviewer.Create(self);
       glsceneviewer1.Parent:=TabSheet12;
     {$endif}
     ...
end;
You could see, that there's no parent assignment for glsceneviewer for linux. That's because I've done that in OnShow of Tabsheet12 (Yes, I really need that many tabs) :
procedure TForm1.TabSheet12Show(Sender: TObject);
begin
     ...
     {$IFDEF UNIX} 
       glsceneviewer1.parent:=TabSheet12; 
     {$endif}
     ...
end;
And that could've end the story, but this way it wouldn't work under Windows (I just don't now why). My project has stopped to give me an siegv error only after appending "windows part" to the first procedure. For now I could run my project on both win and lin :)

コンソールマニアック

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
9 years 2 months ago #1426 by Sternas Stefanos
Replied by Sternas Stefanos on topic Re: GLScene errors
And soon on Solaris and FreeBSD with
the same code... :)

Thanks for your report Sir
have fun...

PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

  • 4aiman
  • 4aiman's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Comix creator
More
9 years 2 days ago #1655 by 4aiman
Replied by 4aiman on topic Re: GLScene errors
This is a copy of a part of a message I had sent to sternas. Maybe smbd could suggest smth?

Did you remember my post about glsceneviewer and it's parent?
So, I still use that method to create glsceneviewer in CT 2.4. But only today I've found a glitch:
presence of Glsceneviewer object (even only in memory, e.g. without parent assignment) causes ALL modal forms to refuse to close...

And once I have viewer creation code commented, all modal forms are back to normal.

I could tell more.
Let's say we have one main form and other form with some controls. Second one is created and shown when we press some button on the first form e.g.
Form2:=Tform2.create;
Form2.showmodal;
.... // some code here
If there's no glsceneviewer, then we'll see form2 in modal state. and when we close it - it'll close.
BUT, if there IS a viewer, the second form wouldn't close. I've tried all of the modal results but only direct destruction closes the form. And what's more interesting, after that destruction command Form2.Free; didn't raise an exception! O_o

And the same thing happens with ALL dialogs, except for they DO close by alt+f4 or clicking the close button on the window's corner.

Once we remove any mention of viewer - modal forms are fine once again.

I believe this issue is similar to bimodal situation, but I'm not sure and do not know how to fix that.
...
Thanks in advance.


コンソールマニアック

Please Log in or Create an account to join the conversation.

  • 4aiman
  • 4aiman's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Comix creator
More
8 years 11 months ago - 8 years 11 months ago #1698 by 4aiman
Replied by 4aiman on topic Re: GLScene errors
Ok. I have FOUND what causes modal forms to malfunction! :cheer:

First: glsceneviewer must NOT be placed on the tabsheet of pagecontrol. If you want to do it then you'll have to create viewer at runtime and define it's parent at OnShow of form or later.

Second: Modal form will not close if you have glsceneviewer on a tabsheet with labels ON THE LEFT. Sounds strange but once labels switched back to top, modal forms will work properly O_o

Here's project that recreates both issues: erroneous.7z

Could anyone suggest why it is so?

コンソールマニアック
Last edit: 8 years 11 months ago by 4aiman.
The following user(s) said Thank You: Konstantinos Papadoulas

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
8 years 11 months ago - 8 years 11 months ago #1699 by Sternas Stefanos
Replied by Sternas Stefanos on topic Re: GLScene errors
CodeTyphon High Level Graphics Libraries
like pl_GLScene, pl_Castle, pl_Lava, pl_Win_DirectXUT etc request
(in some cases) "clear form" to work correctly.

Multi-OS/CPU ability (at this level) is not simple
but we try to solve, all these problems ... :)

PilotLogic Architect and Core Programmer
Last edit: 8 years 11 months ago by Sternas Stefanos.

Please Log in or Create an account to join the conversation.

  • 4aiman
  • 4aiman's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Comix creator
More
8 years 11 months ago #1701 by 4aiman
Replied by 4aiman on topic Re: GLScene errors
And I wish you good luck on this path :)
You're doing great!

It's just that type of application that requires some tabs. I didn't want earlier and don't want now to have (approximately) 12 forms with buttons or menus to switch between them. And I hardly can imagine what code it'll be if I went that way at the beginning.

So... if you could share some info on why did glscene request clear form, then maybe I could think of smth ;)

コンソールマニアック

Please Log in or Create an account to join the conversation.