feat(platform): draw fullscreen triangle instead of quad

This commit is contained in:
Rekai Nyangadzayi Musuka 2023-09-04 23:11:18 -05:00
parent 4c57f0b5f4
commit 0c6f710822
5 changed files with 385 additions and 452 deletions

View File

@ -12,22 +12,14 @@
// //
// This file was generated with the following command line: // This file was generated with the following command line:
// generator C:\Users\paoda\dev\open\zig-opengl\bin\Debug\net6.0\generator.dll .\OpenGL-Registry\xml\gl.xml gl.zig GL_VERSION_3_3 // generator /home/paoda/dev/open/zig-opengl/bin/Debug/net6.0/generator.dll OpenGL-Registry/xml/gl.xml gl.zig GL_VERSION_3_3
// //
const std = @import("std"); const std = @import("std");
const builtin = @import("builtin"); const builtin = @import("builtin");
const log = std.log.scoped(.OpenGL); const log = std.log.scoped(.OpenGL);
pub const FunctionPointer: type = blk: { pub const FunctionPointer: type = *align(@alignOf(fn (u32) callconv(.C) u32)) const anyopaque;
const BaseFunc = fn (u32) callconv(.C) u32;
const SpecializedFnPtr = FnPtr(BaseFunc);
const fnptr_type = @typeInfo(SpecializedFnPtr);
var generic_type = fnptr_type;
std.debug.assert(generic_type.Pointer.size == .One);
generic_type.Pointer.child = anyopaque;
break :blk @Type(generic_type);
};
pub const GLenum = c_uint; pub const GLenum = c_uint;
pub const GLboolean = u8; pub const GLboolean = u8;
@ -68,23 +60,16 @@ pub const GLsync = *opaque {};
pub const _cl_context = opaque {}; pub const _cl_context = opaque {};
pub const _cl_event = opaque {}; pub const _cl_event = opaque {};
pub const GLDEBUGPROC = FnPtr(fn (source: GLenum, _type: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: [*:0]const u8, userParam: ?*anyopaque) callconv(.C) void); pub const GLDEBUGPROC = *const fn (source: GLenum, _type: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: [*:0]const u8, userParam: ?*anyopaque) callconv(.C) void;
pub const GLDEBUGPROCARB = FnPtr(fn (source: GLenum, _type: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: [*:0]const u8, userParam: ?*anyopaque) callconv(.C) void); pub const GLDEBUGPROCARB = *const fn (source: GLenum, _type: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: [*:0]const u8, userParam: ?*anyopaque) callconv(.C) void;
pub const GLDEBUGPROCKHR = FnPtr(fn (source: GLenum, _type: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: [*:0]const u8, userParam: ?*anyopaque) callconv(.C) void); pub const GLDEBUGPROCKHR = *const fn (source: GLenum, _type: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: [*:0]const u8, userParam: ?*anyopaque) callconv(.C) void;
pub const GLDEBUGPROCAMD = FnPtr(fn (id: GLuint, category: GLenum, severity: GLenum, length: GLsizei, message: [*:0]const u8, userParam: ?*anyopaque) callconv(.C) void); pub const GLDEBUGPROCAMD = *const fn (id: GLuint, category: GLenum, severity: GLenum, length: GLsizei, message: [*:0]const u8, userParam: ?*anyopaque) callconv(.C) void;
pub const GLhalfNV = u16; pub const GLhalfNV = u16;
pub const GLvdpauSurfaceNV = GLintptr; pub const GLvdpauSurfaceNV = GLintptr;
pub const GLVULKANPROCNV = *const fn () callconv(.C) void; pub const GLVULKANPROCNV = *const fn () callconv(.C) void;
fn FnPtr(comptime Fn: type) type {
return if (@import("builtin").zig_backend != .stage1)
*const Fn
else
Fn;
}
pub const DEPTH_BUFFER_BIT = 0x00000100; pub const DEPTH_BUFFER_BIT = 0x00000100;
pub const STENCIL_BUFFER_BIT = 0x00000400; pub const STENCIL_BUFFER_BIT = 0x00000400;
pub const COLOR_BUFFER_BIT = 0x00004000; pub const COLOR_BUFFER_BIT = 0x00004000;
@ -4700,350 +4685,350 @@ const function_signatures = struct {
}; };
const function_pointers = struct { const function_pointers = struct {
var glCullFace: FnPtr(function_signatures.glCullFace) = undefined; var glCullFace: *const function_signatures.glCullFace = undefined;
var glFrontFace: FnPtr(function_signatures.glFrontFace) = undefined; var glFrontFace: *const function_signatures.glFrontFace = undefined;
var glHint: FnPtr(function_signatures.glHint) = undefined; var glHint: *const function_signatures.glHint = undefined;
var glLineWidth: FnPtr(function_signatures.glLineWidth) = undefined; var glLineWidth: *const function_signatures.glLineWidth = undefined;
var glPointSize: FnPtr(function_signatures.glPointSize) = undefined; var glPointSize: *const function_signatures.glPointSize = undefined;
var glPolygonMode: FnPtr(function_signatures.glPolygonMode) = undefined; var glPolygonMode: *const function_signatures.glPolygonMode = undefined;
var glScissor: FnPtr(function_signatures.glScissor) = undefined; var glScissor: *const function_signatures.glScissor = undefined;
var glTexParameterf: FnPtr(function_signatures.glTexParameterf) = undefined; var glTexParameterf: *const function_signatures.glTexParameterf = undefined;
var glTexParameterfv: FnPtr(function_signatures.glTexParameterfv) = undefined; var glTexParameterfv: *const function_signatures.glTexParameterfv = undefined;
var glTexParameteri: FnPtr(function_signatures.glTexParameteri) = undefined; var glTexParameteri: *const function_signatures.glTexParameteri = undefined;
var glTexParameteriv: FnPtr(function_signatures.glTexParameteriv) = undefined; var glTexParameteriv: *const function_signatures.glTexParameteriv = undefined;
var glTexImage1D: FnPtr(function_signatures.glTexImage1D) = undefined; var glTexImage1D: *const function_signatures.glTexImage1D = undefined;
var glTexImage2D: FnPtr(function_signatures.glTexImage2D) = undefined; var glTexImage2D: *const function_signatures.glTexImage2D = undefined;
var glDrawBuffer: FnPtr(function_signatures.glDrawBuffer) = undefined; var glDrawBuffer: *const function_signatures.glDrawBuffer = undefined;
var glClear: FnPtr(function_signatures.glClear) = undefined; var glClear: *const function_signatures.glClear = undefined;
var glClearColor: FnPtr(function_signatures.glClearColor) = undefined; var glClearColor: *const function_signatures.glClearColor = undefined;
var glClearStencil: FnPtr(function_signatures.glClearStencil) = undefined; var glClearStencil: *const function_signatures.glClearStencil = undefined;
var glClearDepth: FnPtr(function_signatures.glClearDepth) = undefined; var glClearDepth: *const function_signatures.glClearDepth = undefined;
var glStencilMask: FnPtr(function_signatures.glStencilMask) = undefined; var glStencilMask: *const function_signatures.glStencilMask = undefined;
var glColorMask: FnPtr(function_signatures.glColorMask) = undefined; var glColorMask: *const function_signatures.glColorMask = undefined;
var glDepthMask: FnPtr(function_signatures.glDepthMask) = undefined; var glDepthMask: *const function_signatures.glDepthMask = undefined;
var glDisable: FnPtr(function_signatures.glDisable) = undefined; var glDisable: *const function_signatures.glDisable = undefined;
var glEnable: FnPtr(function_signatures.glEnable) = undefined; var glEnable: *const function_signatures.glEnable = undefined;
var glFinish: FnPtr(function_signatures.glFinish) = undefined; var glFinish: *const function_signatures.glFinish = undefined;
var glFlush: FnPtr(function_signatures.glFlush) = undefined; var glFlush: *const function_signatures.glFlush = undefined;
var glBlendFunc: FnPtr(function_signatures.glBlendFunc) = undefined; var glBlendFunc: *const function_signatures.glBlendFunc = undefined;
var glLogicOp: FnPtr(function_signatures.glLogicOp) = undefined; var glLogicOp: *const function_signatures.glLogicOp = undefined;
var glStencilFunc: FnPtr(function_signatures.glStencilFunc) = undefined; var glStencilFunc: *const function_signatures.glStencilFunc = undefined;
var glStencilOp: FnPtr(function_signatures.glStencilOp) = undefined; var glStencilOp: *const function_signatures.glStencilOp = undefined;
var glDepthFunc: FnPtr(function_signatures.glDepthFunc) = undefined; var glDepthFunc: *const function_signatures.glDepthFunc = undefined;
var glPixelStoref: FnPtr(function_signatures.glPixelStoref) = undefined; var glPixelStoref: *const function_signatures.glPixelStoref = undefined;
var glPixelStorei: FnPtr(function_signatures.glPixelStorei) = undefined; var glPixelStorei: *const function_signatures.glPixelStorei = undefined;
var glReadBuffer: FnPtr(function_signatures.glReadBuffer) = undefined; var glReadBuffer: *const function_signatures.glReadBuffer = undefined;
var glReadPixels: FnPtr(function_signatures.glReadPixels) = undefined; var glReadPixels: *const function_signatures.glReadPixels = undefined;
var glGetBooleanv: FnPtr(function_signatures.glGetBooleanv) = undefined; var glGetBooleanv: *const function_signatures.glGetBooleanv = undefined;
var glGetDoublev: FnPtr(function_signatures.glGetDoublev) = undefined; var glGetDoublev: *const function_signatures.glGetDoublev = undefined;
var glGetError: FnPtr(function_signatures.glGetError) = undefined; var glGetError: *const function_signatures.glGetError = undefined;
var glGetFloatv: FnPtr(function_signatures.glGetFloatv) = undefined; var glGetFloatv: *const function_signatures.glGetFloatv = undefined;
var glGetIntegerv: FnPtr(function_signatures.glGetIntegerv) = undefined; var glGetIntegerv: *const function_signatures.glGetIntegerv = undefined;
var glGetString: FnPtr(function_signatures.glGetString) = undefined; var glGetString: *const function_signatures.glGetString = undefined;
var glGetTexImage: FnPtr(function_signatures.glGetTexImage) = undefined; var glGetTexImage: *const function_signatures.glGetTexImage = undefined;
var glGetTexParameterfv: FnPtr(function_signatures.glGetTexParameterfv) = undefined; var glGetTexParameterfv: *const function_signatures.glGetTexParameterfv = undefined;
var glGetTexParameteriv: FnPtr(function_signatures.glGetTexParameteriv) = undefined; var glGetTexParameteriv: *const function_signatures.glGetTexParameteriv = undefined;
var glGetTexLevelParameterfv: FnPtr(function_signatures.glGetTexLevelParameterfv) = undefined; var glGetTexLevelParameterfv: *const function_signatures.glGetTexLevelParameterfv = undefined;
var glGetTexLevelParameteriv: FnPtr(function_signatures.glGetTexLevelParameteriv) = undefined; var glGetTexLevelParameteriv: *const function_signatures.glGetTexLevelParameteriv = undefined;
var glIsEnabled: FnPtr(function_signatures.glIsEnabled) = undefined; var glIsEnabled: *const function_signatures.glIsEnabled = undefined;
var glDepthRange: FnPtr(function_signatures.glDepthRange) = undefined; var glDepthRange: *const function_signatures.glDepthRange = undefined;
var glViewport: FnPtr(function_signatures.glViewport) = undefined; var glViewport: *const function_signatures.glViewport = undefined;
var glDrawArrays: FnPtr(function_signatures.glDrawArrays) = undefined; var glDrawArrays: *const function_signatures.glDrawArrays = undefined;
var glDrawElements: FnPtr(function_signatures.glDrawElements) = undefined; var glDrawElements: *const function_signatures.glDrawElements = undefined;
var glPolygonOffset: FnPtr(function_signatures.glPolygonOffset) = undefined; var glPolygonOffset: *const function_signatures.glPolygonOffset = undefined;
var glCopyTexImage1D: FnPtr(function_signatures.glCopyTexImage1D) = undefined; var glCopyTexImage1D: *const function_signatures.glCopyTexImage1D = undefined;
var glCopyTexImage2D: FnPtr(function_signatures.glCopyTexImage2D) = undefined; var glCopyTexImage2D: *const function_signatures.glCopyTexImage2D = undefined;
var glCopyTexSubImage1D: FnPtr(function_signatures.glCopyTexSubImage1D) = undefined; var glCopyTexSubImage1D: *const function_signatures.glCopyTexSubImage1D = undefined;
var glCopyTexSubImage2D: FnPtr(function_signatures.glCopyTexSubImage2D) = undefined; var glCopyTexSubImage2D: *const function_signatures.glCopyTexSubImage2D = undefined;
var glTexSubImage1D: FnPtr(function_signatures.glTexSubImage1D) = undefined; var glTexSubImage1D: *const function_signatures.glTexSubImage1D = undefined;
var glTexSubImage2D: FnPtr(function_signatures.glTexSubImage2D) = undefined; var glTexSubImage2D: *const function_signatures.glTexSubImage2D = undefined;
var glBindTexture: FnPtr(function_signatures.glBindTexture) = undefined; var glBindTexture: *const function_signatures.glBindTexture = undefined;
var glDeleteTextures: FnPtr(function_signatures.glDeleteTextures) = undefined; var glDeleteTextures: *const function_signatures.glDeleteTextures = undefined;
var glGenTextures: FnPtr(function_signatures.glGenTextures) = undefined; var glGenTextures: *const function_signatures.glGenTextures = undefined;
var glIsTexture: FnPtr(function_signatures.glIsTexture) = undefined; var glIsTexture: *const function_signatures.glIsTexture = undefined;
var glDrawRangeElements: FnPtr(function_signatures.glDrawRangeElements) = undefined; var glDrawRangeElements: *const function_signatures.glDrawRangeElements = undefined;
var glTexImage3D: FnPtr(function_signatures.glTexImage3D) = undefined; var glTexImage3D: *const function_signatures.glTexImage3D = undefined;
var glTexSubImage3D: FnPtr(function_signatures.glTexSubImage3D) = undefined; var glTexSubImage3D: *const function_signatures.glTexSubImage3D = undefined;
var glCopyTexSubImage3D: FnPtr(function_signatures.glCopyTexSubImage3D) = undefined; var glCopyTexSubImage3D: *const function_signatures.glCopyTexSubImage3D = undefined;
var glActiveTexture: FnPtr(function_signatures.glActiveTexture) = undefined; var glActiveTexture: *const function_signatures.glActiveTexture = undefined;
var glSampleCoverage: FnPtr(function_signatures.glSampleCoverage) = undefined; var glSampleCoverage: *const function_signatures.glSampleCoverage = undefined;
var glCompressedTexImage3D: FnPtr(function_signatures.glCompressedTexImage3D) = undefined; var glCompressedTexImage3D: *const function_signatures.glCompressedTexImage3D = undefined;
var glCompressedTexImage2D: FnPtr(function_signatures.glCompressedTexImage2D) = undefined; var glCompressedTexImage2D: *const function_signatures.glCompressedTexImage2D = undefined;
var glCompressedTexImage1D: FnPtr(function_signatures.glCompressedTexImage1D) = undefined; var glCompressedTexImage1D: *const function_signatures.glCompressedTexImage1D = undefined;
var glCompressedTexSubImage3D: FnPtr(function_signatures.glCompressedTexSubImage3D) = undefined; var glCompressedTexSubImage3D: *const function_signatures.glCompressedTexSubImage3D = undefined;
var glCompressedTexSubImage2D: FnPtr(function_signatures.glCompressedTexSubImage2D) = undefined; var glCompressedTexSubImage2D: *const function_signatures.glCompressedTexSubImage2D = undefined;
var glCompressedTexSubImage1D: FnPtr(function_signatures.glCompressedTexSubImage1D) = undefined; var glCompressedTexSubImage1D: *const function_signatures.glCompressedTexSubImage1D = undefined;
var glGetCompressedTexImage: FnPtr(function_signatures.glGetCompressedTexImage) = undefined; var glGetCompressedTexImage: *const function_signatures.glGetCompressedTexImage = undefined;
var glVertexAttribP4uiv: FnPtr(function_signatures.glVertexAttribP4uiv) = undefined; var glVertexAttribP4uiv: *const function_signatures.glVertexAttribP4uiv = undefined;
var glVertexAttribP4ui: FnPtr(function_signatures.glVertexAttribP4ui) = undefined; var glVertexAttribP4ui: *const function_signatures.glVertexAttribP4ui = undefined;
var glVertexAttribP3uiv: FnPtr(function_signatures.glVertexAttribP3uiv) = undefined; var glVertexAttribP3uiv: *const function_signatures.glVertexAttribP3uiv = undefined;
var glVertexAttribP3ui: FnPtr(function_signatures.glVertexAttribP3ui) = undefined; var glVertexAttribP3ui: *const function_signatures.glVertexAttribP3ui = undefined;
var glVertexAttribP2uiv: FnPtr(function_signatures.glVertexAttribP2uiv) = undefined; var glVertexAttribP2uiv: *const function_signatures.glVertexAttribP2uiv = undefined;
var glVertexAttribP2ui: FnPtr(function_signatures.glVertexAttribP2ui) = undefined; var glVertexAttribP2ui: *const function_signatures.glVertexAttribP2ui = undefined;
var glVertexAttribP1uiv: FnPtr(function_signatures.glVertexAttribP1uiv) = undefined; var glVertexAttribP1uiv: *const function_signatures.glVertexAttribP1uiv = undefined;
var glVertexAttribP1ui: FnPtr(function_signatures.glVertexAttribP1ui) = undefined; var glVertexAttribP1ui: *const function_signatures.glVertexAttribP1ui = undefined;
var glVertexAttribDivisor: FnPtr(function_signatures.glVertexAttribDivisor) = undefined; var glVertexAttribDivisor: *const function_signatures.glVertexAttribDivisor = undefined;
var glGetQueryObjectui64v: FnPtr(function_signatures.glGetQueryObjectui64v) = undefined; var glGetQueryObjectui64v: *const function_signatures.glGetQueryObjectui64v = undefined;
var glGetQueryObjecti64v: FnPtr(function_signatures.glGetQueryObjecti64v) = undefined; var glGetQueryObjecti64v: *const function_signatures.glGetQueryObjecti64v = undefined;
var glQueryCounter: FnPtr(function_signatures.glQueryCounter) = undefined; var glQueryCounter: *const function_signatures.glQueryCounter = undefined;
var glGetSamplerParameterIuiv: FnPtr(function_signatures.glGetSamplerParameterIuiv) = undefined; var glGetSamplerParameterIuiv: *const function_signatures.glGetSamplerParameterIuiv = undefined;
var glGetSamplerParameterfv: FnPtr(function_signatures.glGetSamplerParameterfv) = undefined; var glGetSamplerParameterfv: *const function_signatures.glGetSamplerParameterfv = undefined;
var glGetSamplerParameterIiv: FnPtr(function_signatures.glGetSamplerParameterIiv) = undefined; var glGetSamplerParameterIiv: *const function_signatures.glGetSamplerParameterIiv = undefined;
var glGetSamplerParameteriv: FnPtr(function_signatures.glGetSamplerParameteriv) = undefined; var glGetSamplerParameteriv: *const function_signatures.glGetSamplerParameteriv = undefined;
var glSamplerParameterIuiv: FnPtr(function_signatures.glSamplerParameterIuiv) = undefined; var glSamplerParameterIuiv: *const function_signatures.glSamplerParameterIuiv = undefined;
var glSamplerParameterIiv: FnPtr(function_signatures.glSamplerParameterIiv) = undefined; var glSamplerParameterIiv: *const function_signatures.glSamplerParameterIiv = undefined;
var glSamplerParameterfv: FnPtr(function_signatures.glSamplerParameterfv) = undefined; var glSamplerParameterfv: *const function_signatures.glSamplerParameterfv = undefined;
var glSamplerParameterf: FnPtr(function_signatures.glSamplerParameterf) = undefined; var glSamplerParameterf: *const function_signatures.glSamplerParameterf = undefined;
var glSamplerParameteriv: FnPtr(function_signatures.glSamplerParameteriv) = undefined; var glSamplerParameteriv: *const function_signatures.glSamplerParameteriv = undefined;
var glSamplerParameteri: FnPtr(function_signatures.glSamplerParameteri) = undefined; var glSamplerParameteri: *const function_signatures.glSamplerParameteri = undefined;
var glBindSampler: FnPtr(function_signatures.glBindSampler) = undefined; var glBindSampler: *const function_signatures.glBindSampler = undefined;
var glIsSampler: FnPtr(function_signatures.glIsSampler) = undefined; var glIsSampler: *const function_signatures.glIsSampler = undefined;
var glDeleteSamplers: FnPtr(function_signatures.glDeleteSamplers) = undefined; var glDeleteSamplers: *const function_signatures.glDeleteSamplers = undefined;
var glGenSamplers: FnPtr(function_signatures.glGenSamplers) = undefined; var glGenSamplers: *const function_signatures.glGenSamplers = undefined;
var glGetFragDataIndex: FnPtr(function_signatures.glGetFragDataIndex) = undefined; var glGetFragDataIndex: *const function_signatures.glGetFragDataIndex = undefined;
var glBindFragDataLocationIndexed: FnPtr(function_signatures.glBindFragDataLocationIndexed) = undefined; var glBindFragDataLocationIndexed: *const function_signatures.glBindFragDataLocationIndexed = undefined;
var glSampleMaski: FnPtr(function_signatures.glSampleMaski) = undefined; var glSampleMaski: *const function_signatures.glSampleMaski = undefined;
var glGetMultisamplefv: FnPtr(function_signatures.glGetMultisamplefv) = undefined; var glGetMultisamplefv: *const function_signatures.glGetMultisamplefv = undefined;
var glTexImage3DMultisample: FnPtr(function_signatures.glTexImage3DMultisample) = undefined; var glTexImage3DMultisample: *const function_signatures.glTexImage3DMultisample = undefined;
var glTexImage2DMultisample: FnPtr(function_signatures.glTexImage2DMultisample) = undefined; var glTexImage2DMultisample: *const function_signatures.glTexImage2DMultisample = undefined;
var glFramebufferTexture: FnPtr(function_signatures.glFramebufferTexture) = undefined; var glFramebufferTexture: *const function_signatures.glFramebufferTexture = undefined;
var glGetBufferParameteri64v: FnPtr(function_signatures.glGetBufferParameteri64v) = undefined; var glGetBufferParameteri64v: *const function_signatures.glGetBufferParameteri64v = undefined;
var glBlendFuncSeparate: FnPtr(function_signatures.glBlendFuncSeparate) = undefined; var glBlendFuncSeparate: *const function_signatures.glBlendFuncSeparate = undefined;
var glMultiDrawArrays: FnPtr(function_signatures.glMultiDrawArrays) = undefined; var glMultiDrawArrays: *const function_signatures.glMultiDrawArrays = undefined;
var glMultiDrawElements: FnPtr(function_signatures.glMultiDrawElements) = undefined; var glMultiDrawElements: *const function_signatures.glMultiDrawElements = undefined;
var glPointParameterf: FnPtr(function_signatures.glPointParameterf) = undefined; var glPointParameterf: *const function_signatures.glPointParameterf = undefined;
var glPointParameterfv: FnPtr(function_signatures.glPointParameterfv) = undefined; var glPointParameterfv: *const function_signatures.glPointParameterfv = undefined;
var glPointParameteri: FnPtr(function_signatures.glPointParameteri) = undefined; var glPointParameteri: *const function_signatures.glPointParameteri = undefined;
var glPointParameteriv: FnPtr(function_signatures.glPointParameteriv) = undefined; var glPointParameteriv: *const function_signatures.glPointParameteriv = undefined;
var glGetInteger64i_v: FnPtr(function_signatures.glGetInteger64i_v) = undefined; var glGetInteger64i_v: *const function_signatures.glGetInteger64i_v = undefined;
var glGetSynciv: FnPtr(function_signatures.glGetSynciv) = undefined; var glGetSynciv: *const function_signatures.glGetSynciv = undefined;
var glGetInteger64v: FnPtr(function_signatures.glGetInteger64v) = undefined; var glGetInteger64v: *const function_signatures.glGetInteger64v = undefined;
var glWaitSync: FnPtr(function_signatures.glWaitSync) = undefined; var glWaitSync: *const function_signatures.glWaitSync = undefined;
var glClientWaitSync: FnPtr(function_signatures.glClientWaitSync) = undefined; var glClientWaitSync: *const function_signatures.glClientWaitSync = undefined;
var glDeleteSync: FnPtr(function_signatures.glDeleteSync) = undefined; var glDeleteSync: *const function_signatures.glDeleteSync = undefined;
var glIsSync: FnPtr(function_signatures.glIsSync) = undefined; var glIsSync: *const function_signatures.glIsSync = undefined;
var glFenceSync: FnPtr(function_signatures.glFenceSync) = undefined; var glFenceSync: *const function_signatures.glFenceSync = undefined;
var glBlendColor: FnPtr(function_signatures.glBlendColor) = undefined; var glBlendColor: *const function_signatures.glBlendColor = undefined;
var glBlendEquation: FnPtr(function_signatures.glBlendEquation) = undefined; var glBlendEquation: *const function_signatures.glBlendEquation = undefined;
var glProvokingVertex: FnPtr(function_signatures.glProvokingVertex) = undefined; var glProvokingVertex: *const function_signatures.glProvokingVertex = undefined;
var glMultiDrawElementsBaseVertex: FnPtr(function_signatures.glMultiDrawElementsBaseVertex) = undefined; var glMultiDrawElementsBaseVertex: *const function_signatures.glMultiDrawElementsBaseVertex = undefined;
var glDrawElementsInstancedBaseVertex: FnPtr(function_signatures.glDrawElementsInstancedBaseVertex) = undefined; var glDrawElementsInstancedBaseVertex: *const function_signatures.glDrawElementsInstancedBaseVertex = undefined;
var glDrawRangeElementsBaseVertex: FnPtr(function_signatures.glDrawRangeElementsBaseVertex) = undefined; var glDrawRangeElementsBaseVertex: *const function_signatures.glDrawRangeElementsBaseVertex = undefined;
var glDrawElementsBaseVertex: FnPtr(function_signatures.glDrawElementsBaseVertex) = undefined; var glDrawElementsBaseVertex: *const function_signatures.glDrawElementsBaseVertex = undefined;
var glGenQueries: FnPtr(function_signatures.glGenQueries) = undefined; var glGenQueries: *const function_signatures.glGenQueries = undefined;
var glDeleteQueries: FnPtr(function_signatures.glDeleteQueries) = undefined; var glDeleteQueries: *const function_signatures.glDeleteQueries = undefined;
var glIsQuery: FnPtr(function_signatures.glIsQuery) = undefined; var glIsQuery: *const function_signatures.glIsQuery = undefined;
var glBeginQuery: FnPtr(function_signatures.glBeginQuery) = undefined; var glBeginQuery: *const function_signatures.glBeginQuery = undefined;
var glEndQuery: FnPtr(function_signatures.glEndQuery) = undefined; var glEndQuery: *const function_signatures.glEndQuery = undefined;
var glGetQueryiv: FnPtr(function_signatures.glGetQueryiv) = undefined; var glGetQueryiv: *const function_signatures.glGetQueryiv = undefined;
var glGetQueryObjectiv: FnPtr(function_signatures.glGetQueryObjectiv) = undefined; var glGetQueryObjectiv: *const function_signatures.glGetQueryObjectiv = undefined;
var glGetQueryObjectuiv: FnPtr(function_signatures.glGetQueryObjectuiv) = undefined; var glGetQueryObjectuiv: *const function_signatures.glGetQueryObjectuiv = undefined;
var glBindBuffer: FnPtr(function_signatures.glBindBuffer) = undefined; var glBindBuffer: *const function_signatures.glBindBuffer = undefined;
var glDeleteBuffers: FnPtr(function_signatures.glDeleteBuffers) = undefined; var glDeleteBuffers: *const function_signatures.glDeleteBuffers = undefined;
var glGenBuffers: FnPtr(function_signatures.glGenBuffers) = undefined; var glGenBuffers: *const function_signatures.glGenBuffers = undefined;
var glIsBuffer: FnPtr(function_signatures.glIsBuffer) = undefined; var glIsBuffer: *const function_signatures.glIsBuffer = undefined;
var glBufferData: FnPtr(function_signatures.glBufferData) = undefined; var glBufferData: *const function_signatures.glBufferData = undefined;
var glBufferSubData: FnPtr(function_signatures.glBufferSubData) = undefined; var glBufferSubData: *const function_signatures.glBufferSubData = undefined;
var glGetBufferSubData: FnPtr(function_signatures.glGetBufferSubData) = undefined; var glGetBufferSubData: *const function_signatures.glGetBufferSubData = undefined;
var glMapBuffer: FnPtr(function_signatures.glMapBuffer) = undefined; var glMapBuffer: *const function_signatures.glMapBuffer = undefined;
var glUnmapBuffer: FnPtr(function_signatures.glUnmapBuffer) = undefined; var glUnmapBuffer: *const function_signatures.glUnmapBuffer = undefined;
var glGetBufferParameteriv: FnPtr(function_signatures.glGetBufferParameteriv) = undefined; var glGetBufferParameteriv: *const function_signatures.glGetBufferParameteriv = undefined;
var glGetBufferPointerv: FnPtr(function_signatures.glGetBufferPointerv) = undefined; var glGetBufferPointerv: *const function_signatures.glGetBufferPointerv = undefined;
var glBlendEquationSeparate: FnPtr(function_signatures.glBlendEquationSeparate) = undefined; var glBlendEquationSeparate: *const function_signatures.glBlendEquationSeparate = undefined;
var glDrawBuffers: FnPtr(function_signatures.glDrawBuffers) = undefined; var glDrawBuffers: *const function_signatures.glDrawBuffers = undefined;
var glStencilOpSeparate: FnPtr(function_signatures.glStencilOpSeparate) = undefined; var glStencilOpSeparate: *const function_signatures.glStencilOpSeparate = undefined;
var glStencilFuncSeparate: FnPtr(function_signatures.glStencilFuncSeparate) = undefined; var glStencilFuncSeparate: *const function_signatures.glStencilFuncSeparate = undefined;
var glStencilMaskSeparate: FnPtr(function_signatures.glStencilMaskSeparate) = undefined; var glStencilMaskSeparate: *const function_signatures.glStencilMaskSeparate = undefined;
var glAttachShader: FnPtr(function_signatures.glAttachShader) = undefined; var glAttachShader: *const function_signatures.glAttachShader = undefined;
var glBindAttribLocation: FnPtr(function_signatures.glBindAttribLocation) = undefined; var glBindAttribLocation: *const function_signatures.glBindAttribLocation = undefined;
var glCompileShader: FnPtr(function_signatures.glCompileShader) = undefined; var glCompileShader: *const function_signatures.glCompileShader = undefined;
var glCreateProgram: FnPtr(function_signatures.glCreateProgram) = undefined; var glCreateProgram: *const function_signatures.glCreateProgram = undefined;
var glCreateShader: FnPtr(function_signatures.glCreateShader) = undefined; var glCreateShader: *const function_signatures.glCreateShader = undefined;
var glDeleteProgram: FnPtr(function_signatures.glDeleteProgram) = undefined; var glDeleteProgram: *const function_signatures.glDeleteProgram = undefined;
var glDeleteShader: FnPtr(function_signatures.glDeleteShader) = undefined; var glDeleteShader: *const function_signatures.glDeleteShader = undefined;
var glDetachShader: FnPtr(function_signatures.glDetachShader) = undefined; var glDetachShader: *const function_signatures.glDetachShader = undefined;
var glDisableVertexAttribArray: FnPtr(function_signatures.glDisableVertexAttribArray) = undefined; var glDisableVertexAttribArray: *const function_signatures.glDisableVertexAttribArray = undefined;
var glEnableVertexAttribArray: FnPtr(function_signatures.glEnableVertexAttribArray) = undefined; var glEnableVertexAttribArray: *const function_signatures.glEnableVertexAttribArray = undefined;
var glGetActiveAttrib: FnPtr(function_signatures.glGetActiveAttrib) = undefined; var glGetActiveAttrib: *const function_signatures.glGetActiveAttrib = undefined;
var glGetActiveUniform: FnPtr(function_signatures.glGetActiveUniform) = undefined; var glGetActiveUniform: *const function_signatures.glGetActiveUniform = undefined;
var glGetAttachedShaders: FnPtr(function_signatures.glGetAttachedShaders) = undefined; var glGetAttachedShaders: *const function_signatures.glGetAttachedShaders = undefined;
var glGetAttribLocation: FnPtr(function_signatures.glGetAttribLocation) = undefined; var glGetAttribLocation: *const function_signatures.glGetAttribLocation = undefined;
var glGetProgramiv: FnPtr(function_signatures.glGetProgramiv) = undefined; var glGetProgramiv: *const function_signatures.glGetProgramiv = undefined;
var glGetProgramInfoLog: FnPtr(function_signatures.glGetProgramInfoLog) = undefined; var glGetProgramInfoLog: *const function_signatures.glGetProgramInfoLog = undefined;
var glGetShaderiv: FnPtr(function_signatures.glGetShaderiv) = undefined; var glGetShaderiv: *const function_signatures.glGetShaderiv = undefined;
var glGetShaderInfoLog: FnPtr(function_signatures.glGetShaderInfoLog) = undefined; var glGetShaderInfoLog: *const function_signatures.glGetShaderInfoLog = undefined;
var glGetShaderSource: FnPtr(function_signatures.glGetShaderSource) = undefined; var glGetShaderSource: *const function_signatures.glGetShaderSource = undefined;
var glGetUniformLocation: FnPtr(function_signatures.glGetUniformLocation) = undefined; var glGetUniformLocation: *const function_signatures.glGetUniformLocation = undefined;
var glGetUniformfv: FnPtr(function_signatures.glGetUniformfv) = undefined; var glGetUniformfv: *const function_signatures.glGetUniformfv = undefined;
var glGetUniformiv: FnPtr(function_signatures.glGetUniformiv) = undefined; var glGetUniformiv: *const function_signatures.glGetUniformiv = undefined;
var glGetVertexAttribdv: FnPtr(function_signatures.glGetVertexAttribdv) = undefined; var glGetVertexAttribdv: *const function_signatures.glGetVertexAttribdv = undefined;
var glGetVertexAttribfv: FnPtr(function_signatures.glGetVertexAttribfv) = undefined; var glGetVertexAttribfv: *const function_signatures.glGetVertexAttribfv = undefined;
var glGetVertexAttribiv: FnPtr(function_signatures.glGetVertexAttribiv) = undefined; var glGetVertexAttribiv: *const function_signatures.glGetVertexAttribiv = undefined;
var glGetVertexAttribPointerv: FnPtr(function_signatures.glGetVertexAttribPointerv) = undefined; var glGetVertexAttribPointerv: *const function_signatures.glGetVertexAttribPointerv = undefined;
var glIsProgram: FnPtr(function_signatures.glIsProgram) = undefined; var glIsProgram: *const function_signatures.glIsProgram = undefined;
var glIsShader: FnPtr(function_signatures.glIsShader) = undefined; var glIsShader: *const function_signatures.glIsShader = undefined;
var glLinkProgram: FnPtr(function_signatures.glLinkProgram) = undefined; var glLinkProgram: *const function_signatures.glLinkProgram = undefined;
var glShaderSource: FnPtr(function_signatures.glShaderSource) = undefined; var glShaderSource: *const function_signatures.glShaderSource = undefined;
var glUseProgram: FnPtr(function_signatures.glUseProgram) = undefined; var glUseProgram: *const function_signatures.glUseProgram = undefined;
var glUniform1f: FnPtr(function_signatures.glUniform1f) = undefined; var glUniform1f: *const function_signatures.glUniform1f = undefined;
var glUniform2f: FnPtr(function_signatures.glUniform2f) = undefined; var glUniform2f: *const function_signatures.glUniform2f = undefined;
var glUniform3f: FnPtr(function_signatures.glUniform3f) = undefined; var glUniform3f: *const function_signatures.glUniform3f = undefined;
var glUniform4f: FnPtr(function_signatures.glUniform4f) = undefined; var glUniform4f: *const function_signatures.glUniform4f = undefined;
var glUniform1i: FnPtr(function_signatures.glUniform1i) = undefined; var glUniform1i: *const function_signatures.glUniform1i = undefined;
var glUniform2i: FnPtr(function_signatures.glUniform2i) = undefined; var glUniform2i: *const function_signatures.glUniform2i = undefined;
var glUniform3i: FnPtr(function_signatures.glUniform3i) = undefined; var glUniform3i: *const function_signatures.glUniform3i = undefined;
var glUniform4i: FnPtr(function_signatures.glUniform4i) = undefined; var glUniform4i: *const function_signatures.glUniform4i = undefined;
var glUniform1fv: FnPtr(function_signatures.glUniform1fv) = undefined; var glUniform1fv: *const function_signatures.glUniform1fv = undefined;
var glUniform2fv: FnPtr(function_signatures.glUniform2fv) = undefined; var glUniform2fv: *const function_signatures.glUniform2fv = undefined;
var glUniform3fv: FnPtr(function_signatures.glUniform3fv) = undefined; var glUniform3fv: *const function_signatures.glUniform3fv = undefined;
var glUniform4fv: FnPtr(function_signatures.glUniform4fv) = undefined; var glUniform4fv: *const function_signatures.glUniform4fv = undefined;
var glUniform1iv: FnPtr(function_signatures.glUniform1iv) = undefined; var glUniform1iv: *const function_signatures.glUniform1iv = undefined;
var glUniform2iv: FnPtr(function_signatures.glUniform2iv) = undefined; var glUniform2iv: *const function_signatures.glUniform2iv = undefined;
var glUniform3iv: FnPtr(function_signatures.glUniform3iv) = undefined; var glUniform3iv: *const function_signatures.glUniform3iv = undefined;
var glUniform4iv: FnPtr(function_signatures.glUniform4iv) = undefined; var glUniform4iv: *const function_signatures.glUniform4iv = undefined;
var glUniformMatrix2fv: FnPtr(function_signatures.glUniformMatrix2fv) = undefined; var glUniformMatrix2fv: *const function_signatures.glUniformMatrix2fv = undefined;
var glUniformMatrix3fv: FnPtr(function_signatures.glUniformMatrix3fv) = undefined; var glUniformMatrix3fv: *const function_signatures.glUniformMatrix3fv = undefined;
var glUniformMatrix4fv: FnPtr(function_signatures.glUniformMatrix4fv) = undefined; var glUniformMatrix4fv: *const function_signatures.glUniformMatrix4fv = undefined;
var glValidateProgram: FnPtr(function_signatures.glValidateProgram) = undefined; var glValidateProgram: *const function_signatures.glValidateProgram = undefined;
var glVertexAttrib1d: FnPtr(function_signatures.glVertexAttrib1d) = undefined; var glVertexAttrib1d: *const function_signatures.glVertexAttrib1d = undefined;
var glVertexAttrib1dv: FnPtr(function_signatures.glVertexAttrib1dv) = undefined; var glVertexAttrib1dv: *const function_signatures.glVertexAttrib1dv = undefined;
var glVertexAttrib1f: FnPtr(function_signatures.glVertexAttrib1f) = undefined; var glVertexAttrib1f: *const function_signatures.glVertexAttrib1f = undefined;
var glVertexAttrib1fv: FnPtr(function_signatures.glVertexAttrib1fv) = undefined; var glVertexAttrib1fv: *const function_signatures.glVertexAttrib1fv = undefined;
var glVertexAttrib1s: FnPtr(function_signatures.glVertexAttrib1s) = undefined; var glVertexAttrib1s: *const function_signatures.glVertexAttrib1s = undefined;
var glVertexAttrib1sv: FnPtr(function_signatures.glVertexAttrib1sv) = undefined; var glVertexAttrib1sv: *const function_signatures.glVertexAttrib1sv = undefined;
var glVertexAttrib2d: FnPtr(function_signatures.glVertexAttrib2d) = undefined; var glVertexAttrib2d: *const function_signatures.glVertexAttrib2d = undefined;
var glVertexAttrib2dv: FnPtr(function_signatures.glVertexAttrib2dv) = undefined; var glVertexAttrib2dv: *const function_signatures.glVertexAttrib2dv = undefined;
var glVertexAttrib2f: FnPtr(function_signatures.glVertexAttrib2f) = undefined; var glVertexAttrib2f: *const function_signatures.glVertexAttrib2f = undefined;
var glVertexAttrib2fv: FnPtr(function_signatures.glVertexAttrib2fv) = undefined; var glVertexAttrib2fv: *const function_signatures.glVertexAttrib2fv = undefined;
var glVertexAttrib2s: FnPtr(function_signatures.glVertexAttrib2s) = undefined; var glVertexAttrib2s: *const function_signatures.glVertexAttrib2s = undefined;
var glVertexAttrib2sv: FnPtr(function_signatures.glVertexAttrib2sv) = undefined; var glVertexAttrib2sv: *const function_signatures.glVertexAttrib2sv = undefined;
var glVertexAttrib3d: FnPtr(function_signatures.glVertexAttrib3d) = undefined; var glVertexAttrib3d: *const function_signatures.glVertexAttrib3d = undefined;
var glVertexAttrib3dv: FnPtr(function_signatures.glVertexAttrib3dv) = undefined; var glVertexAttrib3dv: *const function_signatures.glVertexAttrib3dv = undefined;
var glVertexAttrib3f: FnPtr(function_signatures.glVertexAttrib3f) = undefined; var glVertexAttrib3f: *const function_signatures.glVertexAttrib3f = undefined;
var glVertexAttrib3fv: FnPtr(function_signatures.glVertexAttrib3fv) = undefined; var glVertexAttrib3fv: *const function_signatures.glVertexAttrib3fv = undefined;
var glVertexAttrib3s: FnPtr(function_signatures.glVertexAttrib3s) = undefined; var glVertexAttrib3s: *const function_signatures.glVertexAttrib3s = undefined;
var glVertexAttrib3sv: FnPtr(function_signatures.glVertexAttrib3sv) = undefined; var glVertexAttrib3sv: *const function_signatures.glVertexAttrib3sv = undefined;
var glVertexAttrib4Nbv: FnPtr(function_signatures.glVertexAttrib4Nbv) = undefined; var glVertexAttrib4Nbv: *const function_signatures.glVertexAttrib4Nbv = undefined;
var glVertexAttrib4Niv: FnPtr(function_signatures.glVertexAttrib4Niv) = undefined; var glVertexAttrib4Niv: *const function_signatures.glVertexAttrib4Niv = undefined;
var glVertexAttrib4Nsv: FnPtr(function_signatures.glVertexAttrib4Nsv) = undefined; var glVertexAttrib4Nsv: *const function_signatures.glVertexAttrib4Nsv = undefined;
var glVertexAttrib4Nub: FnPtr(function_signatures.glVertexAttrib4Nub) = undefined; var glVertexAttrib4Nub: *const function_signatures.glVertexAttrib4Nub = undefined;
var glVertexAttrib4Nubv: FnPtr(function_signatures.glVertexAttrib4Nubv) = undefined; var glVertexAttrib4Nubv: *const function_signatures.glVertexAttrib4Nubv = undefined;
var glVertexAttrib4Nuiv: FnPtr(function_signatures.glVertexAttrib4Nuiv) = undefined; var glVertexAttrib4Nuiv: *const function_signatures.glVertexAttrib4Nuiv = undefined;
var glVertexAttrib4Nusv: FnPtr(function_signatures.glVertexAttrib4Nusv) = undefined; var glVertexAttrib4Nusv: *const function_signatures.glVertexAttrib4Nusv = undefined;
var glVertexAttrib4bv: FnPtr(function_signatures.glVertexAttrib4bv) = undefined; var glVertexAttrib4bv: *const function_signatures.glVertexAttrib4bv = undefined;
var glVertexAttrib4d: FnPtr(function_signatures.glVertexAttrib4d) = undefined; var glVertexAttrib4d: *const function_signatures.glVertexAttrib4d = undefined;
var glVertexAttrib4dv: FnPtr(function_signatures.glVertexAttrib4dv) = undefined; var glVertexAttrib4dv: *const function_signatures.glVertexAttrib4dv = undefined;
var glVertexAttrib4f: FnPtr(function_signatures.glVertexAttrib4f) = undefined; var glVertexAttrib4f: *const function_signatures.glVertexAttrib4f = undefined;
var glVertexAttrib4fv: FnPtr(function_signatures.glVertexAttrib4fv) = undefined; var glVertexAttrib4fv: *const function_signatures.glVertexAttrib4fv = undefined;
var glVertexAttrib4iv: FnPtr(function_signatures.glVertexAttrib4iv) = undefined; var glVertexAttrib4iv: *const function_signatures.glVertexAttrib4iv = undefined;
var glVertexAttrib4s: FnPtr(function_signatures.glVertexAttrib4s) = undefined; var glVertexAttrib4s: *const function_signatures.glVertexAttrib4s = undefined;
var glVertexAttrib4sv: FnPtr(function_signatures.glVertexAttrib4sv) = undefined; var glVertexAttrib4sv: *const function_signatures.glVertexAttrib4sv = undefined;
var glVertexAttrib4ubv: FnPtr(function_signatures.glVertexAttrib4ubv) = undefined; var glVertexAttrib4ubv: *const function_signatures.glVertexAttrib4ubv = undefined;
var glVertexAttrib4uiv: FnPtr(function_signatures.glVertexAttrib4uiv) = undefined; var glVertexAttrib4uiv: *const function_signatures.glVertexAttrib4uiv = undefined;
var glVertexAttrib4usv: FnPtr(function_signatures.glVertexAttrib4usv) = undefined; var glVertexAttrib4usv: *const function_signatures.glVertexAttrib4usv = undefined;
var glVertexAttribPointer: FnPtr(function_signatures.glVertexAttribPointer) = undefined; var glVertexAttribPointer: *const function_signatures.glVertexAttribPointer = undefined;
var glUniformMatrix2x3fv: FnPtr(function_signatures.glUniformMatrix2x3fv) = undefined; var glUniformMatrix2x3fv: *const function_signatures.glUniformMatrix2x3fv = undefined;
var glUniformMatrix3x2fv: FnPtr(function_signatures.glUniformMatrix3x2fv) = undefined; var glUniformMatrix3x2fv: *const function_signatures.glUniformMatrix3x2fv = undefined;
var glUniformMatrix2x4fv: FnPtr(function_signatures.glUniformMatrix2x4fv) = undefined; var glUniformMatrix2x4fv: *const function_signatures.glUniformMatrix2x4fv = undefined;
var glUniformMatrix4x2fv: FnPtr(function_signatures.glUniformMatrix4x2fv) = undefined; var glUniformMatrix4x2fv: *const function_signatures.glUniformMatrix4x2fv = undefined;
var glUniformMatrix3x4fv: FnPtr(function_signatures.glUniformMatrix3x4fv) = undefined; var glUniformMatrix3x4fv: *const function_signatures.glUniformMatrix3x4fv = undefined;
var glUniformMatrix4x3fv: FnPtr(function_signatures.glUniformMatrix4x3fv) = undefined; var glUniformMatrix4x3fv: *const function_signatures.glUniformMatrix4x3fv = undefined;
var glColorMaski: FnPtr(function_signatures.glColorMaski) = undefined; var glColorMaski: *const function_signatures.glColorMaski = undefined;
var glGetBooleani_v: FnPtr(function_signatures.glGetBooleani_v) = undefined; var glGetBooleani_v: *const function_signatures.glGetBooleani_v = undefined;
var glGetIntegeri_v: FnPtr(function_signatures.glGetIntegeri_v) = undefined; var glGetIntegeri_v: *const function_signatures.glGetIntegeri_v = undefined;
var glEnablei: FnPtr(function_signatures.glEnablei) = undefined; var glEnablei: *const function_signatures.glEnablei = undefined;
var glDisablei: FnPtr(function_signatures.glDisablei) = undefined; var glDisablei: *const function_signatures.glDisablei = undefined;
var glIsEnabledi: FnPtr(function_signatures.glIsEnabledi) = undefined; var glIsEnabledi: *const function_signatures.glIsEnabledi = undefined;
var glBeginTransformFeedback: FnPtr(function_signatures.glBeginTransformFeedback) = undefined; var glBeginTransformFeedback: *const function_signatures.glBeginTransformFeedback = undefined;
var glEndTransformFeedback: FnPtr(function_signatures.glEndTransformFeedback) = undefined; var glEndTransformFeedback: *const function_signatures.glEndTransformFeedback = undefined;
var glBindBufferRange: FnPtr(function_signatures.glBindBufferRange) = undefined; var glBindBufferRange: *const function_signatures.glBindBufferRange = undefined;
var glBindBufferBase: FnPtr(function_signatures.glBindBufferBase) = undefined; var glBindBufferBase: *const function_signatures.glBindBufferBase = undefined;
var glTransformFeedbackVaryings: FnPtr(function_signatures.glTransformFeedbackVaryings) = undefined; var glTransformFeedbackVaryings: *const function_signatures.glTransformFeedbackVaryings = undefined;
var glGetTransformFeedbackVarying: FnPtr(function_signatures.glGetTransformFeedbackVarying) = undefined; var glGetTransformFeedbackVarying: *const function_signatures.glGetTransformFeedbackVarying = undefined;
var glClampColor: FnPtr(function_signatures.glClampColor) = undefined; var glClampColor: *const function_signatures.glClampColor = undefined;
var glBeginConditionalRender: FnPtr(function_signatures.glBeginConditionalRender) = undefined; var glBeginConditionalRender: *const function_signatures.glBeginConditionalRender = undefined;
var glEndConditionalRender: FnPtr(function_signatures.glEndConditionalRender) = undefined; var glEndConditionalRender: *const function_signatures.glEndConditionalRender = undefined;
var glVertexAttribIPointer: FnPtr(function_signatures.glVertexAttribIPointer) = undefined; var glVertexAttribIPointer: *const function_signatures.glVertexAttribIPointer = undefined;
var glGetVertexAttribIiv: FnPtr(function_signatures.glGetVertexAttribIiv) = undefined; var glGetVertexAttribIiv: *const function_signatures.glGetVertexAttribIiv = undefined;
var glGetVertexAttribIuiv: FnPtr(function_signatures.glGetVertexAttribIuiv) = undefined; var glGetVertexAttribIuiv: *const function_signatures.glGetVertexAttribIuiv = undefined;
var glVertexAttribI1i: FnPtr(function_signatures.glVertexAttribI1i) = undefined; var glVertexAttribI1i: *const function_signatures.glVertexAttribI1i = undefined;
var glVertexAttribI2i: FnPtr(function_signatures.glVertexAttribI2i) = undefined; var glVertexAttribI2i: *const function_signatures.glVertexAttribI2i = undefined;
var glVertexAttribI3i: FnPtr(function_signatures.glVertexAttribI3i) = undefined; var glVertexAttribI3i: *const function_signatures.glVertexAttribI3i = undefined;
var glVertexAttribI4i: FnPtr(function_signatures.glVertexAttribI4i) = undefined; var glVertexAttribI4i: *const function_signatures.glVertexAttribI4i = undefined;
var glVertexAttribI1ui: FnPtr(function_signatures.glVertexAttribI1ui) = undefined; var glVertexAttribI1ui: *const function_signatures.glVertexAttribI1ui = undefined;
var glVertexAttribI2ui: FnPtr(function_signatures.glVertexAttribI2ui) = undefined; var glVertexAttribI2ui: *const function_signatures.glVertexAttribI2ui = undefined;
var glVertexAttribI3ui: FnPtr(function_signatures.glVertexAttribI3ui) = undefined; var glVertexAttribI3ui: *const function_signatures.glVertexAttribI3ui = undefined;
var glVertexAttribI4ui: FnPtr(function_signatures.glVertexAttribI4ui) = undefined; var glVertexAttribI4ui: *const function_signatures.glVertexAttribI4ui = undefined;
var glVertexAttribI1iv: FnPtr(function_signatures.glVertexAttribI1iv) = undefined; var glVertexAttribI1iv: *const function_signatures.glVertexAttribI1iv = undefined;
var glVertexAttribI2iv: FnPtr(function_signatures.glVertexAttribI2iv) = undefined; var glVertexAttribI2iv: *const function_signatures.glVertexAttribI2iv = undefined;
var glVertexAttribI3iv: FnPtr(function_signatures.glVertexAttribI3iv) = undefined; var glVertexAttribI3iv: *const function_signatures.glVertexAttribI3iv = undefined;
var glVertexAttribI4iv: FnPtr(function_signatures.glVertexAttribI4iv) = undefined; var glVertexAttribI4iv: *const function_signatures.glVertexAttribI4iv = undefined;
var glVertexAttribI1uiv: FnPtr(function_signatures.glVertexAttribI1uiv) = undefined; var glVertexAttribI1uiv: *const function_signatures.glVertexAttribI1uiv = undefined;
var glVertexAttribI2uiv: FnPtr(function_signatures.glVertexAttribI2uiv) = undefined; var glVertexAttribI2uiv: *const function_signatures.glVertexAttribI2uiv = undefined;
var glVertexAttribI3uiv: FnPtr(function_signatures.glVertexAttribI3uiv) = undefined; var glVertexAttribI3uiv: *const function_signatures.glVertexAttribI3uiv = undefined;
var glVertexAttribI4uiv: FnPtr(function_signatures.glVertexAttribI4uiv) = undefined; var glVertexAttribI4uiv: *const function_signatures.glVertexAttribI4uiv = undefined;
var glVertexAttribI4bv: FnPtr(function_signatures.glVertexAttribI4bv) = undefined; var glVertexAttribI4bv: *const function_signatures.glVertexAttribI4bv = undefined;
var glVertexAttribI4sv: FnPtr(function_signatures.glVertexAttribI4sv) = undefined; var glVertexAttribI4sv: *const function_signatures.glVertexAttribI4sv = undefined;
var glVertexAttribI4ubv: FnPtr(function_signatures.glVertexAttribI4ubv) = undefined; var glVertexAttribI4ubv: *const function_signatures.glVertexAttribI4ubv = undefined;
var glVertexAttribI4usv: FnPtr(function_signatures.glVertexAttribI4usv) = undefined; var glVertexAttribI4usv: *const function_signatures.glVertexAttribI4usv = undefined;
var glGetUniformuiv: FnPtr(function_signatures.glGetUniformuiv) = undefined; var glGetUniformuiv: *const function_signatures.glGetUniformuiv = undefined;
var glBindFragDataLocation: FnPtr(function_signatures.glBindFragDataLocation) = undefined; var glBindFragDataLocation: *const function_signatures.glBindFragDataLocation = undefined;
var glGetFragDataLocation: FnPtr(function_signatures.glGetFragDataLocation) = undefined; var glGetFragDataLocation: *const function_signatures.glGetFragDataLocation = undefined;
var glUniform1ui: FnPtr(function_signatures.glUniform1ui) = undefined; var glUniform1ui: *const function_signatures.glUniform1ui = undefined;
var glUniform2ui: FnPtr(function_signatures.glUniform2ui) = undefined; var glUniform2ui: *const function_signatures.glUniform2ui = undefined;
var glUniform3ui: FnPtr(function_signatures.glUniform3ui) = undefined; var glUniform3ui: *const function_signatures.glUniform3ui = undefined;
var glUniform4ui: FnPtr(function_signatures.glUniform4ui) = undefined; var glUniform4ui: *const function_signatures.glUniform4ui = undefined;
var glUniform1uiv: FnPtr(function_signatures.glUniform1uiv) = undefined; var glUniform1uiv: *const function_signatures.glUniform1uiv = undefined;
var glUniform2uiv: FnPtr(function_signatures.glUniform2uiv) = undefined; var glUniform2uiv: *const function_signatures.glUniform2uiv = undefined;
var glUniform3uiv: FnPtr(function_signatures.glUniform3uiv) = undefined; var glUniform3uiv: *const function_signatures.glUniform3uiv = undefined;
var glUniform4uiv: FnPtr(function_signatures.glUniform4uiv) = undefined; var glUniform4uiv: *const function_signatures.glUniform4uiv = undefined;
var glTexParameterIiv: FnPtr(function_signatures.glTexParameterIiv) = undefined; var glTexParameterIiv: *const function_signatures.glTexParameterIiv = undefined;
var glTexParameterIuiv: FnPtr(function_signatures.glTexParameterIuiv) = undefined; var glTexParameterIuiv: *const function_signatures.glTexParameterIuiv = undefined;
var glGetTexParameterIiv: FnPtr(function_signatures.glGetTexParameterIiv) = undefined; var glGetTexParameterIiv: *const function_signatures.glGetTexParameterIiv = undefined;
var glGetTexParameterIuiv: FnPtr(function_signatures.glGetTexParameterIuiv) = undefined; var glGetTexParameterIuiv: *const function_signatures.glGetTexParameterIuiv = undefined;
var glClearBufferiv: FnPtr(function_signatures.glClearBufferiv) = undefined; var glClearBufferiv: *const function_signatures.glClearBufferiv = undefined;
var glClearBufferuiv: FnPtr(function_signatures.glClearBufferuiv) = undefined; var glClearBufferuiv: *const function_signatures.glClearBufferuiv = undefined;
var glClearBufferfv: FnPtr(function_signatures.glClearBufferfv) = undefined; var glClearBufferfv: *const function_signatures.glClearBufferfv = undefined;
var glClearBufferfi: FnPtr(function_signatures.glClearBufferfi) = undefined; var glClearBufferfi: *const function_signatures.glClearBufferfi = undefined;
var glGetStringi: FnPtr(function_signatures.glGetStringi) = undefined; var glGetStringi: *const function_signatures.glGetStringi = undefined;
var glIsRenderbuffer: FnPtr(function_signatures.glIsRenderbuffer) = undefined; var glIsRenderbuffer: *const function_signatures.glIsRenderbuffer = undefined;
var glBindRenderbuffer: FnPtr(function_signatures.glBindRenderbuffer) = undefined; var glBindRenderbuffer: *const function_signatures.glBindRenderbuffer = undefined;
var glDeleteRenderbuffers: FnPtr(function_signatures.glDeleteRenderbuffers) = undefined; var glDeleteRenderbuffers: *const function_signatures.glDeleteRenderbuffers = undefined;
var glGenRenderbuffers: FnPtr(function_signatures.glGenRenderbuffers) = undefined; var glGenRenderbuffers: *const function_signatures.glGenRenderbuffers = undefined;
var glRenderbufferStorage: FnPtr(function_signatures.glRenderbufferStorage) = undefined; var glRenderbufferStorage: *const function_signatures.glRenderbufferStorage = undefined;
var glGetRenderbufferParameteriv: FnPtr(function_signatures.glGetRenderbufferParameteriv) = undefined; var glGetRenderbufferParameteriv: *const function_signatures.glGetRenderbufferParameteriv = undefined;
var glIsFramebuffer: FnPtr(function_signatures.glIsFramebuffer) = undefined; var glIsFramebuffer: *const function_signatures.glIsFramebuffer = undefined;
var glBindFramebuffer: FnPtr(function_signatures.glBindFramebuffer) = undefined; var glBindFramebuffer: *const function_signatures.glBindFramebuffer = undefined;
var glDeleteFramebuffers: FnPtr(function_signatures.glDeleteFramebuffers) = undefined; var glDeleteFramebuffers: *const function_signatures.glDeleteFramebuffers = undefined;
var glGenFramebuffers: FnPtr(function_signatures.glGenFramebuffers) = undefined; var glGenFramebuffers: *const function_signatures.glGenFramebuffers = undefined;
var glCheckFramebufferStatus: FnPtr(function_signatures.glCheckFramebufferStatus) = undefined; var glCheckFramebufferStatus: *const function_signatures.glCheckFramebufferStatus = undefined;
var glFramebufferTexture1D: FnPtr(function_signatures.glFramebufferTexture1D) = undefined; var glFramebufferTexture1D: *const function_signatures.glFramebufferTexture1D = undefined;
var glFramebufferTexture2D: FnPtr(function_signatures.glFramebufferTexture2D) = undefined; var glFramebufferTexture2D: *const function_signatures.glFramebufferTexture2D = undefined;
var glFramebufferTexture3D: FnPtr(function_signatures.glFramebufferTexture3D) = undefined; var glFramebufferTexture3D: *const function_signatures.glFramebufferTexture3D = undefined;
var glFramebufferRenderbuffer: FnPtr(function_signatures.glFramebufferRenderbuffer) = undefined; var glFramebufferRenderbuffer: *const function_signatures.glFramebufferRenderbuffer = undefined;
var glGetFramebufferAttachmentParameteriv: FnPtr(function_signatures.glGetFramebufferAttachmentParameteriv) = undefined; var glGetFramebufferAttachmentParameteriv: *const function_signatures.glGetFramebufferAttachmentParameteriv = undefined;
var glGenerateMipmap: FnPtr(function_signatures.glGenerateMipmap) = undefined; var glGenerateMipmap: *const function_signatures.glGenerateMipmap = undefined;
var glBlitFramebuffer: FnPtr(function_signatures.glBlitFramebuffer) = undefined; var glBlitFramebuffer: *const function_signatures.glBlitFramebuffer = undefined;
var glRenderbufferStorageMultisample: FnPtr(function_signatures.glRenderbufferStorageMultisample) = undefined; var glRenderbufferStorageMultisample: *const function_signatures.glRenderbufferStorageMultisample = undefined;
var glFramebufferTextureLayer: FnPtr(function_signatures.glFramebufferTextureLayer) = undefined; var glFramebufferTextureLayer: *const function_signatures.glFramebufferTextureLayer = undefined;
var glMapBufferRange: FnPtr(function_signatures.glMapBufferRange) = undefined; var glMapBufferRange: *const function_signatures.glMapBufferRange = undefined;
var glFlushMappedBufferRange: FnPtr(function_signatures.glFlushMappedBufferRange) = undefined; var glFlushMappedBufferRange: *const function_signatures.glFlushMappedBufferRange = undefined;
var glBindVertexArray: FnPtr(function_signatures.glBindVertexArray) = undefined; var glBindVertexArray: *const function_signatures.glBindVertexArray = undefined;
var glDeleteVertexArrays: FnPtr(function_signatures.glDeleteVertexArrays) = undefined; var glDeleteVertexArrays: *const function_signatures.glDeleteVertexArrays = undefined;
var glGenVertexArrays: FnPtr(function_signatures.glGenVertexArrays) = undefined; var glGenVertexArrays: *const function_signatures.glGenVertexArrays = undefined;
var glIsVertexArray: FnPtr(function_signatures.glIsVertexArray) = undefined; var glIsVertexArray: *const function_signatures.glIsVertexArray = undefined;
var glDrawArraysInstanced: FnPtr(function_signatures.glDrawArraysInstanced) = undefined; var glDrawArraysInstanced: *const function_signatures.glDrawArraysInstanced = undefined;
var glDrawElementsInstanced: FnPtr(function_signatures.glDrawElementsInstanced) = undefined; var glDrawElementsInstanced: *const function_signatures.glDrawElementsInstanced = undefined;
var glTexBuffer: FnPtr(function_signatures.glTexBuffer) = undefined; var glTexBuffer: *const function_signatures.glTexBuffer = undefined;
var glPrimitiveRestartIndex: FnPtr(function_signatures.glPrimitiveRestartIndex) = undefined; var glPrimitiveRestartIndex: *const function_signatures.glPrimitiveRestartIndex = undefined;
var glCopyBufferSubData: FnPtr(function_signatures.glCopyBufferSubData) = undefined; var glCopyBufferSubData: *const function_signatures.glCopyBufferSubData = undefined;
var glGetUniformIndices: FnPtr(function_signatures.glGetUniformIndices) = undefined; var glGetUniformIndices: *const function_signatures.glGetUniformIndices = undefined;
var glGetActiveUniformsiv: FnPtr(function_signatures.glGetActiveUniformsiv) = undefined; var glGetActiveUniformsiv: *const function_signatures.glGetActiveUniformsiv = undefined;
var glGetActiveUniformName: FnPtr(function_signatures.glGetActiveUniformName) = undefined; var glGetActiveUniformName: *const function_signatures.glGetActiveUniformName = undefined;
var glGetUniformBlockIndex: FnPtr(function_signatures.glGetUniformBlockIndex) = undefined; var glGetUniformBlockIndex: *const function_signatures.glGetUniformBlockIndex = undefined;
var glGetActiveUniformBlockiv: FnPtr(function_signatures.glGetActiveUniformBlockiv) = undefined; var glGetActiveUniformBlockiv: *const function_signatures.glGetActiveUniformBlockiv = undefined;
var glGetActiveUniformBlockName: FnPtr(function_signatures.glGetActiveUniformBlockName) = undefined; var glGetActiveUniformBlockName: *const function_signatures.glGetActiveUniformBlockName = undefined;
var glUniformBlockBinding: FnPtr(function_signatures.glUniformBlockBinding) = undefined; var glUniformBlockBinding: *const function_signatures.glUniformBlockBinding = undefined;
}; };
test { test {

View File

@ -39,7 +39,7 @@ pub const Ui = struct {
if (SDL.SDL_Init(SDL.SDL_INIT_VIDEO | SDL.SDL_INIT_EVENTS | SDL.SDL_INIT_AUDIO) < 0) panic(); if (SDL.SDL_Init(SDL.SDL_INIT_VIDEO | SDL.SDL_INIT_EVENTS | SDL.SDL_INIT_AUDIO) < 0) panic();
if (SDL.SDL_GL_SetAttribute(SDL.SDL_GL_CONTEXT_PROFILE_MASK, SDL.SDL_GL_CONTEXT_PROFILE_CORE) < 0) panic(); if (SDL.SDL_GL_SetAttribute(SDL.SDL_GL_CONTEXT_PROFILE_MASK, SDL.SDL_GL_CONTEXT_PROFILE_CORE) < 0) panic();
if (SDL.SDL_GL_SetAttribute(SDL.SDL_GL_CONTEXT_MAJOR_VERSION, 3) < 0) panic(); if (SDL.SDL_GL_SetAttribute(SDL.SDL_GL_CONTEXT_MAJOR_VERSION, 3) < 0) panic();
if (SDL.SDL_GL_SetAttribute(SDL.SDL_GL_CONTEXT_MAJOR_VERSION, 3) < 0) panic(); if (SDL.SDL_GL_SetAttribute(SDL.SDL_GL_CONTEXT_MINOR_VERSION, 3) < 0) panic();
const window = SDL.SDL_CreateWindow( const window = SDL.SDL_CreateWindow(
window_title, window_title,
@ -90,20 +90,20 @@ pub const Ui = struct {
pub fn run(self: *Self, nds7_group: nds7.Group, nds9_group: nds9.Group) !void { pub fn run(self: *Self, nds7_group: nds7.Group, nds9_group: nds9.Group) !void {
// TODO: Sort this out please // TODO: Sort this out please
const objects = opengl_impl.createObjects(); const vao_id = opengl_impl.vao();
defer gl.deleteBuffers(3, &[_]GLuint{ objects.vao, objects.vbo, objects.ebo }); defer gl.deleteVertexArrays(1, &[_]GLuint{vao_id});
const top_tex = opengl_impl.createScreenTexture(nds9_group.bus.ppu.fb.top(.front)); const top_tex = opengl_impl.screenTex(nds9_group.bus.ppu.fb.top(.front));
const btm_tex = opengl_impl.createScreenTexture(nds9_group.bus.ppu.fb.btm(.front)); const btm_tex = opengl_impl.screenTex(nds9_group.bus.ppu.fb.btm(.front));
const top_out_tex = opengl_impl.createOutputTexture(); const top_out_tex = opengl_impl.outTex();
const btm_out_tex = opengl_impl.createOutputTexture(); const btm_out_tex = opengl_impl.outTex();
defer gl.deleteTextures(4, &[_]GLuint{ top_tex, top_out_tex, btm_tex, btm_out_tex }); defer gl.deleteTextures(4, &[_]GLuint{ top_tex, top_out_tex, btm_tex, btm_out_tex });
const top_fbo = try opengl_impl.createFrameBuffer(top_out_tex); const top_fbo = try opengl_impl.frameBuffer(top_out_tex);
const btm_fbo = try opengl_impl.createFrameBuffer(btm_out_tex); const btm_fbo = try opengl_impl.frameBuffer(btm_out_tex);
defer gl.deleteFramebuffers(2, &[_]GLuint{ top_fbo, btm_fbo }); defer gl.deleteFramebuffers(2, &[_]GLuint{ top_fbo, btm_fbo });
const prog_id = try opengl_impl.compileShaders(); const prog_id = try opengl_impl.program();
defer gl.deleteProgram(prog_id); defer gl.deleteProgram(prog_id);
var event: SDL.SDL_Event = undefined; var event: SDL.SDL_Event = undefined;
@ -175,7 +175,7 @@ pub const Ui = struct {
defer gl.bindFramebuffer(gl.FRAMEBUFFER, 0); defer gl.bindFramebuffer(gl.FRAMEBUFFER, 0);
gl.viewport(0, 0, nds_width, nds_height); gl.viewport(0, 0, nds_width, nds_height);
opengl_impl.drawScreenTexture(top_tex, prog_id, objects, nds9_group.bus.ppu.fb.top(.front)); opengl_impl.drawScreen(top_tex, prog_id, vao_id, nds9_group.bus.ppu.fb.top(.front));
} }
{ {
@ -183,7 +183,7 @@ pub const Ui = struct {
defer gl.bindFramebuffer(gl.FRAMEBUFFER, 0); defer gl.bindFramebuffer(gl.FRAMEBUFFER, 0);
gl.viewport(0, 0, nds_width, nds_height); gl.viewport(0, 0, nds_width, nds_height);
opengl_impl.drawScreenTexture(btm_tex, prog_id, objects, nds9_group.bus.ppu.fb.btm(.front)); opengl_impl.drawScreen(btm_tex, prog_id, vao_id, nds9_group.bus.ppu.fb.btm(.front));
} }
const zgui_redraw = imgui.draw(&self.state, top_out_tex, btm_out_tex, nds9_group.cpu); const zgui_redraw = imgui.draw(&self.state, top_out_tex, btm_out_tex, nds9_group.cpu);
@ -213,44 +213,24 @@ fn panic() noreturn {
} }
const opengl_impl = struct { const opengl_impl = struct {
// zig fmt: off fn drawScreen(tex_id: GLuint, prog_id: GLuint, vao_id: GLuint, buf: []const u8) void {
const vertices: [32]f32 = [_]f32{
// Positions // Colours // Texture Coords
1.0, -1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, // Top Right
1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, // Bottom Right
-1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, // Bottom Left
-1.0, -1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, // Top Left
};
const indices: [6]u32 = [_]u32{
0, 1, 3, // First Triangle
1, 2, 3, // Second Triangle
};
// zig fmt: on
const Objects = struct { vao: GLuint, vbo: GLuint, ebo: GLuint };
fn drawScreenTexture(tex_id: GLuint, prog_id: GLuint, ids: Objects, buf: []const u8) void {
gl.bindTexture(gl.TEXTURE_2D, tex_id); gl.bindTexture(gl.TEXTURE_2D, tex_id);
defer gl.bindTexture(gl.TEXTURE_2D, 0); defer gl.bindTexture(gl.TEXTURE_2D, 0);
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, nds_width, nds_height, gl.RGBA, gl.UNSIGNED_INT_8_8_8_8, buf.ptr); gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, nds_width, nds_height, gl.RGBA, gl.UNSIGNED_INT_8_8_8_8, buf.ptr);
// Bind VAO, EBO. VBO not bound // Bind VAO
gl.bindVertexArray(ids.vao); // VAO gl.bindVertexArray(vao_id); // VAO
defer gl.bindVertexArray(0); defer gl.bindVertexArray(0);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ids.ebo); // EBO
defer gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, 0);
// Use compiled frag + vertex shader // Use compiled frag + vertex shader
gl.useProgram(prog_id); gl.useProgram(prog_id);
defer gl.useProgram(0); defer gl.useProgram(0);
gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_INT, null); gl.drawArrays(gl.TRIANGLE_STRIP, 0, 3);
} }
fn compileShaders() !GLuint { fn program() !GLuint {
const vert_shader = @embedFile("shader/pixelbuf.vert"); const vert_shader = @embedFile("shader/pixelbuf.vert");
const frag_shader = @embedFile("shader/pixelbuf.frag"); const frag_shader = @embedFile("shader/pixelbuf.frag");
@ -270,50 +250,22 @@ const opengl_impl = struct {
if (!shader.didCompile(fs)) return error.FragmentCompileError; if (!shader.didCompile(fs)) return error.FragmentCompileError;
const program = gl.createProgram(); const prog = gl.createProgram();
gl.attachShader(program, vs); gl.attachShader(prog, vs);
gl.attachShader(program, fs); gl.attachShader(prog, fs);
gl.linkProgram(program); gl.linkProgram(prog);
return program; return prog;
} }
// Returns the VAO ID since it's used in run() fn vao() GLuint {
fn createObjects() Objects {
var vao_id: GLuint = undefined; var vao_id: GLuint = undefined;
var vbo_id: GLuint = undefined;
var ebo_id: GLuint = undefined;
gl.genVertexArrays(1, &vao_id); gl.genVertexArrays(1, &vao_id);
gl.genBuffers(1, &vbo_id);
gl.genBuffers(1, &ebo_id);
gl.bindVertexArray(vao_id); return vao_id;
defer gl.bindVertexArray(0);
gl.bindBuffer(gl.ARRAY_BUFFER, vbo_id);
defer gl.bindBuffer(gl.ARRAY_BUFFER, 0);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ebo_id);
defer gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, 0);
gl.bufferData(gl.ARRAY_BUFFER, @sizeOf(@TypeOf(vertices)), &vertices, gl.STATIC_DRAW);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, @sizeOf(@TypeOf(indices)), &indices, gl.STATIC_DRAW);
// Position
gl.vertexAttribPointer(0, 3, gl.FLOAT, gl.FALSE, 8 * @sizeOf(f32), null); // lmao
gl.enableVertexAttribArray(0);
// Colour
gl.vertexAttribPointer(1, 3, gl.FLOAT, gl.FALSE, 8 * @sizeOf(f32), @ptrFromInt((3 * @sizeOf(f32))));
gl.enableVertexAttribArray(1);
// Texture Coord
gl.vertexAttribPointer(2, 2, gl.FLOAT, gl.FALSE, 8 * @sizeOf(f32), @ptrFromInt((6 * @sizeOf(f32))));
gl.enableVertexAttribArray(2);
return .{ .vao = vao_id, .vbo = vbo_id, .ebo = ebo_id };
} }
fn createScreenTexture(buf: []const u8) GLuint { fn screenTex(buf: []const u8) GLuint {
var tex_id: GLuint = undefined; var tex_id: GLuint = undefined;
gl.genTextures(1, &tex_id); gl.genTextures(1, &tex_id);
@ -328,7 +280,7 @@ const opengl_impl = struct {
return tex_id; return tex_id;
} }
fn createOutputTexture() GLuint { fn outTex() GLuint {
var tex_id: GLuint = undefined; var tex_id: GLuint = undefined;
gl.genTextures(1, &tex_id); gl.genTextures(1, &tex_id);
@ -343,7 +295,7 @@ const opengl_impl = struct {
return tex_id; return tex_id;
} }
fn createFrameBuffer(tex_id: GLuint) !GLuint { fn frameBuffer(tex_id: GLuint) !GLuint {
var fbo_id: GLuint = undefined; var fbo_id: GLuint = undefined;
gl.genFramebuffers(1, &fbo_id); gl.genFramebuffers(1, &fbo_id);

View File

@ -1,7 +1,6 @@
#version 330 core #version 330 core
out vec4 frag_color; out vec4 frag_color;
in vec3 color;
in vec2 uv; in vec2 uv;
uniform sampler2D screen; uniform sampler2D screen;

View File

@ -1,13 +1,10 @@
#version 330 core #version 330 core
layout (location = 0) in vec3 pos;
layout (location = 1) in vec3 in_color;
layout (location = 2) in vec2 in_uv;
out vec3 color;
out vec2 uv; out vec2 uv;
const vec2 pos[3] = vec2[3](vec2(-1.0f, -1.0f), vec2(-1.0f, 3.0f), vec2(3.0f, -1.0f));
const vec2 uvs[3] = vec2[3](vec2( 0.0f, 0.0f), vec2( 0.0f, 2.0f), vec2(2.0f, 0.0f));
void main() { void main() {
color = in_color; uv = uvs[gl_VertexID];
uv = in_uv; gl_Position = vec4(pos[gl_VertexID], 0.0, 1.0);
gl_Position = vec4(pos, 1.0); }
}

View File

@ -32,8 +32,8 @@ pub fn draw(state: *const State, top_tex: GLuint, btm_tex: GLuint, arm946es: *Ar
_ = zgui.begin(window_title, .{ .flags = .{ .no_resize = true, .always_auto_resize = true } }); _ = zgui.begin(window_title, .{ .flags = .{ .no_resize = true, .always_auto_resize = true } });
defer zgui.end(); defer zgui.end();
zgui.image(@ptrFromInt(top_tex), .{ .w = w, .h = h, .uv0 = .{ 0, 1 }, .uv1 = .{ 1, 0 } }); zgui.image(@ptrFromInt(top_tex), .{ .w = w, .h = h });
zgui.image(@ptrFromInt(btm_tex), .{ .w = w, .h = h, .uv0 = .{ 0, 1 }, .uv1 = .{ 1, 0 } }); zgui.image(@ptrFromInt(btm_tex), .{ .w = w, .h = h });
} }
return true; return true;