{"id":43620681,"url":"https://github.com/kotlin-graphics/gli","last_synced_at":"2026-02-04T13:02:43.074Z","repository":{"id":43174869,"uuid":"86992411","full_name":"kotlin-graphics/gli","owner":"kotlin-graphics","description":"jvm gli","archived":false,"fork":false,"pushed_at":"2023-04-26T08:42:33.000Z","size":9436,"stargazers_count":30,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-17T23:56:43.392Z","etag":null,"topics":["gli","graphics","java","jogl","kotlin","lwjgl","opengl","texture","texture-library"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kotlin-graphics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-04-02T14:41:28.000Z","updated_at":"2023-05-20T23:31:48.000Z","dependencies_parsed_at":"2024-04-07T00:34:04.656Z","dependency_job_id":"6a476a6c-5f1c-45e8-84c6-ff118f0808af","html_url":"https://github.com/kotlin-graphics/gli","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/kotlin-graphics/gli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotlin-graphics%2Fgli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotlin-graphics%2Fgli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotlin-graphics%2Fgli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotlin-graphics%2Fgli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kotlin-graphics","download_url":"https://codeload.github.com/kotlin-graphics/gli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotlin-graphics%2Fgli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29085068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-04T03:31:03.593Z","status":"ssl_error","status_checked_at":"2026-02-04T03:29:50.742Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gli","graphics","java","jogl","kotlin","lwjgl","opengl","texture","texture-library"],"created_at":"2026-02-04T13:02:30.253Z","updated_at":"2026-02-04T13:02:43.068Z","avatar_url":"https://github.com/kotlin-graphics.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"![gli](/src/main/resources/logo-mini.png)\n\n[![Build Status](https://github.com/kotlin-graphics/gli/workflows/build/badge.svg)](https://github.com/kotlin-graphics/gli/actions?workflow=build)\n[![license](https://img.shields.io/badge/License-MIT-orange.svg)](https://github.com/kotlin-graphics/gli/blob/master/LICENSE) \n[![Release](https://jitpack.io/v/kotlin-graphics/gli.svg)](https://jitpack.io/#kotlin-graphics/gli) \n![Size](https://github-size-badge.herokuapp.com/kotlin-graphics/gli.svg)\n[![Github All Releases](https://img.shields.io/github/downloads/kotlin-graphics/gli/total.svg)]()\n[![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin) \n\nThis is the Kotlin port of the original [OpenGL Image](http://gli.g-truc.net/) (*GLI*), written by [g-truc](https://github.com/Groovounet) ([repository](https://github.com/g-truc/gli)), a header only C++ image library for graphics software.\n\n*GLI* provides classes and functions to load image files, facilitate graphics APIs texture creation, compare textures, access texture texels, sample textures, convert textures, generate mipmaps, etc.\n\nThis library works perfectly with *[OpenGL](https://www.opengl.org)* or *[Vulkan](https://www.khronos.org/vulkan)* but it also ensures interoperability with other third party libraries and SDK.\nIt is a good candidate for software rendering (raytracing / rasterization), image processing, image based software testing or any development context that requires a simple and convenient image library.\n\nDon't hesitate to contribute to the project by submitting [issues](https://github.com/kotlin-graphics/gli/issues) or [pull requests](https://github.com/kotlin-graphics/gli/pulls) for bugs and features. Any feedback is welcome at [elect86@gmail.com](mailto://elect86@gmail.com).\n\nKotlin:\n```kotlin\nimport gli_.gli\n\nfun createTexture(filename: String): Int {\n\n    val texture = gli.load(filename)\n    if(texture.empty())\n        return 0\n\n    gli.gl.profile = gl.Profile.GL33\n    val format = gli.gl.translate(texture.format, texture.swizzles)\n    val target = gli.gl.translate(texture.target)\n    assert(texture.format.isCompressed \u0026\u0026 target == gl.Target._2D)\n\n    val textureName = intBufferBig(1)\n    glGenTextures(textureName)\n    glBindTexture(target.i, textureName[0])\n    glTexParameteri(target.i, GL_TEXTURE_BASE_LEVEL, 0)\n    glTexParameteri(target.i, GL_TEXTURE_MAX_LEVEL, texture.levels() - 1)\n    val swizzles = intBufferBig(4)\n    format.swizzles to swizzles\n    glTexParameteriv(target.i, GL_TEXTURE_SWIZZLE_RGBA, swizzles)\n    var extent = texture.extent()\n    glTexStorage2D(target.i, texture.levels(), format.internal.i, extent.x, extent.y)\n    for(level in 0 until texture.levels()) {\n        extent = texture.extent(level)\n        glCompressedTexSubImage2D(\n                target.i, level, 0, 0, extent.x, extent.y,\n                format.internal.i, texture.data(0, 0, level))\n    }\n    val texName = textureName[0]\n    textureName.free()\n    return texName\n}\n```\n\nKotlin with [gl-next](https://github.com/kotlin-graphics/gln):\n```kotlin\n    fun createTexture(filename: String): Int {\n\n        val texture = gli.load(filename)\n        if(texture.empty())\n            return 0\n\n        gli.gl.profile = gl.Profile.GL33\n        val (target, format) = gli.gl.translate(texture)\n        assert(texture.format.isCompressed \u0026\u0026 target == gl.Target._2D)\n\n        return initTexture2d {\n            levels = 0 until texture.levels()\n            swizzles = format.swizzles\n            storage(texture.levels(), format.internal, texture.extent())\n            levels.forEach {\n                compressedSubImage(it, texture.extent(it), format.internal, texture.data(0, 0, it))\n            }\n        }\n    }\n```\n\nJava:\n```java\npublic static int createTexture(String filename) {\n\n    Texture texture = gli.load(filename);\n    if (texture.empty())\n        return 0;\n\n    gli_.gli.gl.setProfile(gl.Profile.GL33);\n    gl.Format format = gli_.gli.gl.translate(texture.getFormat(), texture.getSwizzles());\n    gl.Target target = gli_.gli.gl.translate(texture.getTarget());\n    assert (texture.getFormat().isCompressed() \u0026\u0026 target == gl.Target._2D);\n\n    IntBuffer textureName = intBufferBig(1);\n    glGenTextures(textureName);\n    glBindTexture(target.getI(), textureName.get(0));\n    glTexParameteri(target.getI(), GL12.GL_TEXTURE_BASE_LEVEL, 0);\n    glTexParameteri(target.getI(), GL12.GL_TEXTURE_MAX_LEVEL, texture.levels() - 1);\n    IntBuffer swizzles = intBufferBig(4);\n    texture.getSwizzles().to(swizzles);\n    glTexParameteriv(target.getI(), GL33.GL_TEXTURE_SWIZZLE_RGBA, swizzles);\n    Vec3i extent = texture.extent(0);\n    glTexStorage2D(target.getI(), texture.levels(), format.getInternal().getI(), extent.x, extent.y);\n    for (int level = 0; level \u003c texture.levels(); level++) {\n        extent = texture.extent(level);\n        glCompressedTexSubImage2D(\n            target.getI(), level, 0, 0, extent.x, extent.y,\n            format.getInternal().getI(), texture.data(0, 0, level));\n    }\n    int texName = textureName.get(0);\n    MemoryUtil.memFree(textureName);\n    return texName\n}\n```\n\n### Supported Image Formats\n\n* [KTX](https://www.khronos.org/opengles/sdk/tools/KTX/) \n* [DDS](https://msdn.microsoft.com/en-us/library/windows/desktop/bb943990%28v=vs.85%29.aspx)\n* KMG\n* jpg\n* png\n* gif\n* bmp\n* tga\n\n\n### How to retrieve it:\n\n```kotlin\nrepositories {\n    maven(\"https://raw.githubusercontent.com/kotlin-graphics/mary/master\")\n    // or with magik plugin\n    //github(\"kotlin-graphics/mary\")\n}\ndependencies {\n    implementation(\"kotlin.graphics:gli:0.8.3.0-20\")\n}\n```\n\nYou can find more info by [mary](https://github.com/kotlin-graphics/mary)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkotlin-graphics%2Fgli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkotlin-graphics%2Fgli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkotlin-graphics%2Fgli/lists"}