summaryrefslogtreecommitdiffstats
path: root/src/gl3_impl.zig
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2021-03-25 18:19:41 +0000
committers-ol <s+removethis@s-ol.nu>2021-03-25 18:19:41 +0000
commit05eb0d1ecbe4b438f8323d3261102c58341f60cf (patch)
tree118422ff1141e5f6eaf61d8b546e4647352dc998 /src/gl3_impl.zig
parentzig-fmt everything (diff)
downloadzig-imgui-05eb0d1ecbe4b438f8323d3261102c58341f60cf.tar.gz
zig-imgui-05eb0d1ecbe4b438f8323d3261102c58341f60cf.zip
update for zig 0.7.0
Diffstat (limited to 'src/gl3_impl.zig')
-rw-r--r--src/gl3_impl.zig60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/gl3_impl.zig b/src/gl3_impl.zig
index b056056..27212ff 100644
--- a/src/gl3_impl.zig
+++ b/src/gl3_impl.zig
@@ -26,7 +26,7 @@ var g_ElementsHandle: c.GLuint = 0;
pub fn Init() void {
const io = c.igGetIO();
- io.*.BackendRendererName = c"imgui_impl_gl3.zig";
+ io.*.BackendRendererName = "imgui_impl_gl3.zig";
if (OpenGLHasDrawWithBaseVertex)
io.*.BackendFlags |= @enumToInt(c.ImGuiBackendFlags_RendererHasVtxOffset);
// @TODO: Viewports
@@ -74,31 +74,31 @@ fn CreateDeviceObjects() !void {
// @TODO: GLSL versions?
const vertex_shader_glsl: [*]const c.GLchar =
- c\\#version 150
- c\\uniform mat4 ProjMtx;
- c\\in vec2 Position;
- c\\in vec2 UV;
- c\\in vec4 Color;
- c\\out vec2 Frag_UV;
- c\\out vec4 Frag_Color;
- c\\void main()
- c\\{
- c\\ Frag_UV = UV;
- c\\ Frag_Color = Color;
- c\\ gl_Position = ProjMtx * vec4(Position.xy, 0, 1);
- c\\}
+ \\#version 150
+ \\uniform mat4 ProjMtx;
+ \\in vec2 Position;
+ \\in vec2 UV;
+ \\in vec4 Color;
+ \\out vec2 Frag_UV;
+ \\out vec4 Frag_Color;
+ \\void main()
+ \\{
+ \\ Frag_UV = UV;
+ \\ Frag_Color = Color;
+ \\ gl_Position = ProjMtx * vec4(Position.xy, 0, 1);
+ \\}
;
const fragment_shader_glsl: [*]const c.GLchar =
- c\\#version 150
- c\\uniform sampler2D Texture;
- c\\in vec2 Frag_UV;
- c\\in vec4 Frag_Color;
- c\\out vec4 Out_Color;
- c\\void main()
- c\\{
- c\\ Out_Color = Frag_Color * texture(Texture, Frag_UV.st);
- c\\}
+ \\#version 150
+ \\uniform sampler2D Texture;
+ \\in vec2 Frag_UV;
+ \\in vec4 Frag_Color;
+ \\out vec4 Out_Color;
+ \\void main()
+ \\{
+ \\ Out_Color = Frag_Color * texture(Texture, Frag_UV.st);
+ \\}
;
// Create shaders / programs
@@ -118,11 +118,11 @@ fn CreateDeviceObjects() !void {
c.glLinkProgram(g_ShaderHandle);
try CheckThing(.Program, g_ShaderHandle, "shader program");
- g_AttribLocationTex = c.glGetUniformLocation(g_ShaderHandle, c"Texture");
- g_AttribLocationProjMtx = c.glGetUniformLocation(g_ShaderHandle, c"ProjMtx");
- g_AttribLocationVtxPos = c.glGetAttribLocation(g_ShaderHandle, c"Position");
- g_AttribLocationVtxUV = c.glGetAttribLocation(g_ShaderHandle, c"UV");
- g_AttribLocationVtxColor = c.glGetAttribLocation(g_ShaderHandle, c"Color");
+ g_AttribLocationTex = c.glGetUniformLocation(g_ShaderHandle, "Texture");
+ g_AttribLocationProjMtx = c.glGetUniformLocation(g_ShaderHandle, "ProjMtx");
+ g_AttribLocationVtxPos = c.glGetAttribLocation(g_ShaderHandle, "Position");
+ g_AttribLocationVtxUV = c.glGetAttribLocation(g_ShaderHandle, "UV");
+ g_AttribLocationVtxColor = c.glGetAttribLocation(g_ShaderHandle, "Color");
// Create buffers
c.glGenBuffers(1, &g_VboHandle);
@@ -155,11 +155,11 @@ fn CheckThing(comptime thingType: CheckableThing, handle: c.GLuint, desc: []cons
var buf: [1024]u8 = undefined;
var length: c.GLsizei = undefined;
getInfoLogFunc(handle, buf.len, &length, &buf[0]);
- debug.warn("{}\n", buf[0..@intCast(usize, length)]);
+ debug.warn("{}\n", .{buf[0..@intCast(usize, length)]});
}
if (@intCast(c.GLboolean, status) == c.GL_FALSE) {
- debug.warn("ERROR: CreateDeviceObjects: failed to compile/link {}! (with GLSL '{}')\n", desc, g_GlslVersionString);
+ debug.warn("ERROR: CreateDeviceObjects: failed to compile/link {}! (with GLSL '{}')\n", .{ desc, g_GlslVersionString });
return error.ShaderLinkError;
}
}