Browse Source

added compressed textures support

Nicolas Cannasse 6 years ago
parent
commit
60e7536043
4 changed files with 21 additions and 1 deletions
  1. 2 0
      libs/sdl/GLImports.h
  2. 10 0
      libs/sdl/gl.c
  3. 1 1
      libs/sdl/haxelib.json
  4. 8 0
      libs/sdl/sdl/GL.hx

+ 2 - 0
libs/sdl/GLImports.h

@@ -80,6 +80,8 @@ GL_IMPORT(glQueryCounter, QUERYCOUNTER);
 GL_IMPORT(glBlendEquation, BLENDEQUATION);
 GL_IMPORT(glActiveTexture, ACTIVETEXTURE);
 GL_IMPORT(glTexImage3D, TEXIMAGE3D);
+GL_IMPORT(glCompressedTexImage2D, COMPRESSEDTEXIMAGE2D);
+GL_IMPORT(glCompressedTexImage3D, COMPRESSEDTEXIMAGE3D);
 #endif
 
 #if defined(HL_NX)

+ 10 - 0
libs/sdl/gl.c

@@ -326,6 +326,14 @@ HL_PRIM void HL_NAME(gl_tex_image2d_multisample)( int target, int samples, int i
 	glTexImage2DMultisample(target, samples, internalFormat, width, height, fixedsamplelocations);
 }
 
+HL_PRIM void HL_NAME(gl_compressed_tex_image2d)( int target, int level, int internalFormat, int width, int height, int border, int imageSize, vbyte *image ) {
+	glCompressedTexImage2D(target,level,internalFormat,width,height,border,imageSize,image);
+}
+
+HL_PRIM void HL_NAME(gl_compressed_tex_image3d)( int target, int level, int internalFormat, int width, int height, int depth, int border, int imageSize, vbyte *image ) {
+	glCompressedTexImage3D(target,level,internalFormat,width,height,depth,border,imageSize,image);
+}
+
 HL_PRIM void HL_NAME(gl_generate_mipmap)( int t ) {
 	glGenerateMipmap(t);
 }
@@ -662,6 +670,8 @@ DEFINE_PRIM(_VOID,gl_tex_parameterf,_I32 _I32 _F32);
 DEFINE_PRIM(_VOID,gl_tex_image2d,_I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _BYTES);
 DEFINE_PRIM(_VOID,gl_tex_image3d,_I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _BYTES);
 DEFINE_PRIM(_VOID,gl_tex_image2d_multisample,_I32 _I32 _I32 _I32 _I32 _BOOL);
+DEFINE_PRIM(_VOID,gl_compressed_tex_image2d,_I32 _I32 _I32 _I32 _I32 _I32 _I32 _BYTES);
+DEFINE_PRIM(_VOID,gl_compressed_tex_image3d,_I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _BYTES);
 DEFINE_PRIM(_VOID,gl_generate_mipmap,_I32);
 DEFINE_PRIM(_VOID,gl_delete_texture,_NULL(_I32));
 DEFINE_PRIM(_VOID,gl_blit_framebuffer,_I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32);

+ 1 - 1
libs/sdl/haxelib.json

@@ -4,7 +4,7 @@
 	"license" : "BSD",
 	"contributors" : ["ncannasse"],
 	"description" : "SDL/GL support for Haxe/HL.",
-	"version" : "1.9.0",
+	"version" : "1.10.0",
 	"releasenote" : "",
 	"dependencies": { "hlopenal" : "" }
 }

+ 8 - 0
libs/sdl/sdl/GL.hx

@@ -225,6 +225,14 @@ class GL {
 	public static function texImage2DMultisample( target : Int, internalFormat : Int, samples : Int, width : Int, height : Int, fixedsamplelocations : Bool ) {
 	}
 
+	@:hlNative("sdl","gl_compressed_tex_image2d")
+	public static function compressedTexImage2D( target : Int, level : Int, internalFormat : Int, width : Int, height : Int, border : Int, imageSize : Int, image : hl.Bytes ) {
+	}
+
+	@:hlNative("sdl","gl_compressed_tex_image3d")
+	public static function compressedTexImage3D( target : Int, level : Int, internalFormat : Int, width : Int, height : Int, depth : Int, border : Int, imageSize : Int, image : hl.Bytes ) {
+	}
+
 	public static function generateMipmap( t : Int ) {
 	}