Git Product home page Git Product logo

Comments (4)

ikskuh avatar ikskuh commented on August 16, 2024 1

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.

heysokam avatar heysokam commented on August 16, 2024 1

@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.

ikskuh avatar ikskuh commented on August 16, 2024

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.

GeezerLMAO avatar GeezerLMAO commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.