commit | f850f3593d834019e2b66ba62ea8c11d3c29abec | [log] [tgz] |
---|---|---|
author | Michael McLennan <nefario@google.com> | Thu Sep 15 20:07:32 2016 |
committer | Michael McLennan <nefario@google.com> | Thu Sep 15 20:07:32 2016 |
tree | b9e1483da44f2111fefe33846588a256efef8f77 | |
parent | 594c6575f753fbe389a1e19f98598fc7025c844a [diff] |
Changed the definitions for GL_TRUE/GL_FALSE to integers 1/0, to be consistent with the C Language bindings for OpenGL. The boolean values were causing problems when passed into functions like glfwSetWindowShouldClose(), which is faithful to the C Language style. Kept boolean return values, however, so it's easier in Dart to use the result of a function in an if-test or logical operation (without having to add != 0 everywhere). Updated the generator code to support different input/return value maps, and made "bool" map to integer as an input, and map to "bool" as an output. Only a few generated bindings were affected.
NOTE: It is unlikely that programs written with these bindings will work on OSX due to platform requirements that the main thread be the one handling events.
mkdir lib/src/generated/ cd tools ./generate_bindings.sh cp generated/* ../lib/src/generated/
Set DART_INCLUDE, GL_INCLUDE, GL_LIB and GL_LIB_NAME.
cd lib/ dart ../tools/gl_compile.dart
Note that if you set the GL_LIB
variable when compiling, you must also set LD_LIBRARY_PATH
to include the same directory when running your program or the Dart VM will not be able to find libGL.so
/lib$(GL_LIB_NAME).so
.
TODO(hstern): It is convenient for development to use the .so file, but for distribution purposes it is less useful. It would be nice to have an option to use the .a library as well.
Test to work with NVIDIA, just requires building glfw with EGL support.
TODO
If a function's only difference is moving pointer parameters to the return value, it is not listed. See lib/src/manual_bindings.dart
for a full list.
glGetActiveAttrib
doesn't take a bufSize parameter, and returns an ActiveAttrib
instance.glGetActiveUniform
doesn't take a bufSize parameter, and returns an ActiveAttrib
instance.glGetAttachedShaders
doesn't take a maxCount parameter, returns a List<int>
.glGetProgramInfoLog
doesn't take a maxSize parameter, and returns a String
.glGetShaderPrecisionFormat
returns a ShaderPrecisionFormat
instance.glGetShaderSource
doesn't take a bufSize parameter and just returns a String
.glReadPixels
takes a TypedData pixels
parameter and the data is put into it, like in the WebGL API. Your program will most likely crash if the TypedData object you pass in is not big enough, or possibly if it's in the wrong format.glShaderSource
just takes the parameters int shader
and String string
. The original API is not really appropriate for Dart.