diff --git a/mainunit.pas b/mainunit.pas index 3870172..cca9567 100755 --- a/mainunit.pas +++ b/mainunit.pas @@ -4405,6 +4405,12 @@ procedure TGLForm1.PrefMenuClick(Sender: TObject); gPrefs.RenderQuality := kRenderPoor else gPrefs.RenderQuality := kRenderBetter; + {$IFDEF LINUX} + if (gPrefs.RenderQuality > kRenderPoor) and (AnsiContainsText(gShader.Vendor,'MESA'))then begin + ShowMessage('Mesa drivers may have visual artifacts for quality better than "Poor".'); + gPrefs.isMesaWarned:= true; + end; + {$ENDIF} if QualityCombo.ItemIndex = 2 then //only for best quality gPrefs.OcclusionAmount := 25 else @@ -5564,7 +5570,7 @@ function isExeReadOnly: string; {$ENDIF} procedure TGLForm1.AboutMenuClick(Sender: TObject); -{$DEFINE TIMEABOUT} +//{$DEFINE TIMEABOUT} {$IFDEF TIMEABOUT} const kSamp = 36; @@ -5621,7 +5627,7 @@ procedure TGLForm1.AboutMenuClick(Sender: TObject); {$IFDEF Linux} + ' Linux'{$ENDIF} {$IFDEF Windows} + ' Windows'{$ENDIF} {$IFDEF DGL} + ' DGL'{$ENDIF} - {$IFNDEF COREGL}+' (Legacy OpenGL)'{$ENDIF} + {$IFNDEF COREGL}+' (Legacy '+{$IFDEF LEGACY_INDEXING}'Indexed '+{$ENDIF}'OpenGL)'{$ENDIF} {$IFDEF Darwin} {$IFDEF LCLCocoa} +''; titleStr := Str; str := ' '+GetHardwareVersion diff --git a/opts.inc b/opts.inc index bb228dd..32f4acc 100755 --- a/opts.inc +++ b/opts.inc @@ -6,10 +6,10 @@ // NOT COREGL, DEFINED LEGACY_INDEXING : uses indexed vertices and glDrawElements (medium efficiency) // NOT COREGL, NOT LEGACY_INDEXING : glCallList with redundant vertices (least efficient) -//{$DEFINE COREGL} +{$DEFINE COREGL} {$DEFINE LEGACY_INDEXING} {$DEFINE GEOM_GLEXT} //{$DEFINE HEMISSAO} //for hemispherical SSAO - requires shaders that save surface normal - see hemiAO3 and hemiAO {$DEFINE CTM} //support OpenCTM format, requires LZMA decoding //{$DEFINE TUBES} -{$DEFINE MATCAP} +{$DEFINE MATCAP} \ No newline at end of file diff --git a/optsCompat.inc b/optsCompat.inc index decaf9a..db806e3 100755 --- a/optsCompat.inc +++ b/optsCompat.inc @@ -1,9 +1,15 @@ {$DEFINE MYPY} -//{$DEFINE FASTGZ} //{$DEFINE DGL} //for DGL library, otherwise gl/glext +{$DEFINE FASTGZ} +//There are 3 modes +// DEFINED COREGL : uses "modern" OpenGL 3.3 for most efficient use of resources (most efficient) +// NOT COREGL, DEFINED LEGACY_INDEXING : uses indexed vertices and glDrawElements (medium efficiency) +// NOT COREGL, NOT LEGACY_INDEXING : glCallList with redundant vertices (least efficient) + //{$DEFINE COREGL} -{$DEFINE GEOM_GLEXT} //if glext.pp defines +{$DEFINE LEGACY_INDEXING} +{$DEFINE GEOM_GLEXT} //{$DEFINE HEMISSAO} //for hemispherical SSAO - requires shaders that save surface normal - see hemiAO3 and hemiAO {$DEFINE CTM} //support OpenCTM format, requires LZMA decoding //{$DEFINE TUBES} -{$DEFINE MATCAP} +{$DEFINE MATCAP} \ No newline at end of file diff --git a/optsCompatGeom.inc b/optsCompatGeom.inc index 7bb09b2..db806e3 100755 --- a/optsCompatGeom.inc +++ b/optsCompatGeom.inc @@ -1,7 +1,14 @@ {$DEFINE MYPY} //{$DEFINE DGL} //for DGL library, otherwise gl/glext +{$DEFINE FASTGZ} +//There are 3 modes +// DEFINED COREGL : uses "modern" OpenGL 3.3 for most efficient use of resources (most efficient) +// NOT COREGL, DEFINED LEGACY_INDEXING : uses indexed vertices and glDrawElements (medium efficiency) +// NOT COREGL, NOT LEGACY_INDEXING : glCallList with redundant vertices (least efficient) + //{$DEFINE COREGL} -{$DEFINE GEOM_GLEXT} //if glext.pp defines +{$DEFINE LEGACY_INDEXING} +{$DEFINE GEOM_GLEXT} //{$DEFINE HEMISSAO} //for hemispherical SSAO - requires shaders that save surface normal - see hemiAO3 and hemiAO {$DEFINE CTM} //support OpenCTM format, requires LZMA decoding //{$DEFINE TUBES} diff --git a/optsCore.inc b/optsCore.inc index 5780102..32f4acc 100755 --- a/optsCore.inc +++ b/optsCore.inc @@ -1,7 +1,14 @@ {$DEFINE MYPY} //{$DEFINE DGL} //for DGL library, otherwise gl/glext {$DEFINE FASTGZ} +//There are 3 modes +// DEFINED COREGL : uses "modern" OpenGL 3.3 for most efficient use of resources (most efficient) +// NOT COREGL, DEFINED LEGACY_INDEXING : uses indexed vertices and glDrawElements (medium efficiency) +// NOT COREGL, NOT LEGACY_INDEXING : glCallList with redundant vertices (least efficient) + {$DEFINE COREGL} +{$DEFINE LEGACY_INDEXING} +{$DEFINE GEOM_GLEXT} //{$DEFINE HEMISSAO} //for hemispherical SSAO - requires shaders that save surface normal - see hemiAO3 and hemiAO {$DEFINE CTM} //support OpenCTM format, requires LZMA decoding //{$DEFINE TUBES} diff --git a/prefs.pas b/prefs.pas index e18b8bb..1425a7a 100755 --- a/prefs.pas +++ b/prefs.pas @@ -22,7 +22,8 @@ TPrefs = record //ObjectBasedClipPlane, SmoothVoxelwiseData, OverlayClip, StartupScript, SupportBetterRenderQuality, AdditiveOverlay,Perspective, OrientCube, MultiSample, BlackDefaultBackground, Colorbar,TracksAreTubes, ScreenCaptureTransparentBackground,LoadTrackOnLaunch,ColorBarPrecedenceTracksNotOverlays,HideDarkTracks, HideBrightTracks, - OverlappingOverlaysOverwrite, ZDimIsUp, ShaderForBackgroundOnly, CoreTrackDisableDepth, SkipPrefWriting, isFlipMeshOverlay, DarkMode, RetinaDisplay, GenerateSmoothCurves : boolean; + OverlappingOverlaysOverwrite, ZDimIsUp, ShaderForBackgroundOnly, CoreTrackDisableDepth, SkipPrefWriting, isFlipMeshOverlay, DarkMode, + RetinaDisplay, GenerateSmoothCurves {$IFDEF LINX}, isMesaWarned {$ENDIF} : boolean; TrackTubeSlices, ScreenCaptureZoom,ColorbarColor,ColorBarPosition, window_width, window_height, RenderQuality, StartupWindowMode, @@ -299,6 +300,7 @@ procedure SetDefaultPrefs (var lPrefs: TPrefs; lEverything, askUserIfMissing: b with lPrefs do begin //CrossHairs := true; ColorbarSize := 0.035; + {$IFDEF LINUX}isMesaWarned := false; {$ENDIF} StartupWindowMode := 0; ObjColor := RGBToColor(212, 168, 168); BackColor := RGBToColor(0, 0, 0); @@ -646,6 +648,7 @@ function IniFile(lRead: boolean; lFilename: string; var lPrefs: TPrefs): boolean IniBool(lRead,lIniFile, 'Perspective',lPrefs.Perspective); IniBool(lRead,lIniFile, 'AdditiveOverlay',lPrefs.AdditiveOverlay); IniBool(lRead,lIniFile, 'StartupScript',lPrefs.StartupScript); + {$IFDEF LINUX}IniBool(lRead,lIniFile, 'MesaWarned', lPrefs.isMesaWarned);{$ENDIF} //IniBool(lRead,lIniFile, 'ObjectBasedClipPlane',lPrefs.ObjectBasedClipPlane); {$IFDEF LCLCocoa} IniBool(lRead,lIniFile, 'RetinaDisplay',lPrefs.RetinaDisplay); diff --git a/shaderu.pas b/shaderu.pas index a9ec033..5661bc7 100755 --- a/shaderu.pas +++ b/shaderu.pas @@ -71,7 +71,7 @@ procedure freeFrame (var f : TFrameBuffer); //procedure Set2DDraw (w,h: integer; r,g,b: byte); implementation -uses mainunit, shaderui; +uses {$IFDEF LINUX} prefs, {$ENDIF} mainunit, shaderui; {$IFDEF COREGL} const kVert2D ='#version 330' @@ -953,7 +953,15 @@ function InitGLSL (isStartUp: boolean): boolean; {$ENDIF} {$ENDIF} {$ENDIF} - gShader.Vendor := glGetString(GL_VENDOR)+' :: OpenGL '+glGetString(GL_VERSION)+' :: GLSL ' +glGetString(GL_SHADING_LANGUAGE_VERSION); + gShader.Vendor := glGetString(GL_VERSION); + {$IFDEF LINUX} + if AnsiContainsText(gShader.Vendor,'MESA') then begin + writeln('Mesa driver detected. If you observe artifacts set "Quality: Poor" in the Preferences window.'); + if not gPrefs.isMesaWarned then + gPrefs.RenderQuality := min(kRenderPoor, gPrefs.RenderQuality); + end; + {$ENDIF} + gShader.Vendor := glGetString(GL_VENDOR)+' :: OpenGL '+gShader.Vendor+' :: GLSL ' +glGetString(GL_SHADING_LANGUAGE_VERSION); gShader.program2d := initVertFrag(kVert2D, '', kFrag2D); gShader.program3dx := initVertFrag(kVert3d, '', kFrag3d); gShader.programDefault := initVertFrag(kVert3d, '', kFrag3d); @@ -1222,7 +1230,6 @@ procedure RunTrackGLSL (lineWidth, ScreenPixelX, ScreenPixelY: integer; isTubes: begin glUseProgram(gShader.programTrackID); SetTrackUniforms (lineWidth, ScreenPixelX, ScreenPixelY); - {$IFDEF COREGL} {$ELSE} {$IFDEF LEGACY_INDEXING} diff --git a/surfice.lps b/surfice.lps index 6a4c482..603e289 100644 --- a/surfice.lps +++ b/surfice.lps @@ -18,8 +18,8 @@ - - + + @@ -45,9 +45,9 @@ - - - + + + @@ -69,10 +69,11 @@ - - - - + + + + + @@ -125,7 +126,7 @@ - + @@ -134,9 +135,10 @@ - - - + + + + @@ -160,19 +162,18 @@ - - + - + - + - + @@ -251,7 +252,7 @@ - + @@ -260,7 +261,7 @@ - + @@ -273,152 +274,152 @@ - + - + - + - + - + - + - - + + - - + + - + - + - - + + - + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/track.pas b/track.pas index 7c659b3..d2329fb 100644 --- a/track.pas +++ b/track.pas @@ -753,7 +753,7 @@ procedure TTrack.DrawGL; vertLoc := glGetAttribLocation(gShader.programTrackIdxID , 'Vert'); normLoc := glGetAttribLocation(gShader.programTrackIdxID, 'Norm'); clrLoc := glGetAttribLocation(gShader.programTrackIdxID, 'Clr'); - writeln(format('%d %d %d %d', [vertLoc, normLoc, clrLoc, n_faces])); + //writeln(format('%d %d %d %d', [vertLoc, normLoc, clrLoc, n_faces])); glEnableVertexAttribArray(vertLoc);//v position glEnableVertexAttribArray(normLoc);//n normal glEnableVertexAttribArray(clrLoc);//c color