Skip to content
Zero-overhead 2D rendering library for JOGL using Kotlin
Branch: master
Clone or download
Latest commit f32a081 May 20, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea Initial commit Oct 1, 2016
gradle/wrapper Added license Oct 1, 2016
src/main/kotlin/org/anglur/joglext Made some static objects to prevent GC Oct 1, 2016
.gitignore Initial commit Oct 1, 2016
.travis.yml Added travis, bintray Oct 1, 2016
LICENSE Create LICENSE Oct 1, 2016 Update May 20, 2017
build.gradle Updated dependencies May 20, 2017 Added license Oct 1, 2016
gradlew Initial commit Oct 1, 2016
gradlew.bat Initial commit Oct 1, 2016
settings.gradle Added license Oct 1, 2016


Zero-overhead 2D rendering library for JOGL

Build Status license

This library is licensed under Apache License 2.0.

JOGL2D is an open source Kotlin library that provides easy 2D graphics rendering capabilities to JOGL without adding any overhead whatsoever (memory/CPU). JOGL2D is a lightweight, resource friendly, stripped down version of brandonborkholder's glg2d.

How Can I Use JOGL2D?

Simply add JOGL2D to your JOGL application using your favourite dependancy management systems.


compile 'org.anglur:joglext:1.0.2'



Once added, it is very easy to implement. Start off by making a GLEventListener

object OpenGLOverlay : GLEventListener {
    private val WINDOW_WIDTH = 500
    private val WINDOW_HEIGHT = 500
    private val FPS = 60
    val window = GLWindow.create(GLCapabilities(null))
    init {
    fun open(width: Int = WINDOW_WIDTH, height: Int = WINDOW_HEIGHT, x: Int = 100, y: Int = 1000) {
        val animator = FPSAnimator(window, FPS, true)
        window.addWindowListener(object : WindowAdapter() {
            override fun windowDestroyNotify(e: WindowEvent) {
                thread {
                    if (animator.isStarted)
        window.setSize(width, height)
        window.setPosition(x, y)
        window.title = "Hello world"
        window.isVisible = true
    val g = GLGraphics2D() //Create GL2D wrapper
    override fun display(gLDrawable: GLAutoDrawable) {
        val gl2 =
        g.prePaint(gLDrawable.context) //Updated wrapper to latest glContext
        g.color = Color.RED
        g.drawRect(0, 0, 200, 200)
        g.color = Color.YELLOW
        g.drawLine(0, 0, 100, 100)
        g.color = Color.CYAN
        g.drawString("OpenGL 2D Made Easy! :D", 100, 100)
    override fun init(glDrawable: GLAutoDrawable) {
    override fun reshape(gLDrawable: GLAutoDrawable, x: Int, y: Int, width: Int, height: Int) {
        val gl =
        gl.glViewport(0, 0, width, height)
    override fun dispose(gLDrawable: GLAutoDrawable) {


Alt text

Huge credits again to @brandonborkholder for open sourcing his G2D library here:

You can’t perform that action at this time.