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

No examples #1

Open
define-private-public opened this issue Nov 18, 2016 · 6 comments
Open

No examples #1

define-private-public opened this issue Nov 18, 2016 · 6 comments

Comments

@define-private-public
Copy link

Hi. I'm interested in using this package, but the examples/ directory is barren, except for some import statements. Could you please provide a more robust example of how to use the bindings?

@gmpreussner
Copy link
Member

There are many OpenGL ES tutorials on the internet. The bindings follow the naming conventions of the C API.

@define-private-public
Copy link
Author

It's not that I don't know OpenGL, it's that there is no sample code for this API. For example, I'm able to get the buffers binding, but I'm hitting a brick wall with the glShaderSource() proc to accept the string argument I'm providing it.

It would really help me (and others) if there was a very minimal example.

@gmpreussner
Copy link
Member

Oh I see, I misunderstood then, sorry. I'm currently completely overloaded with work stuff and won't have any time to work on this package until after GDC. I'll see if I can find out about the string parameter in glShaderSource though. I just converted the GLES API directly to Nim, and not all interfaces may be convenient as a result. If you have suggestions for improvements, I'm accepting pull requests as well :)

@gmpreussner gmpreussner reopened this Nov 23, 2016
@define-private-public
Copy link
Author

Thanks for reopening this. Do you have any ideas about how to translate the Nim string to the GlChar ptr ptr? The Nim forums weren't able to help me out with that one. The only thing I could think of is going through character by character and converting it, but that doesn't feel right to me.

@define-private-public
Copy link
Author

I was able to get over that hurdle. Expect a working example soon enough.

@define-private-public
Copy link
Author

Okay, So I've been running into an issue trying to use glVertexAttribPointer(). It's where I'm passing in GL_FLOAT as the third parameter.

Here is my call:

var
  attribIndex = 0.GlUint
  attribSize = 3.GlInt
  attribStride = 0.GlSizei

glVertexAttribPointer(attribIndex, attribSize, GL_FLOAT, GL_FALSE, attribStride, cast[pointer](nil))

What the compiler is telling me is this:

home/ben/Desktop/nim-glfw-example/src/main.nim(68, 22) Error: type mismatch: got (GlUint, GlInt, typedesc[GlFloat], int literal(0), GlSizei, pointer)
but expected one of: 
proc glVertexAttribPointer(index: GlUint; size: GlInt; `type`: GlEnum;
                          normalized: GlBoolean; stride: GlSizei; pointer: pointer)

Do you have an idea of what to do here?

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

2 participants