forked from adamredwoods/minib3d-monkey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
thardwareinfo.monkey
132 lines (113 loc) · 4.59 KB
/
thardwareinfo.monkey
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
' ----- TO DO ------
' By klepto2
Class THardwareInfo
Global ScreenWidth : Int
Global ScreenHeight : Int
Global ScreenDepth : Int
Global ScreenHertz : Int
Global Vendor : String
Global Renderer : String
Global OGLVersion : String
Global Extensions : String
Global VBOSupport : Int ' Vertex Buffer Object
Global GLTCSupport : Int ' OpenGL's TextureCompression
Global S3TCSupport : Int ' S3's TextureCompression
Global AnIsoSupport : Int ' An-Istropic Filtering
Global MultiTexSupport : Int ' MultiTexturing
Global TexBlendSupport : Int ' TextureBlend
Global CubemapSupport : Int ' CubeMapping
Global DepthmapSupport : Int ' DepthTexturing
Global VPSupport : Int ' VertexProgram (ARBvp1.0)
Global FPSupport : Int ' FragmentProgram (ARBfp1.0)
Global ShaderSupport : Int ' glSlang Shader Program
Global VSSupport : Int ' glSlang VertexShader
Global FSSupport : Int ' glSlang FragmentShader
Global SLSupport : Int ' OpenGL Shading Language 1.00
Global MaxTextures : Int
Global MaxTexSize : Int
Global MaxLights : Int
Function GetInfo()
Local Extensions:String
' Get HardwareInfo
Vendor = String.FromCString(Byte Ptr(glGetString(GL_VENDOR)))
Renderer = String.FromCString(Byte Ptr(glGetString(GL_RENDERER)))
OGLVersion = String.FromCString(Byte Ptr(glGetString(GL_VERSION)))
' Get Extensions
Extensions = String.FromCString(Byte Ptr(glGetString(GL_EXTENSIONS)))
THardwareInfo.Extensions = Extensions
' Check for Extensions
THardwareInfo.VBOSupport = Extensions.Find("GL_ARB_vertex_buffer_object") > -1
THardwareInfo.GLTCSupport = Extensions.Find("GL_ARB_texture_compression")
THardwareInfo.S3TCSupport = Extensions.Find("GL_EXT_texture_compression_s3tc") > -1
THardwareInfo.AnIsoSupport = Extensions.Find("GL_EXT_texture_filter_anisotropic")
THardwareInfo.MultiTexSupport = Extensions.Find("GL_ARB_multitexture") > -1
THardwareInfo.TexBlendSupport = Extensions.Find("GL_EXT_texture_env_combine") > -1
THardwareInfo.CubemapSupport = Extensions.Find("GL_ARB_texture_cube_map") > -1
THardwareInfo.DepthmapSupport = Extensions.Find("GL_ARB_depth_texture") > -1
THardwareInfo.VPSupport = Extensions.Find("GL_ARB_vertex_program") > -1
THardwareInfo.FPSupport = Extensions.Find("GL_ARB_fragment_program") > -1
THardwareInfo.ShaderSupport = Extensions.Find("GL_ARB_shader_objects") > -1
THardwareInfo.VSSupport = Extensions.Find("GL_ARB_vertex_shader") > -1
THardwareInfo.FSSupport = Extensions.Find("GL_ARB_fragment_shader") > -1
THardwareInfo.SLSupport = Extensions.Find("GL_ARB_shading_language_100") > - 1
If THardwareInfo.VSSupport = False Or THardwareInfo.FSSupport = False Then
THardwareInfo.ShaderSupport = False
Endif
' Get some numerics
glGetIntegerv(GL_MAX_TEXTURE_UNITS, Varptr(THardwareInfo.MaxTextures))
glGetIntegerv(GL_MAX_TEXTURE_SIZE, Varptr(THardwareInfo.MaxTexSize))
glGetIntegerv(GL_MAX_LIGHTS, Varptr(THardwareInfo.MaxLights))
End
Function DisplayInfo(LogFile:Int=False)
Local position:Int, Space:Int, stream:TStream
If LogFile Then
stream = WriteStream("MiniB3DLog.txt")
stream.WriteLine("MiniB3D Hardwareinfo:")
stream.WriteLine("")
' Display Driverinfo
stream.WriteLine("Vendor: "+Vendor)
stream.WriteLine("Renderer: "+Renderer)
stream.WriteLine("OpenGL-Version: "+OGLVersion)
stream.WriteLine("")
' Display Hardwareranges
stream.WriteLine("Max Texture Units: "+MaxTextures)
stream.WriteLine("Max Texture Size: "+MaxTexSize)
stream.WriteLine("Max Lights: "+MaxLights)
stream.WriteLine("")
' Display OpenGL-Extensions
stream.WriteLine("OpenGL Extensions:")
While position < Extensions.length
Space = Extensions.Find(" ", position)
If Space = -1 Then Exit
stream.WriteLine(Extensions[position..Space])
position = Space+1
Wend
stream.WriteLine("")
stream.WriteLine("- Ready -")
stream.Close()
Else
Print("MiniB3D Hardwareinfo:")
Print("")
' Display Driverinfo
Print("Vendor: "+Vendor)
Print("Renderer: "+Renderer)
Print("OpenGL-Version: "+OGLVersion)
Print("")
' Display Hardwareranges
Print("Max Texture Units: "+MaxTextures)
Print("Max Texture Size: "+MaxTexSize)
Print("Max Lights: "+MaxLights)
Print("")
' Display OpenGL-Extensions
Print("OpenGL Extensions:")
While position < Extensions.length
Space = Extensions.Find(" ", position)
If Space = -1 Then Exit
Print(Extensions[position..Space])
position = Space+1
Wend
Print("")
Print("- Ready -")
Endif
End
End