glscene / GLScene

GLScene is a graphics engine based on OpenGL with VCL components for Delphi & C++ Builder.
http://www.glscene.org
Mozilla Public License 2.0
216 stars 32 forks source link

Advanced Demo "Earth" range check errors with software rendering. #14

Closed SkybuckFlying closed 1 year ago

SkybuckFlying commented 2 years ago

The advanced demo "earth" in the folder "..\GLScene\AdvDemos\Earth" produces range check errors with software rendering.

To turn software rendering on use the object inspector and navigate to the following property:

GLSceneViewer.Buffer.ContextOptions.roSoftwareMode checkbox True.

It would be great if these range check errors and integer overflow errors could be solved so that software rendering mode works too.

SkybuckFlying commented 2 years ago

In folder: ..\GLScene\AdvDemos\Earth

4.1 Fixing the Advanced Earth Demo for software rendering:

4.1.1. Change GLSceneViewer.Buffer.ContextOptions.roSoftwareMode to true.

4.1.2. Change GLSceneViewer.Buffer.AccumBufferBits from 0 to 8, 16, 24 or 32.

4.1.3. Deleting the flare component from the sun component:

GLScene(right click)->Show Scene Editor->LSSun->GLLensFlare1

Right click->delete object

4.1.4. Disable following two lines in GLScene library unit: GLS.Graphics.pas

    for slice := 0 to d - 1 do
    begin
        // Skybuck: disabled, buggy in software mode
//      Build2DMipmap(GetLevelAddress(0), LAddresses, fColorFormat, fDataType,
//        AFilter, GetWidth, GetHeight);
      for level := 1 to fLevelCount - 1 do
        Inc(PByte(LAddresses[level - 1]), GetLevelSizeInByte(level) div d);
    end;

4.1.5. Disable the following line in fEarthd.pas:

procedure TForm1.GLSceneViewerBeforeRender(Sender: TObject);
begin
//  GLLensFlare1.PreRender(Sender as TGLSceneBuffer);