Skip to content

Instantly share code, notes, and snippets.

@ajstarks
Created September 3, 2012 02:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajstarks/3606391 to your computer and use it in GitHub Desktop.
Save ajstarks/3606391 to your computer and use it in GitHub Desktop.
OpenVG + Go
//
// first OpenVG program
// Anthony Starks (ajstarks@gmail.com)
//
//
package main
import (
"fmt"
"github.com/ajstarks/openvg"
)
func main() {
width, height := openvg.Init() // OpenGL, etc initialization
w2 := float64(width / 2)
h2 := float64(height / 2)
w := float64(width)
openvg.Start(width, height) // Start the picture
openvg.Background(0, 0, 0) // Black background
openvg.Fill(44, 77, 232, 1) // Big blue marble
openvg.Circle(w2, 0, w) // The "world"
openvg.Fill(255, 255, 255, 1) // White text
openvg.TextMid(w2, h2, "hello, world", "serif", width/10) // Greetings
openvg.End() // End the picture
var done int
fmt.Scanf("%d", &done)
openvg.Finish() // Graphics cleanup
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment