Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot pass GLRepeat to glTexParameteri without manually casting to cint before #88

Open
heysokam opened this issue Nov 6, 2022 · 1 comment

Comments

@heysokam
Copy link

heysokam commented Nov 6, 2022

  • What is the current behaviour?
    Failure to compile, when writing:
glTexParameteri(GLTexture2D, GLTextureWrapS, GLRepeat)  <------ GLRepeat is GLenum, not GLint
# From nimgl/opengl
GL_REPEAT* = 0x2901.GLenum
proc glTexParameteri*(target: GLenum, pname: GLenum, param: GLint): void {.stdcall, importc.}
glTexParameteri*: proc(target: GLenum, pname: GLenum, param: GLint): void {.stdcall.}
# Solved manually with:
glTexParameteri(GLTexture2D, GLTextureWrapS, GLRepeat.cint)
  • Please provide the steps to reproduce and if possible a minimal demo of the problem
    As above

  • What is the expected behaviour?
    Being able to pass GLRepeat to glTexParameteri, without having to manually cast it to cint

  • Please tell us about your environment

    • NimGL Version: [ 1.3.2 ]
    • OS: [ Linux ]
    • Bindings: [ OpenGL ]
    • Backend: [ C ]
    • Nim Version: [ 1.7.1 ]
    • Compiler used: [ GCC ]
  • Other information
    (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, docs.gl, documentation etc)
    Not sure what else is needed. I think the case is fairly clear with that code, but let me know if I'm missing something important.

@heysokam
Copy link
Author

heysokam commented Nov 6, 2022

I just found that a similar case happens with this here

let format = GLrgb
glTexImage2D(GLTexture2D, 0, format.GLint,    # Notice this should be GLenum, but proc expects GLint
    tex.png.width.GLsizei, tex.png.height.GLsizei, 0, format, # But works correctly here
    GLUnsignedByte, tex.pix.addr)
proc glTexImage2D*(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, `type`: GLenum, pixels: pointer): void {.stdcall, importc.}
glTexImage2D*: proc(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, `type`: GLenum, pixels: pointer): void {.stdcall.}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant