-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
140 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* State.cs - OpenGL state | ||
* | ||
* Copyright (C) 2018-2019 Robert Schneckenhaus <[email protected]> | ||
* Copyright (C) 2018-2023 Robert Schneckenhaus <[email protected]> | ||
* | ||
* This file is part of freeserf.net. freeserf.net is based on freeserf. | ||
* | ||
|
@@ -19,6 +19,7 @@ | |
* along with freeserf.net. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
using Silk.NET.Core.Contexts; | ||
using Silk.NET.OpenGL; | ||
using System; | ||
using System.Collections.Generic; | ||
|
@@ -28,19 +29,19 @@ namespace Freeserf.Renderer | |
{ | ||
public static class State | ||
{ | ||
public static readonly int OpenGLVersionMajor = 0; | ||
public static readonly int OpenGLVersionMinor = 0; | ||
public static readonly int GLSLVersionMajor = 0; | ||
public static readonly int GLSLVersionMinor = 0; | ||
public static readonly GL Gl = null; | ||
public static int OpenGLVersionMajor { get; private set; } = 0; | ||
public static int OpenGLVersionMinor { get; private set; } = 0; | ||
public static int GLSLVersionMajor { get; private set; } = 0; | ||
public static int GLSLVersionMinor { get; private set; } = 0; | ||
public static GL Gl { get; private set; } = null; | ||
|
||
static State() | ||
public static void Init(IGLContextSource contextSource) | ||
{ | ||
Gl = GL.GetApi(); | ||
Gl = GL.GetApi(contextSource); | ||
|
||
var openGLVersion = Gl.GetString(StringName.Version).TrimStart(); | ||
var openGLVersion = Gl.GetStringS(StringName.Version).TrimStart(); | ||
|
||
Regex versionRegex = new Regex(@"([0-9]+)\.([0-9]+)", RegexOptions.Compiled); | ||
Regex versionRegex = new(@"([0-9]+)\.([0-9]+)", RegexOptions.Compiled); | ||
|
||
var match = versionRegex.Match(openGLVersion); | ||
|
||
|
@@ -54,7 +55,7 @@ static State() | |
|
||
if (OpenGLVersionMajor >= 2) // glsl is supported since OpenGL 2.0 | ||
{ | ||
var glslVersion = Gl.GetString(StringName.ShadingLanguageVersion); | ||
var glslVersion = Gl.GetStringS(StringName.ShadingLanguageVersion); | ||
|
||
match = versionRegex.Match(glslVersion); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.