forked from QUItCoding/qnanopainter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qtfy_nanovg_gl.pl
executable file
·79 lines (74 loc) · 1.65 KB
/
qtfy_nanovg_gl.pl
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
#!/usr/bin/perl -w
#
# This script reads "nanovg_gl.h", adds "QNANO_GLFWRAPPER" prefix
# into every OpenGL command and outputs "nanovg_gl_wrapped.h".
#
# QNANO_GLFWRAPPER can then be replaced with a define, in QNanoPainter
# case "glf->" which is QOpenGLFunctions so Qt can do GL resolving.
use strict;
# Array of all OpenGL commands
# used in NanoVG
my @gl_commands = (
"glCreateProgram",
"glCreateShader",
"glShaderSource",
"glCompileShader",
"glGetShaderiv",
"glAttachShader",
"glBindAttribLocation",
"glLinkProgram",
"glGetProgramiv",
"glDeleteProgram",
"glDeleteShader",
"glGetUniformLocation",
"glGetUniformBlockIndex",
"glGenVertexArrays",
"glGenBuffers",
"glUniformBlockBinding",
"glGetIntegerv",
"glFinish",
"glGenTextures",
"glPixelStorei",
"glTexParameteri",
"glTexImage2D",
"glGenerateMipmap",
"glTexSubImage2D",
"glUniform4fv",
"glEnable",
"glColorMask",
"glDisable",
"glDrawArrays",
"glStencilOp",
"glUseProgram",
"glCullFace",
"glFrontFace",
"glStencilMask",
"glStencilFunc",
"glActiveTexture",
"glBindTexture",
"glBindBuffer",
"glBufferData",
"glBindVertexArray",
"glVertexAttribPointer",
"glUniform1i",
"glDeleteBuffers",
"glDeleteVertexArrays",
"glDeleteTextures",
"glGetProgramInfoLog",
"glGetShaderInfoLog",
"glBlendFuncSeparate",
"glGetError"
);
open(FILE, "<libqnanopainter/nanovg/nanovg_gl.h") || die "File not found";
my @lines = <FILE>;
close(FILE);
my @newlines;
foreach(@lines) {
foreach my $command (@gl_commands) {
$_ =~ s/$command/QNANO_GLFWRAPPER $command/g;
}
push(@newlines,$_);
}
open(FILE, "> libqnanopainter/nanovg/nanovg_gl_wrapped.h") || die "File not found";
print FILE @newlines;
close(FILE);