Trying to use GLScene lazarus / 70-OpenGL ---------------------------------------------------------------------- AussieUser · 2024-08-30 09:53 Hi All, I just downloaded and installed GLSceneLazarus . On trying a simple project that uses GLScene, the compile aborts with a missing component jpegforlazarus. The LPK file for this is nowhere on my computer. Can anyone point me towards where I can find it ? Thank you very much. ---------------------------------------------------------------------- hennerd · 2024-08-30 11:14 try to add/replace as ImagesForLazarus as a required package ---------------------------------------------------------------------- AussieUser · 2024-08-30 20:47 ImagesForLazarus is allredy installed. ---------------------------------------------------------------------- AussieUser · 2024-08-30 23:11 When compiling package runtime get error as shown below     celKOI8ToUTF8:       Result := KOI8ToUTF8(aValue); ---------------------------------------------------------------------- AussieUser · 2024-08-30 23:58 Is there any comprehensive documentation on Lazarus GLScene? ---------------------------------------------------------------------- AussieUser · 2024-08-31 03:14 Can someone explain why this isn't working. I just get a black screen, I want to see a sphere. Any help appreciated. unit Unit1; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, GLScene, GLViewer,   GLVectorGeometry, GLVectorTypes, GLObjects; type   { TForm1 }   TForm1 = class(TForm)   private     Scene: TGLScene;     Viewer: TGLSceneViewer;     Camera: TGLCamera;     Sphere: TGLSphere;     Light: TGLLightSource;   public     constructor Create(AOwner: TComponent); override;   end; var   Form1: TForm1; implementation {$R *.lfm} { TForm1 } constructor TForm1.Create(AOwner: TComponent); begin   inherited Create(AOwner);   // Create the scene   Scene := TGLScene.Create(Self);   // Create the camera and set its position   Camera := TGLCamera.Create(Scene);   Camera.Position.SetPoint(0, 0, 10);  // Set the camera 10 units away from the scene  // Camera.PointTo(TVector(0,0,0),TVector(0,1,0));   // Add a light source to the scene   Light := TGLLightSource.Create(Scene);   Light.Position.SetPoint(5, 5, 5);    // Place the light source at (5, 5, 5)   // Create a sphere and place it at the center of the scene   Sphere := TGLSphere.Create(Scene);   Sphere.Radius := 10.0;                // Set the radius of the sphere to 1 unit   Sphere.Position.SetPoint(0, 0, 0);   // Set the position of the sphere   // Set up the GLSceneViewer   Viewer := TGLSceneViewer.Create(Scene);   Viewer.Parent := Form1;               // Attach the viewer to the form   Viewer.Align := alClient;            // Set it to fill the form   Viewer.Camera := Camera;             // Assign the camera to the viewer   // Start rendering the scene   Viewer.Invalidate; end; end. ---------------------------------------------------------------------- TRon · 2024-08-31 03:30 Please use codetags The first thing I noticed is that sceneviewer's owner should be the form. The owner of these components that you create should be the form. And since you seem to be doing everything manually. Also take care of setting the parents. ---------------------------------------------------------------------- AussieUser · 2024-08-31 03:35 Thanks. I'm very new to GLScene. I would appreciate a short program that does things properly to save me mucking about too much. ---------------------------------------------------------------------- TRon · 2024-08-31 03:37 You are aware that the package comes with a bunch of examples (i counted over 30) ? You seem to be creating these components at runtime but what you should be doing is use the visual designer. edit: just load one of the examples and you can see for yourself what that entails. ---------------------------------------------------------------------- AussieUser · 2024-08-31 03:42 All the examples I saw were based on Delphi, even those in the Lazarus folder. If you could point me to a Lazarus one that would be good. ---------------------------------------------------------------------- TRon · 2024-08-31 03:46 I can only see lazarus examples (the lfm extention in use is a dead giveaway). Where did you got the package from ?, it can be installed by using OPM and seems completely Lazarus oriented. ---------------------------------------------------------------------- AussieUser · 2024-08-31 04:03 Well, I got some of the examples to run but I only saw a white screen. When I moved the mouse in the viewer I got the occasional flash of an object there, but it disappeared. Any ideas on that? ---------------------------------------------------------------------- TRon · 2024-08-31 04:30 Quote from: AussieUser on August 31, 2024, 06:03:41 amAny ideas on that? Unfortunately, no. It is not possible for me to install the OPM glscene package and there is no repository to be able to correct the error or report the bug (something that I explicitly warned for in the past). ---------------------------------------------------------------------- wp · 2024-08-31 11:29 There are so many links to GLScene that it's hard to find the correct one. - The official repository is hosted at github: https://github.com/glscene/GLScene - it is Delphi only, however. - There is also a svn repository at sourceforce: https://sourceforge.net/p/glscene/code/HEAD/tree/, at first glance identical with the github repo. In the branches subfolder, however, there is a GLSceneLCL folder, and this is the Lazarus adaption of the code. - The version distributed by OPM seems to be identical with the sourceforge GLSceneLCL. - Older versions referred to by the wiki article (https://wiki.freepascal.org/GLScene) should not be used any more. Since the OPM version corresponds to the sourceforge GLSceneLCL version, I think any bug reports and patches should be directed to the sourceforge bug tracker https://sourceforge.net/p/glscene/_list/tickets. Unfortunately it seems that GLSceneLCL has not been tested with recent Laz/FPC versions: Quote from: AussieUser on August 31, 2024, 01:11:13 amWhen compiling package runtime get error as shown below     celKOI8ToUTF8:       Result := KOI8ToUTF8(aValue); This is because in Laz 2.2 the funtion KOI8ToUF8 has been renamed to KOI8RToUTF8. Therefore, in unit GLSLanguage, procedureTGLLanguage.EncodeToUTF8, change KOI8ToUTF8 to KOI8RToUTF8. Quote from: AussieUser on August 31, 2024, 06:03:41 amWell, I got some of the examples to run but I only saw a white screen. When I moved the mouse in the viewer I got the occasional flash of an object there, but it disappeared. I see this, too, but did not yet find the location where an additional "Refresh" or "SwapBuffers" must be inserted. Any ideas are welcome. I'll report the fix to the sourceforge GLSceneLCL then, and update OPM. [EDIT] Found this in the German Lazarus forum (https://www.lazarusforum.de/viewtopic.php?p=142034#p142034): Set the form's DoubleBuffered property to false, and the graphic will appear. Alternatively it is also sufficient to set the GLSViewer's DoubleBuffered to false in the OnCreate event of the form, or to get it fixed permanently, to add "DoubleBuffered := false" at the end of the TGLSceneViewer.Create. ---------------------------------------------------------------------- TRon · 2024-08-31 12:35 Quote from: wp on August 31, 2024, 01:29:03 pmThere are so many links to GLScene that it's hard to find the correct one. Thank you for the extensive (re)search wp. Just saying that if I have to go through all these hoops (by guessing) then I already lost my interest. The json package data information from OPM is not clear to me. Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  "PackageData68" : {    "Name" : "GLScene",    "DisplayName" : "GLScene",    "Category" : "Graphics",    "CommunityDescription" : "GLScene is an OpenGL based 3D library for Delphi, C++Builder and Lazarus. It provides visual components and objects allowing description and rendering of 3D scenes in graphic applications.",    "ExternalDependecies" : "",    "OrphanedPackage" : 0,    "RepositoryFileName" : "GLScene.zip",    "RepositoryFileSize" : 27552020,    "RepositoryFileHash" : "6acb00be27d52d780ac139e98a629132",    "RepositoryDate" : 4.4402816899155092E+004,    "PackageBaseDir" : "GLSceneLCL\\/",    "HomePageURL" : "https://sourceforge.net/projects/glscene/",    "DownloadURL" : "",    "SVNURL" : ""  },  QuoteUnfortunately it seems that GLSceneLCL has not been tested with recent Laz/FPC versions: It is (can) not work(ing) since revision 6979 (7 years ago), see this file and its conditionals. At least that is where things get stuck on/for linux x86_64. ---------------------------------------------------------------------- wp · 2024-08-31 14:13 Made the changes mentioned in my earlier message, notified the GLScene maintainer, and updated OPM. Checked the new OPM version with Laz 3.4 on Windows 11, and it seems to work fine. Quote from: TRon on August 31, 2024, 02:35:58 pmThe json package data information from OPM is not clear to me. What is it that is not clear? Quote from: TRon on August 31, 2024, 02:35:58 pmIt is (can) not work(ing) since revision 6979 (7 years ago), see this file and its conditionals. At least that is where things get stuck on/for linux x86_64. I played with some of my VMs and found that the package only can be used on Windows. What a pity.... ---------------------------------------------------------------------- AussieUser · 2024-08-31 22:48 [EDIT] Found this in the German Lazarus forum (https://www.lazarusforum.de/viewtopic.php?p=142034#p142034): Set the form's DoubleBuffered property to false, and the graphic will appear. Alternatively it is also sufficient to set the GLSViewer's DoubleBuffered to false in the OnCreate event of the form, or to get it fixed permanently, to add "DoubleBuffered := false" at the end of the TGLSceneViewer.Create. « Last Edit: Today at 02:09:23 pm by wp » Setting DoubleBuffered:= False worked for me. Thank you.