Comments (4)
You have to make sure to have an OpenGL 4.5 Core context, otherwise those functions won't go away:
zig build run error(OpenGL): entry point glGetnTexImage not found! error(OpenGL): entry point glGetnUniformdv not found!
As you can see here and here, those functions are included in GL 4.5, but not earlier. zgl
requires a 4.5 context
from zgl.
@MasterQ32 This should be a basic example in the readme
I had to dig for 1h just to make it build correctly
Please add some compiling guidelines in a basic example somewhere
It feels unnecesary to have such friction for starting to use a library
from zgl.
You have to invoke the function loadExtensions
(which is misnamed) to get all function calls loaded.
See https://github.com/ziglibs/zgl/blob/master/zgl.zig#L2206-L2208 and https://github.com/MasterQ32/zig-opengl#example
from zgl.
I Tried to implement it and spits an error. I think my problem is that I don't know what to substitute ?gl.FunctionPointer
to
Error:
zig build run
error(OpenGL): entry point glGetnTexImage not found!
error(OpenGL): entry point glGetnUniformdv not found!
error: EntryPointNotFound
main.zig:20:5: 0x7ff767cdb403 in main (TestGL.exe.obj)
try gl.loadExtensions(proc, glGetProcAddress);
^
The following command exited with error code 1 (expected 0):
bin\TestGL.exe
error: UnexpectedExitCode
C:\Zig-SDK\Zig\lib\std\build\RunStep.zig:277:17: 0x7ff7718da740 in runCommand (build.exe.obj)
return error.UnexpectedExitCode;
^
C:\Zig-SDK\Zig\lib\std\build\RunStep.zig:183:5: 0x7ff7718baccb in make (build.exe.obj)
try runCommand(
^
C:\Zig-SDK\Zig\lib\std\build.zig:3660:9: 0x7ff77185fd59 in make (build.exe.obj)
try self.makeFn(self);
^
C:\Zig-SDK\Zig\lib\std\build.zig:509:9: 0x7ff77184c4cc in makeOneStep (build.exe.obj)
try s.make();
^
C:\Zig-SDK\Zig\lib\std\build.zig:503:17: 0x7ff77184c445 in makeOneStep (build.exe.obj)
return err;
^
C:\Zig-SDK\Zig\lib\std\build.zig:464:13: 0x7ff77184c198 in make (build.exe.obj)
try self.makeOneStep(s);
^
C:\Zig-SDK\Zig\lib\build_runner.zig:223:21: 0x7ff77184f0f0 in main (build.exe.obj)
else => return err,
Code:
const std = @import("std");
const glfw = @import("glfw");
const gl = @import("zgl");
fn glGetProcAddress(p: glfw.GLProc, proc: [:0]const u8) ?*const anyopaque {
_ = p;
return glfw.getProcAddress(proc);
}
pub fn main() !void {
try glfw.init(.{});
defer glfw.terminate();
const window = try glfw.Window.create(1024, 576, "Hello World", null, null, .{});
defer window.destroy();
try glfw.makeContextCurrent(window);
const proc: glfw.GLProc = undefined;
try gl.loadExtensions(proc, glGetProcAddress);
while (!window.shouldClose()) {
try glfw.pollEvents();
gl.clear(.{ .color = true, .depth = true, .stencil = false });
try window.swapBuffers();
}
}
from zgl.
Related Issues (19)
- Follow zig's new packaging system (Add a build.zig.zon file) HOT 1
- Build failure - no module named 'zgl' available within module zgl
- vertexAttribPointer() panics for some reason. HOT 2
- Program.uniform1i function name conflict HOT 1
- Types for offsets: usize vs ?usize vs ?*c_void
- Inconsistency between Type and ElementType
- Inability to pass null to bufferData/namedBufferData
- Remove OpenGL-Registry submodule? HOT 1
- Add a version of activeTexture which allows integers HOT 1
- Cannot use createTexture in mac HOT 3
- Linking fails with 'undefined reference to' libdl functions. HOT 8
- How do I use the new bindings with SDL.zig? HOT 4
- orelse @panic check for each opengl call in release mode?
- SIGSEGV when calling any function HOT 1
- Code won't build with latest 0.11 version of Zig HOT 3
- BufferMapTarget duplicates BufferTarget
- Put emphasis on the "incrementally"
- Instructions of usage and setup HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zgl.