diff --git a/libs/sdl/GLImports.h b/libs/sdl/GLImports.h index 82ed26f2d..ba0ad3148 100644 --- a/libs/sdl/GLImports.h +++ b/libs/sdl/GLImports.h @@ -19,6 +19,7 @@ GL_IMPORT(glPixelStorei, PIXELSTOREI); GL_IMPORT(glPolygonMode, POLYGONMODE); GL_IMPORT(glPolygonOffset, POLYGONMODE); GL_IMPORT(glCullFace, CULLFACE); +GL_IMPORT(glFrontFace, FRONTFACE); GL_IMPORT(glBlendFunc, BLENDFUNC); GL_IMPORT(glBlendEquation, BLENDEQUATION); GL_IMPORT(glDepthMask, DEPTHMASK); @@ -93,8 +94,14 @@ GL_IMPORT(glDeleteBuffers, DELETEBUFFERS); GL_IMPORT(glMemoryBarrier, MEMORYBARRIER); GL_IMPORT(glBindImageTexture, BINDIMAGETEXTURE); GL_IMPORT(glUniform1i, UNIFORM1I); +GL_IMPORT(glUniform3fv, UNIFORM3FV); GL_IMPORT(glUniform4fv, UNIFORM4FV); +GL_IMPORT(glUniformMatrix3fv, UNIFORMMATRIX4FV); GL_IMPORT(glUniformMatrix4fv, UNIFORMMATRIX4FV); +GL_IMPORT(glUniform1f, UNIFORM1F); +GL_IMPORT(glUniform2f, UNIFORM2F); +GL_IMPORT(glUniform3f, UNIFORM3F); +GL_IMPORT(glUniform4f, UNIFORM4F); GL_IMPORT(glGetShaderiv, GETSHADERIV); GL_IMPORT(glGetProgramiv, GETPROGRAMIV); GL_IMPORT(glVertexAttribPointer, VERTEXATTRIBPOINTER); diff --git a/libs/sdl/gl.c b/libs/sdl/gl.c index 74efd7717..c34b4d024 100644 --- a/libs/sdl/gl.c +++ b/libs/sdl/gl.c @@ -172,6 +172,10 @@ HL_PRIM void HL_NAME(gl_cull_face)( int face ) { glCullFace(face); } +HL_PRIM void HL_NAME(gl_front_face)( int direction ) { + glFrontFace(direction); +} + HL_PRIM void HL_NAME(gl_blend_func)( int src, int dst ) { glBlendFunc(src, dst); } @@ -573,10 +577,34 @@ HL_PRIM void HL_NAME(gl_uniform1i)( vdynamic *u, int i ) { glUniform1i(u->v.i, i); } +HL_PRIM void HL_NAME(gl_uniform3fv)( vdynamic *u, vbyte *buffer, int bufPos, int count ) { + glUniform3fv(u->v.i, count, (float*)buffer + bufPos); +} + HL_PRIM void HL_NAME(gl_uniform4fv)( vdynamic *u, vbyte *buffer, int bufPos, int count ) { glUniform4fv(u->v.i, count, (float*)buffer + bufPos); } +HL_PRIM void HL_NAME(gl_uniform1f)( vdynamic *u, double x ) { + glUniform1f(u->v.i, (float)x); +} + +HL_PRIM void HL_NAME(gl_uniform2f)( vdynamic *u, double x, double y ) { + glUniform2f(u->v.i, (float)x, (float)y); +} + +HL_PRIM void HL_NAME(gl_uniform3f)( vdynamic *u, double x, double y, double z ) { + glUniform3f(u->v.i, (float)x, (float)y, (float)z); +} + +HL_PRIM void HL_NAME(gl_uniform4f)( vdynamic *u, double x, double y, double z, double w ) { + glUniform4f(u->v.i, (float)x, (float)y, (float)z, (float)w); +} + +HL_PRIM void HL_NAME(gl_uniform_matrix3fv)( vdynamic *u, bool transpose, vbyte *buffer, int bufPos, int count ) { + glUniformMatrix3fv(u->v.i, count, transpose ? GL_TRUE : GL_FALSE, (float*)buffer + bufPos); +} + HL_PRIM void HL_NAME(gl_uniform_matrix4fv)( vdynamic *u, bool transpose, vbyte *buffer, int bufPos, int count ) { glUniformMatrix4fv(u->v.i, count, transpose ? GL_TRUE : GL_FALSE, (float*)buffer + bufPos); } @@ -758,6 +786,7 @@ DEFINE_PRIM(_VOID,gl_polygon_offset,_F32 _F32); DEFINE_PRIM(_VOID,gl_enable,_I32); DEFINE_PRIM(_VOID,gl_disable,_I32); DEFINE_PRIM(_VOID,gl_cull_face,_I32); +DEFINE_PRIM(_VOID,gl_front_face,_I32); DEFINE_PRIM(_VOID,gl_blend_func,_I32 _I32); DEFINE_PRIM(_VOID,gl_blend_func_separate,_I32 _I32 _I32 _I32); DEFINE_PRIM(_VOID,gl_blend_equation,_I32); @@ -832,8 +861,14 @@ DEFINE_PRIM(_VOID,gl_vertex_attrib_pointer,_I32 _I32 _I32 _BOOL _I32 _I32); DEFINE_PRIM(_VOID,gl_vertex_attrib_ipointer,_I32 _I32 _I32 _I32 _I32); DEFINE_PRIM(_VOID,gl_delete_buffer,_NULL(_I32)); DEFINE_PRIM(_VOID,gl_uniform1i,_NULL(_I32) _I32); +DEFINE_PRIM(_VOID,gl_uniform3fv,_NULL(_I32) _BYTES _I32 _I32); DEFINE_PRIM(_VOID,gl_uniform4fv,_NULL(_I32) _BYTES _I32 _I32); +DEFINE_PRIM(_VOID,gl_uniform_matrix3fv,_NULL(_I32) _BOOL _BYTES _I32 _I32); DEFINE_PRIM(_VOID,gl_uniform_matrix4fv,_NULL(_I32) _BOOL _BYTES _I32 _I32); +DEFINE_PRIM(_VOID,gl_uniform1f,_NULL(_I32) _F64); +DEFINE_PRIM(_VOID,gl_uniform2f,_NULL(_I32) _F64 _F64); +DEFINE_PRIM(_VOID,gl_uniform3f,_NULL(_I32) _F64 _F64 _F64); +DEFINE_PRIM(_VOID,gl_uniform4f,_NULL(_I32) _F64 _F64 _F64 _F64); DEFINE_PRIM(_VOID,gl_bind_image_texture,_I32 _I32 _I32 _BOOL _I32 _I32 _I32); DEFINE_PRIM(_VOID,gl_dispatch_compute,_I32 _I32 _I32); DEFINE_PRIM(_VOID,gl_memory_barrier,_I32); diff --git a/libs/sdl/sdl/GL.hx b/libs/sdl/sdl/GL.hx index a31e44a96..cf5cc57aa 100644 --- a/libs/sdl/sdl/GL.hx +++ b/libs/sdl/sdl/GL.hx @@ -111,6 +111,9 @@ class GL { public static function cullFace( face : Int ) { } + public static function frontFace( direction : Int ) { + } + public static function blendFunc( src : Int, dst : Int ) { } @@ -150,6 +153,9 @@ class GL { return null; } + public static function deleteProgram( p : Program ) { + } + public static function bindFragDataLocation( p : Program, colorNumber : Int, name : String ) : Void { } @@ -387,12 +393,30 @@ class GL { public static function uniform1i( u : Uniform, i : Int ) { } + public static function uniform3fv( u : Uniform, buffer : hl.Bytes, bufPos : Int, count : Int ) { + } + public static function uniform4fv( u : Uniform, buffer : hl.Bytes, bufPos : Int, count : Int ) { } + public static function uniformMatrix3fv( u : Uniform, transpose : Bool, buffer : hl.Bytes, bufPos : Int, count : Int ) { + } + public static function uniformMatrix4fv( u : Uniform, transpose : Bool, buffer : hl.Bytes, bufPos : Int, count : Int ) { } + public static function uniform1f( u : Uniform, x : Float ) { + } + + public static function uniform2f( u : Uniform, x : Float, y : Float ) { + } + + public static function uniform3f( u : Uniform, x : Float, y : Float, z : Float ) { + } + + public static function uniform4f( u : Uniform, x : Float, y : Float, z : Float, w : Float ) { + } + // compute public static function dispatchCompute( num_groups_x : Int, num_groups_y : Int, num_groups_z : Int ) {