-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathglinformation.dpr
More file actions
119 lines (105 loc) · 4.3 KB
/
glinformation.dpr
File metadata and controls
119 lines (105 loc) · 4.3 KB
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
{
Copyright 2002-2014 Michalis Kamburelis.
This file is part of "glinformation".
"glinformation" is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"glinformation" is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with "glinformation"; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
----------------------------------------------------------------------------
}
{ Print OpenGL information.
See [https://castle-engine.io/glinformation.php]. }
program glinformation;
{$apptype CONSOLE}
uses CastleWindow, SysUtils, CastleUtils, CastleGLUtils, CastleParameters,
CastleFilesUtils, CastleLog, CastleApplicationProperties;
var
Window: TCastleWindow;
const
Version = '1.3.0';
Options: array[0..11] of TOption =
(
(Short: 'h'; Long: 'help'; Argument: oaNone),
(Short: 's'; Long: 'stencil-bits'; Argument: oaRequired),
(Short: 'a'; Long: 'alpha-bits'; Argument: oaRequired),
(Short: 'd'; Long: 'depth-bits'; Argument: oaRequired),
(Short: #0; Long: 'single'; Argument: oaNone),
(Short: #0; Long: 'double'; Argument: oaNone),
(Short: 'v'; Long: 'version'; Argument: oaNone),
(Short: 'm'; Long: 'multi-sampling'; Argument: oaRequired),
(Short: #0; Long: 'red-bits'; Argument: oaRequired),
(Short: #0; Long: 'green-bits'; Argument: oaRequired),
(Short: #0; Long: 'blue-bits'; Argument: oaRequired),
(Short: #0; Long: 'debug-log'; Argument: oaNone)
);
procedure OptionProc(OptionNum: Integer; HasArgument: boolean;
const Argument: string; const SeparateArgs: TSeparateArgs; Data: Pointer);
begin
case OptionNum of
0: begin
Writeln(
'glinformation: OpenGL information,' +nl+
' a small program that creates OpenGL context and uses it to query' +nl+
' OpenGL implementation about many things. Results are output to stdout.' +nl+
nl+
'Available options:' +nl+
HelpOptionHelp +nl+
VersionOptionHelp +nl+
nl+
'Options requesting that OpenGL context be created with certain' +nl+
' minimum values:' +nl+
' -s / --stencil-bits STENCIL-BUFFER-BIT-SIZE' +nl+
' -a / --alpha-bits ALPHA-CHANNEL-BIT-SIZE' +nl+
' -d / --depth-bits DEPTH-BUFFER-BIT-SIZE' +nl+
' -m / --multi-sampling SAMPLES (1 means "no multisampling")' +nl+
' --red-bits BIT' +nl+
' --green-bits BIT' +nl+
' --blue-bits BIT' +nl+
'Other options controlling OpenGL context parameters:' +nl+
' --single Single buffered visual (note: we might get' +nl+
' double buffered anyway)' +nl+
' --double Double buffered visual (default)' +nl+
nl+
TCastleWindow.ParseParametersHelp +nl+
nl+
SCastleEngineProgramHelpSuffix(ApplicationName, Version, true));
Halt;
end;
1: Window.StencilBits := StrToInt(Argument);
2: Window.AlphaBits := StrToInt(Argument);
3: Window.DepthBits := StrToInt(Argument);
4: Window.DoubleBuffer := false;
5: Window.DoubleBuffer := true;
6: begin
Writeln(Version);
Halt;
end;
7: Window.MultiSampling := StrToInt(Argument);
8: Window.RedBits := StrToInt(Argument);
9: Window.GreenBits := StrToInt(Argument);
10: Window.BlueBits := StrToInt(Argument);
11: InitializeLog;
else EInternalError.Create('OptionProc');
end;
end;
begin
ApplicationProperties.Version := Version;
Window := TCastleWindow.Create(Application);
Window.Visible := false;
{ parse params }
Window.ParseParameters;
Parameters.Parse(Options, @OptionProc, nil);
if Parameters.High <> 0 then
raise EInvalidParams.CreateFmt('Excessive parameter "%s"', [Parameters[1]]);
Window.Open;
try
Writeln(GLInformationString);
finally Window.Close end;
end.