Allow gl.vertexAttribPointer without allocating array

This commit is contained in:
Joshua Granick
2015-07-24 10:28:00 -07:00
parent 1e8298260c
commit 61ea90d647
2 changed files with 31 additions and 2 deletions

View File

@@ -2176,7 +2176,16 @@ class GL {
#if (js && html5 && !display)
context.vertexAttribPointer (indx, size, type, normalized, stride, offset);
#elseif ((cpp || neko || nodejs) && lime_opengl)
lime_gl_vertex_attrib_pointer (indx, size, type, normalized, stride, offset);
if (normalized) {
lime_gl_vertex_attrib_pointer_1 (indx, size, type, stride, offset);
} else {
lime_gl_vertex_attrib_pointer_2 (indx, size, type, stride, offset);
}
//lime_gl_vertex_attrib_pointer (indx, size, type, normalized, stride, offset);
#end
}
@@ -2330,6 +2339,8 @@ class GL {
private static var lime_gl_vertex_attrib4f = System.load ("lime", "lime_gl_vertex_attrib4f", 5);
private static var lime_gl_vertex_attrib4fv = System.load ("lime", "lime_gl_vertex_attrib4fv", 2);
private static var lime_gl_vertex_attrib_pointer = System.load ("lime", "lime_gl_vertex_attrib_pointer", -1);
private static var lime_gl_vertex_attrib_pointer_1 = System.load ("lime", "lime_gl_vertex_attrib_pointer_1", 5);
private static var lime_gl_vertex_attrib_pointer_2 = System.load ("lime", "lime_gl_vertex_attrib_pointer_2", 5);
private static var lime_gl_viewport = System.load ("lime", "lime_gl_viewport", 4);
#end

View File

@@ -1594,7 +1594,7 @@ namespace lime {
value lime_gl_vertex_attrib_pointer (value *arg, int nargs) {
enum { aIndex, aSize, aType, aNormalized, aStride, aOffset, aSIZE };
enum { aIndex, aSize, aType, aNormalized, aStride, aOffset };
glVertexAttribPointer (val_int (arg[aIndex]), val_int (arg[aSize]), val_int (arg[aType]), val_bool (arg[aNormalized]), val_int (arg[aStride]), (void *)(intptr_t)val_int (arg[aOffset]));
return alloc_null ();
@@ -1602,6 +1602,22 @@ namespace lime {
}
value lime_gl_vertex_attrib_pointer_1 (value index, value size, value type, value stride, value offset) {
glVertexAttribPointer (val_int (index), val_int (size), val_int (type), true, val_int (stride), (void *)(intptr_t)val_int (offset));
return alloc_null ();
}
value lime_gl_vertex_attrib_pointer_2 (value index, value size, value type, value stride, value offset) {
glVertexAttribPointer (val_int (index), val_int (size), val_int (type), false, val_int (stride), (void *)(intptr_t)val_int (offset));
return alloc_null ();
}
value lime_gl_vertex_attrib1f (value inLocation, value inV0) {
glVertexAttrib1f (val_int (inLocation), val_number (inV0));
@@ -1858,6 +1874,8 @@ namespace lime {
DEFINE_PRIM (lime_gl_viewport, 4);
DEFINE_PRIM (lime_gl_version, 0);
DEFINE_PRIM_MULT (lime_gl_vertex_attrib_pointer);
DEFINE_PRIM (lime_gl_vertex_attrib_pointer_1, 5);
DEFINE_PRIM (lime_gl_vertex_attrib_pointer_2, 5);
DEFINE_PRIM (lime_gl_vertex_attrib1f, 2);
DEFINE_PRIM (lime_gl_vertex_attrib1fv, 2);
DEFINE_PRIM (lime_gl_vertex_attrib2f, 3);