Skip to content
UNofficial Opengl SDK
Branch: master
Clone or download
Latest commit 0cdc6a3 May 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper
src glfw::createWindowSurface, switched arg positions May 21, 2019
.gitignore
.travis.yml Create .travis.yml Dec 13, 2017
LICENSE Initial commit Jan 22, 2017
README.md Awesome kotlin badge Mar 6, 2019
build.gradle ⬆️ vkk May 24, 2019
gradlew
gradlew.bat first commit Jan 22, 2017
settings.gradle - kotlin 1.1.2 eap73 Apr 20, 2017

README.md

unofficial-opengl-SDK

Build Status license Release Awesome Kotlin Badge Slack Status

This is kind of a small suite, born and shaped around GL, it includes the gln dependencies, such as unsigned support, glm and gli. Its main usage is basically as wrapper for the lwjgl glfw binding.

A kind of a gln for glfw. So, code more compact, type-safe, clear and intuitive. You can have up and running a whole gl clear example in just a couple of lines:

        glfw.init("3.3")

        val window = GlfwWindow(1280, 720, "ImGui Lwjgl OpenGL3 example").apply {
            init()
        }
        
        glClearColor(1f, 0f, 0f, 0f)

        window.loop {
            glClear(GL_COLOR_BUFFER_BIT)
        }

One cool feature is that it supports multiple listeners of the same type, like CharCallback:

var charCallback: CharCallbackT? = null
   get() = charCallbacks.getOrfirst(defaultKey)
   set(value) {
       charCallbacks[defaultKey] = value
       field = value
   }
val charCallbacks = sortedMapOf<String, CharCallbackT>()
val nCharCallback = GLFWCharCallbackI { _, codePoint -> charCallbacks.values.forEach { it(codePoint) } }

nCharCallback where n stays for native is the only and real callback

charCallback is just a comfortable interface to automatically set/get a single callback

charCallbacks is the SortedMap containing all the current callbacks

I've been chosen that so they can be easier ordered, the default callback has always this key:

val defaultKey = "0 - default"

I actually asked for this multi-callback in the native glfw, but in the meanwhile we can already use it. And this is also faster because it's all on the jvm!

Plus some other small utils like:

  • methods for allocating very easily many different type of buffers from a lot of different data type, such as different arrays and so on.
  • an cap class for a deep and complete resume about a machine opengl capabilities
  • matrixStack for glm
  • glsl utils (to refresh)
  • an experimental kotlin stlib on intBuffers. So that you can for example textureName.forEach(::glDestroyTexture)
  • mousePole, an util for camera management
  • and attempt to port stb completely on jvm (unfinished)
  • timer util

And lately it also includes a counterpart of gln for vulkan, vkk, plus an util for making short-live allocations easy and free, appBuffer.

Don't hesitate to contribute to the project by submitting issues or pull requests for bugs and features. Any feedback is welcome at elect86@gmail.com.

Credits:

You can’t perform that action at this time.