gl: Null terminate strings automatically in Strs()
Strs func claims to work with go strings,(non null-terminated) but doesn’t add x00, and shadersource requires them, if length not specified.
opengl doc for ShaderSource
If length is NULL, each string is assumed to be null terminated.
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 22 (12 by maintainers)
I had the same problem with Go strings not being null terminated. Example:
I spent a couple hours debugging my application as it was producing undefined behavior where my shaders would randomly not render anything. The problem is fixed by adding a
\x00to the end of the string literal for the uniform variable name.Most newcomers like myself to this go-gl API will probably make this mistake.
lol! dmitshur, I actually did that and managed to get it going a couple of hours before your reply! Thank you very much for the reply in any case! (btw, I am writing in Skycoin’s CX. See Skycoin/CX or Skycoin.net)