Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glfw

Solod bindings for glfw, a multi-platform library for OpenGL, OpenGL ES and Vulkan development.

Usage

  1. Install glfw for your operating system.

  2. Install the Solod bindings.

go get solod.dev/glfw@latest
  1. Use it in your code.
package main

import (
	"solod.dev/glfw/libglfw"
	"solod.dev/so/c"
	"solod.dev/so/fmt"
	"solod.dev/so/os"
)

func main() {
	if libglfw.Init() == 0 {
		fmt.Println("Can't initialize glfw")
		os.Exit(1)
	}
	defer libglfw.Terminate()
	fmt.Println("glfw version:", c.String(libglfw.GetVersionString()))
}

OpenGL

The bindings cover glfw itself, not OpenGL. glfw opens the window and creates the GL context; the drawing calls (glClear and friends) come from the OpenGL headers, so declare the ones you use in your own package:

//so:include <OpenGL/gl.h>

//so:extern GL_COLOR_BUFFER_BIT
var GL_COLOR_BUFFER_BIT c.UInt

//so:extern glClear
func glClear(mask c.UInt)

Linking them is up to the build: -framework OpenGL on macOS, -lGL elsewhere. See example/simple/extern.go and the Makefile.

Examples

Empty window

About

Solod bindings for GLFW

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages