GL.getVertexAttribOffset and .drawElements should use pointer type (not int)
This commit is contained in:
@@ -821,7 +821,7 @@ class HTML5GLRenderContext {
|
||||
}
|
||||
|
||||
|
||||
public inline function drawElements (mode:Int, count:Int, type:Int, offset:Int):Void {
|
||||
public inline function drawElements (mode:Int, count:Int, type:Int, offset:Dynamic /*GLintptr*/):Void {
|
||||
|
||||
__context.drawElements (mode, count, type, offset);
|
||||
|
||||
@@ -1096,7 +1096,7 @@ class HTML5GLRenderContext {
|
||||
}
|
||||
|
||||
|
||||
public inline function getVertexAttribOffset (index:Int, pname:Int):Int {
|
||||
public inline function getVertexAttribOffset (index:Int, pname:Int):Dynamic /*GLintptr*/ {
|
||||
|
||||
return __context.getVertexAttribOffset (index, pname);
|
||||
|
||||
|
||||
@@ -454,7 +454,7 @@ class NativeCFFI {
|
||||
@:cffi private static function lime_gl_disable (cap:Int):Void;
|
||||
@:cffi private static function lime_gl_disable_vertex_attrib_array (index:Int):Void;
|
||||
@:cffi private static function lime_gl_draw_arrays (mode:Int, first:Int, count:Int):Void;
|
||||
@:cffi private static function lime_gl_draw_elements (mode:Int, count:Int, type:Int, offset:Int):Void;
|
||||
@:cffi private static function lime_gl_draw_elements (mode:Int, count:Int, type:Int, offset:CFFIPointer):Void;
|
||||
@:cffi private static function lime_gl_enable (cap:Int):Void;
|
||||
@:cffi private static function lime_gl_enable_vertex_attrib_array (index:Int):Void;
|
||||
@:cffi private static function lime_gl_finish ():Void;
|
||||
@@ -491,7 +491,7 @@ class NativeCFFI {
|
||||
@:cffi private static function lime_gl_get_uniform (program:CFFIPointer, location:Int):Dynamic;
|
||||
@:cffi private static function lime_gl_get_uniform_location (program:CFFIPointer, name:String):Int;
|
||||
@:cffi private static function lime_gl_get_vertex_attrib (index:Int, pname:Int):Int;
|
||||
@:cffi private static function lime_gl_get_vertex_attrib_offset (index:Int, pname:Int):Int;
|
||||
@:cffi private static function lime_gl_get_vertex_attrib_offset (index:Int, pname:Int):CFFIPointer;
|
||||
@:cffi private static function lime_gl_hint (target:Int, mode:Int):Void;
|
||||
@:cffi private static function lime_gl_is_buffer (buffer:CFFIPointer):Bool;
|
||||
@:cffi private static function lime_gl_is_enabled (cap:Int):Bool;
|
||||
|
||||
@@ -988,7 +988,7 @@ class NativeGLRenderContext {
|
||||
}
|
||||
|
||||
|
||||
public function drawElements (mode:Int, count:Int, type:Int, offset:Int):Void {
|
||||
public function drawElements (mode:Int, count:Int, type:Int, offset:CFFIPointer):Void {
|
||||
|
||||
#if (lime_cffi && lime_opengl && !macro)
|
||||
NativeCFFI.lime_gl_draw_elements (mode, count, type, offset);
|
||||
@@ -1478,7 +1478,7 @@ class NativeGLRenderContext {
|
||||
}
|
||||
|
||||
|
||||
public function getVertexAttribOffset (index:Int, pname:Int):Int {
|
||||
public function getVertexAttribOffset (index:Int, pname:Int):CFFIPointer {
|
||||
|
||||
#if (lime_cffi && lime_opengl && !macro)
|
||||
return NativeCFFI.lime_gl_get_vertex_attrib_offset (index, pname);
|
||||
|
||||
@@ -387,7 +387,7 @@ extern class GLRenderContext {
|
||||
public function disable (cap:Int):Void;
|
||||
public function disableVertexAttribArray (index:Int):Void;
|
||||
public function drawArrays (mode:Int, first:Int, count:Int):Void;
|
||||
public function drawElements (mode:Int, count:Int, type:Int, offset:Int):Void;
|
||||
public function drawElements (mode:Int, count:Int, type:Int, offset:Dynamic):Void;
|
||||
public function enable (cap:Int):Void;
|
||||
public function enableVertexAttribArray (index:Int):Void;
|
||||
public function finish ():Void;
|
||||
@@ -425,7 +425,7 @@ extern class GLRenderContext {
|
||||
public function getUniform (program:GLProgram, location:GLUniformLocation):Dynamic;
|
||||
public function getUniformLocation (program:GLProgram, name:String):GLUniformLocation;
|
||||
public function getVertexAttrib (index:Int, pname:Int):Dynamic;
|
||||
public function getVertexAttribOffset (index:Int, pname:Int):Int;
|
||||
public function getVertexAttribOffset (index:Int, pname:Int):Dynamic;
|
||||
public function hint (target:Int, mode:Int):Void;
|
||||
public function isBuffer (buffer:GLBuffer):Bool;
|
||||
public function isContextLost ():Bool;
|
||||
|
||||
@@ -618,9 +618,14 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
void lime_gl_draw_elements (int inMode, int inCount, int inType, int inOffset) {
|
||||
void lime_gl_draw_elements (int inMode, int inCount, int inType, value inOffset) {
|
||||
|
||||
glDrawElements (inMode, inCount, inType, (void *)(intptr_t)inOffset);
|
||||
if (!val_is_null (inOffset)) {
|
||||
|
||||
GLintptr indices = reinterpret_cast<uintptr_t> (val_data (inOffset));
|
||||
glDrawElements (inMode, inCount, inType, (void *)indices);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1425,11 +1430,11 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
int lime_gl_get_vertex_attrib_offset (int index, int name) {
|
||||
value lime_gl_get_vertex_attrib_offset (int index, int name) {
|
||||
|
||||
int result = 0;
|
||||
GLintptr result = 0;
|
||||
glGetVertexAttribPointerv (index, name, (void **)&result);
|
||||
return result;
|
||||
return CFFIPointer ((void*)(uintptr_t)result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user