go-gl / gl

Go bindings for OpenGL (generated via glow)
MIT License
1.07k stars 74 forks source link

Is there some problem diagnostic package? #66

Closed im7mortal closed 7 years ago

im7mortal commented 7 years ago

I mean something like

func checkFramebufferStatus(fbo uint32) bool {
    // check FBO status
    gl.BindFramebuffer(gl.FRAMEBUFFER, fbo); // bind
        defer  gl.BindFramebuffer(gl.FRAMEBUFFER, 0) //unbind
    status := gl.CheckFramebufferStatus(gl.FRAMEBUFFER);
    switch status {
    case gl.FRAMEBUFFER_COMPLETE:
        println("Framebuffer complete.")
        return true;

    case gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
        println("[ERROR] Framebuffer incomplete: Attachment is NOT complete.")
        return false

    case gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
        println("[ERROR] Framebuffer incomplete: No image is attached to FBO.")
        return false

    case gl.FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
        println("[ERROR] Framebuffer incomplete: Draw buffer.")
        return false

    case gl.FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
        println("[ERROR] Framebuffer incomplete: Read buffer.")
        return false

    case gl.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
        println("[ERROR] Framebuffer incomplete: Multisample.")
        return false

    case gl.FRAMEBUFFER_UNSUPPORTED:
        println("[ERROR] Framebuffer incomplete: Unsupported by FBO implementation.")
        return false

    default:
        println("[ERROR] Framebuffer incomplete: Unknown error.")
        return false
    }
    return false
}

I saw https://github.com/go-gl/gldebug. It's more low level stuff. Can I push my diagnostic code in that repository?

dmitshur commented 7 years ago

Are you describing something like a detailed OpenGL error checking package that can be used during development (but turned off for production use, to improve performance)?

I don't know of such a package off the top of my head.

I'm not sure how applicable or well-maintained gldebug is. It seems to be more about retrieving GPU vendor information than what you described. /cc @pwaller

If you're looking for the best place for creating a new package that solves your needs, I'd recommend you create it under your github username. That's most efficient since you wouldn't be blocked by anyone's response time. If you wish to move it to go-gl organization later to have a nicer import path, you can propose doing that after it's ready.

pwaller commented 7 years ago

Thanks for getting involved! If you want to add to the gldebug package, that's a :+1: from me. But as @shurcooL said, it's probably best to first start it out in your own github repository and then once it's good enough we can move it. How does that sound?

im7mortal commented 7 years ago

@shurcooL @pwaller Thank you for fast response! I got it.