func (wc WindowCoords) Enter() { w, h := GetViewportWH() Matrix{gl.PROJECTION}.Enter() if !wc.NoReset { gl.LoadIdentity() } if wc.Invert { gl.Ortho(0, float64(w), float64(h), 0, -1, 1) } else { gl.Ortho(0, float64(w), 0, float64(h), -1, 1) } Matrix{gl.MODELVIEW}.Enter() gl.LoadIdentity() }
func (v *Video) Reshape(width int, height int) { x_offset := 0 y_offset := 0 r := ((float64)(height)) / ((float64)(width)) if r > 0.9375 { // Height taller than ratio h := (int)(math.Floor((float64)(0.9375 * (float64)(width)))) y_offset = (height - h) / 2 height = h } else if r < 0.9375 { // Width wider var scrW, scrH float64 if ppu.OverscanEnabled { scrW = 240.0 scrH = 224.0 } else { scrW = 256.0 scrH = 240.0 } w := (int)(math.Floor((float64)((scrH / scrW) * (float64)(height)))) x_offset = (width - w) / 2 width = w } gl.Viewport(x_offset, y_offset, width, height) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(-1, 1, -1, 1, -1, 1) gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() gl.Disable(gl.DEPTH_TEST) }
func Reshape(w, h int) { gl.Viewport(0, 0, w, h) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, 100, 0, 100, -1, 1) gl.MatrixMode(gl.MODELVIEW) }
func initWindow() { // Function called to do the re-rendering glut.DisplayFunc(display) // Called when the visibility of the program changes glut.VisibilityFunc(visible) // Called when a regular ascii character is pressed glut.KeyboardFunc(keyboardIn) // Called when any non-ascii character is pressed glut.SpecialFunc(specialIn) // Called when the size of the window changes glut.ReshapeFunc(reshape) // affect our projection matrix gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() // Load an identity matrix -> projection // Specify the bounds of the of our scene gl.Ortho(0, 40, 0, 40, 0, 40) // Now affect our modelview matrix gl.MatrixMode(gl.MODELVIEW) // Make points be rendererd larger gl.PointSize(3.0) currentWindow = glut.GetWindow() }
func InitDisplay() { gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, 100, 0, 100, -1, 1) gl.MatrixMode(gl.MODELVIEW) gl.PointSize(3.0) }
func reshape(w, h int) { gl.Viewport(0, 0, w, h) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, float64(w), 0, float64(h), -1, 1) gl.Scalef(1, -1, 1) gl.Translatef(0, float32(-h), 0) gl.MatrixMode(gl.MODELVIEW) }
func initGL() { gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Viewport(0, 0, 800, 600) gl.Ortho(0, 800, 600, 0, -1.0, 1.0) gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() gl.ClearColor(0.1, 0.05, 0.0, 1.0) }
func main() { _ = fmt.Sprint() if !glfw.Init() { panic("Can't init glfw!") } defer glfw.Terminate() // antialiasing //glfw.WindowHint(glfw.Samples, 4) window, err = glfw.CreateWindow(WindowWidth, WindowHeight, "Mozaik", nil, nil) if err != nil { panic(err) } defer window.Destroy() // Ensure thread context window.MakeContextCurrent() //glfw.SwapInterval(1) window.SetKeyCallback(keyCb) window.SetMouseButtonCallback(mouseCb) gl.Init() gl.ClearColor(0.9, 0.85, 0.46, 0.0) // useless in 2D gl.Disable(gl.DEPTH_TEST) // antialiasing gl.Enable(gl.BLEND) gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA) gl.Enable(gl.LINE_SMOOTH) for i := int32(32); i < 72; i++ { font := loadFonts(i) defer font.Release() fonts = append(fonts, font) } // Compute window radius windowRadius = math.Sqrt(math.Pow(WindowHeight, 2) + math.Pow(WindowWidth, 2)) // Use window coordinates gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, WindowWidth, WindowHeight, 0, 0, 1) gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() g = NewGame() g.Start() go eventLoop(g) go renderLoop(g) Main() g.Stop() }
// TODO Dynamically fetch size and render accordingly. func onResize(w, h int) { gl.Viewport(0, 0, w, h) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, float64(w), float64(h), 0, -1, 1) gl.ClearColor(0.255, 0.255, 0.255, 0) gl.Clear(gl.COLOR_BUFFER_BIT) gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() // log.Printf("resized: %dx%d\n", w, h) }
// onResize sets up a simple 2d ortho context based on the window size func onResize(window *glfw.Window, w, h int) { w, h = window.GetSize() // query window to get screen pixels width, height := window.GetFramebufferSize() gl.Viewport(0, 0, width, height) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, float64(w), 0, float64(h), -1, 1) gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() gl.ClearColor(1, 1, 1, 1) }
func reshape(w, h int) { // Write to both buffers, prevent flickering gl.DrawBuffer(gl.FRONT_AND_BACK) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Viewport(0, 0, w, h) gl.Ortho(0, float64(w), float64(h), 0, -1.0, 1.0) gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() }
func setupGL(w, h int) { gl.Viewport(0, 0, w, h) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, float64(w), float64(h), 0, 0, 1) gl.ShadeModel(gl.SMOOTH) gl.ClearColor(1, 1, 1, 0) gl.Enable(gl.BLEND) gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA) gl.Disable(gl.DEPTH_TEST) gl.Hint(gl.LINE_SMOOTH_HINT|gl.LINE_SMOOTH_HINT, gl.NICEST) }
func onResize(w, h int) { // Write to both buffers, prevent flickering gl.DrawBuffer(gl.FRONT_AND_BACK) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Viewport(0, 0, w, h) gl.Ortho(0, float64(w), float64(h), 0, -1.0, 1.0) gl.ClearColor(1, 1, 1, 0) gl.Clear(gl.COLOR_BUFFER_BIT) gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() }
func Reshape(width, height int) { gl.Viewport(0, 0, width, height) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(-1, 1, -1, 1, -1, 1) //gl.Ortho(-2.1, 6.1, -2.25*2, 2.1*2, -1, 1) // Y debug gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() gl.ClearColor(0, 0, 0, 1) gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) }
func reshapeWindow(window *glfw.Window, width, height int) { ratio := float64(width) / float64(height) gameWidth = ratio * fieldSize gameHeight = fieldSize gl.Viewport(0, 0, width, height) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, gameWidth, 0, gameHeight, -1.0, 1.0) gl.MatrixMode(gl.MODELVIEW) if wireframe { gl.PolygonMode(gl.FRONT_AND_BACK, gl.LINE) } }
func reshape(w, h int) { /* Because Gil specified "screen coordinates" (presumably with an upper-left origin), this short bit of code sets up the coordinate system to correspond to actual window coodrinates. This code wouldn't be required if you chose a (more typical in 3D) abstract coordinate system. */ gl.Viewport(0, 0, w, h) /* Establish viewing area to cover entire window. */ gl.MatrixMode(gl.PROJECTION) /* Start modifying the projection matrix. */ gl.LoadIdentity() /* Reset project matrix. */ gl.Ortho(0, float64(w), 0, float64(h), -1, 1) /* Map abstract coords directly to window coords. */ gl.Scalef(1, -1, 1) /* Invert Y axis so increasing Y goes down. */ gl.Translatef(0, float32(-h), 0) /* Shift origin up to upper-left corner. */ }
func initGL() { gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, 1024, 768, 0, -1, 1) gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() gl.Enable(gl.DEPTH_TEST) // hexTex = initTexture("hex5k", HEX_WIDTH, HEX_HEIGHT) hexTex = initTexture2("hex") wallpaper = initTexture("dark_wood_@2X", 1024, 768) // starTex = initTexture("hexstark", HEX_WIDTH, HEX_HEIGHT) starTex = initTexture2("star") borderTex = initTexture("hexborder", 76, 76) }
// onResize handles window resize events. func onResize(w, h int) { if w < 1 { w = 1 } if h < 1 { h = 1 } gl.Viewport(0, 0, w, h) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, float64(w), float64(h), 0, 0, 1) gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() }
// Called to adjust the projection matrix func fixProjection(win *glfw.Window, w, h int) { if w < 1 { w = 1 } if h < 1 { h = 1 } gl.Viewport(0, 0, w, h) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() // it's a 2d game, so use orthographic projection gl.Ortho(0, float64(w), float64(h), 0, 0, 1) gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() }
// Draws the contents of the framebuffer at the requested width and height. func (fb *Framebuffer) Draw(w int, h int) { gl.Viewport(0, 0, w, h) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, 1, 0, 1, 1, -1) gl.Enable(gl.TEXTURE_2D) fb.Texture.Bind(gl.TEXTURE_2D) gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() gl.Begin(gl.QUADS) gl.TexCoord2d(0, 0) gl.Vertex3f(0.0, 0.0, 0) gl.TexCoord2d(1, 0) gl.Vertex3f(1.0, 0.0, 0) gl.TexCoord2d(1, 1) gl.Vertex3f(1.0, 1.0, 0) gl.TexCoord2d(0, 1) gl.Vertex3f(0.0, 1.0, 0) gl.End() gl.Flush() }
func main() { fmt.Printf("Launching cardgame...\n") glfw.SetErrorCallback(onError) if !glfw.Init() { panic("OpenGL initialization failed.") } defer glfw.Terminate() window, err := glfw.CreateWindow(800, 600, "Cardgame", nil, nil) if err != nil { panic(err) } window.MakeContextCurrent() window.SetTitle("Cardgame") screenWidth, screenHeight := GetScreenSize() window.SetPosition(screenWidth/2-400, screenHeight/2-300) gl.Init() gl.ClearColor(0.5, 0.5, 0.75, 0) gl.Ortho(0, 800, 0, 600, 0, 1) playfield := NewPlayfield() for !window.ShouldClose() { gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) //gl.LoadIdentity() playfield.Draw() window.SwapBuffers() glfw.PollEvents() } }
func (s *Display) init(title string, screenSizeMultiplier int) error { s.Name = PREFIX + "-SCREEN" log.Printf("%s: Initialising display", s.Name) var err error s.ScreenSizeMultiplier = screenSizeMultiplier log.Printf("%s: Set screen size multiplier to %dx", s.Name, s.ScreenSizeMultiplier) glfw.OpenWindowHint(glfw.WindowNoResize, 1) err = glfw.OpenWindow(SCREEN_WIDTH*s.ScreenSizeMultiplier, SCREEN_HEIGHT*s.ScreenSizeMultiplier, 0, 0, 0, 0, 0, 0, glfw.Windowed) if err != nil { return err } glfw.SetWindowTitle(title) //resize function onResize := func(w, h int) { gl.Viewport(0, 0, w, h) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, float64(w), float64(h), 0, -1, 1) gl.ClearColor(0.255, 0.255, 0.255, 0) gl.Clear(gl.COLOR_BUFFER_BIT) gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() } glfw.SetWindowSizeCallback(onResize) desktopMode := glfw.DesktopMode() glfw.SetWindowPos((desktopMode.W-SCREEN_WIDTH*s.ScreenSizeMultiplier)/2, (desktopMode.H-SCREEN_HEIGHT*s.ScreenSizeMultiplier)/2) gl.ClearColor(0.255, 0.255, 0.255, 0) return nil }
func Reshape(width, height int) { if DoneThisFrame(ReshapeWindow) { return } gl.Viewport(0, 0, width, height) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(-2.1, 6.1, -2.25, 2.1, -1, 1) //gl.Ortho(-2.1, 6.1, -2.25*2, 2.1*2, -1, 1) // Y debug gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) if Draw != nil { gl.DrawBuffer(gl.FRONT_AND_BACK) Draw() gl.DrawBuffer(gl.BACK) } }
func (v *video) init() error { // Disclaimer: I'm an absolute noob in openGL and I just slammed the // keyboard with my text editor open, until it started to produce usable // results. I don't fully understand everything I'm doing here. if err := glfw.Init(); err != nil { return err } err := glfw.OpenWindow(screenWidth*pixelSize, screenHeight*pixelSize, 0, 0, 0, 0, 0, 0, glfw.Windowed) if err != nil { return err } // Enable vertical sync on cards that support it. glfw.SetSwapInterval(1) glfw.SetWindowTitle("nictuku's CHIP-8 emulator") gl.Init() if err = glh.CheckGLError(); err != nil { return err } gl.ClearColor(0, 0, 0, 0) gl.MatrixMode(gl.PROJECTION) // Change coordinates to range from [0, 64] and [0,32]. gl.Ortho(0, screenWidth, screenHeight, 0, 0, 1) // Unnecessary sanity check. :-P if glfw.WindowParam(glfw.Opened) == 0 { return fmt.Errorf("No window opened") } return nil }
func main() { sdl.Init(sdl.INIT_VIDEO) var screen = sdl.SetVideoMode(640, 480, 32, sdl.OPENGL) if screen == nil { panic("sdl error") } if gl.Init() != 0 { panic("gl error") } gl.MatrixMode(gl.PROJECTION) gl.Viewport(0, 0, int(screen.W), int(screen.H)) gl.LoadIdentity() gl.Ortho(-5, 5, -2.5, 2.5, -1.0, 1.0) gl.ClearColor(0, 0, 0, 0) gl.Clear(gl.COLOR_BUFFER_BIT) gl.PolygonMode(gl.FRONT_AND_BACK, gl.LINE) tess := glu.NewTess() tess.SetBeginCallback(tessBeginHandler) tess.SetVertexCallback(tessVertexHandler) tess.SetEndCallback(tessEndHandler) tess.SetErrorCallback(tessErrorHandler) tess.SetEdgeFlagCallback(tessEdgeFlagHandler) tess.SetCombineCallback(tessCombineHandler) tess.Normal(0, 0, 1) var running = true for running { gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() gl.Translated(-2.5, 0, 0) tess.BeginPolygon(nil) tess.BeginContour() for v := range OuterContour { tess.Vertex(OuterContour[v], &OuterContour[v]) } tess.EndContour() tess.BeginContour() for v := range InnerContour { tess.Vertex(InnerContour[v], &InnerContour[v]) } tess.EndContour() tess.EndPolygon() gl.Translated(5, 0, 0) tess.BeginPolygon(nil) tess.BeginContour() for v := range StarContour { tess.Vertex(StarContour[v], &StarContour[v]) } tess.EndContour() tess.EndPolygon() sdl.GL_SwapBuffers() sdl.Delay(25) } tess.Delete() sdl.Quit() }
func (v *Viewport) SetupTransform() { gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, 0, float64(v.w), float64(v.h), -100, 100) gl.Translatef(float32(-v.x), float32(-v.y), 0) }
// Printf draws the given string at the specified coordinates. // It expects the string to be a single line. Line breaks are not // handled as line breaks and are rendered as glyphs. // // In order to render multi-line text, it is up to the caller to split // the text up into individual lines of adequate length and then call // this method for each line seperately. func (f *Font) Printf(x, y float32, fs string, argv ...interface{}) error { indices := []rune(fmt.Sprintf(fs, argv...)) if len(indices) == 0 { return nil } // Runes form display list indices. // For this purpose, they need to be offset by -FontConfig.Low low := f.Config.Low for i := range indices { indices[i] -= low } var vp [4]int32 gl.GetIntegerv(gl.VIEWPORT, vp[:]) gl.PushAttrib(gl.TRANSFORM_BIT) gl.MatrixMode(gl.PROJECTION) gl.PushMatrix() gl.LoadIdentity() gl.Ortho(float64(vp[0]), float64(vp[2]), float64(vp[1]), float64(vp[3]), 0, 1) gl.PopAttrib() gl.PushAttrib(gl.LIST_BIT | gl.CURRENT_BIT | gl.ENABLE_BIT | gl.TRANSFORM_BIT) { gl.MatrixMode(gl.MODELVIEW) gl.Disable(gl.LIGHTING) gl.Disable(gl.DEPTH_TEST) gl.Enable(gl.BLEND) gl.Enable(gl.TEXTURE_2D) gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA) gl.TexEnvf(gl.TEXTURE_ENV, gl.TEXTURE_ENV_MODE, gl.MODULATE) f.Texture.Bind(gl.TEXTURE_2D) var mv [16]float32 gl.GetFloatv(gl.MODELVIEW_MATRIX, mv[:]) gl.PushMatrix() { gl.LoadIdentity() mgw := float32(f.maxGlyphWidth) mgh := float32(f.maxGlyphHeight) switch f.Config.Dir { case LeftToRight, TopToBottom: gl.Translatef(x, float32(vp[3])-y-mgh, 0) case RightToLeft: gl.Translatef(x-mgw, float32(vp[3])-y-mgh, 0) } gl.MultMatrixf(&mv) gl.CallLists(len(indices), gl.UNSIGNED_INT, indices) } gl.PopMatrix() f.Texture.Unbind(gl.TEXTURE_2D) } gl.PopAttrib() gl.PushAttrib(gl.TRANSFORM_BIT) gl.MatrixMode(gl.PROJECTION) gl.PopMatrix() gl.PopAttrib() return glh.CheckGLError() }
func resize(w int, h int) { gl.Viewport(0, 0, w, h) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(-1, 1, -1, 1, -1, 1) }
func main() { runtime.LockOSThread() flag.Parse() buildPalette() sdl.Init(sdl.INIT_VIDEO) defer sdl.Quit() sdl.GL_SetAttribute(sdl.GL_SWAP_CONTROL, 1) if sdl.SetVideoMode(512, 512, 32, sdl.OPENGL) == nil { panic("sdl error") } if gl.Init() != 0 { panic("gl error") } sdl.WM_SetCaption("Gomandel", "Gomandel") gl.Enable(gl.TEXTURE_2D) gl.Viewport(0, 0, 512, 512) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(0, 512, 512, 0, -1, 1) gl.ClearColor(0, 0, 0, 0) //----------------------------------------------------------------------------- var dndDragging bool = false var dndStart Point var dndEnd Point var tex gl.Texture var tc TexCoords var lastProgress int initialRect := Rect{-1.5, -1.5, 3, 3} rect := initialRect rc := new(MandelbrotRequest) rc.MakeRequest(512, 512, rect) rc.WaitFor(Small, &tex, &tc) running := true for running { for e := sdl.PollEvent(); e != nil; e = sdl.PollEvent() { switch e.(type) { case *sdl.QuitEvent: running = false case *sdl.MouseButtonEvent: mbe := e.(*sdl.MouseButtonEvent) if mbe.Type == sdl.MOUSEBUTTONDOWN { dndDragging = true sdl.GetMouseState(&dndStart.X, &dndStart.Y) dndEnd = dndStart } else { dndDragging = false sdl.GetMouseState(&dndEnd.X, &dndEnd.Y) if mbe.Which == 3 { rect = initialRect } else { rect = rectFromSelection(dndStart, dndEnd, 512, 512, rect) tc = texCoordsFromSelection(dndStart, dndEnd, 512, 512, tc) } // make request rc.MakeRequest(512, 512, rect) } case *sdl.MouseMotionEvent: if dndDragging { sdl.GetMouseState(&dndEnd.X, &dndEnd.Y) } } } // if we're waiting for a result, check if it's ready p := rc.Update(&tex, &tc) if p != -1 { lastProgress = p } gl.Clear(gl.COLOR_BUFFER_BIT) tex.Bind(gl.TEXTURE_2D) drawQuad(0, 0, 512, 512, tc.TX, tc.TY, tc.TX2, tc.TY2) tex.Unbind(gl.TEXTURE_2D) if dndDragging { drawSelection(dndStart, dndEnd) } drawProgress(512, 512, lastProgress, rc.Pending) sdl.GL_SwapBuffers() } }
func (block *Block) BuildTexture() { block.tex = glh.NewTexture(1024, 256) block.tex.Init() // TODO: use runtime.SetFinalizer() to clean up/delete the texture? glh.With(block.tex, func() { //gl.TexParameteri(gl.TEXTURE_2D, gl.GENERATE_MIPMAP, gl.TRUE) //gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR) gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_NEAREST) gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST) // TODO: Only try and activate anisotropic filtering if it is available gl.TexParameterf(gl.TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, MaxAnisotropy) gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAX_LEVEL, 1) }) for i := 0; i < 2; i++ { glh.With(&glh.Framebuffer{Texture: block.tex, Level: i}, func() { glh.With(glh.Attrib{gl.COLOR_BUFFER_BIT}, func() { gl.ClearColor(1, 0, 0, 0) gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) }) viewport_proj := glh.Compound(glh.Attrib{gl.VIEWPORT_BIT}, glh.Matrix{gl.PROJECTION}) glh.With(viewport_proj, func() { gl.Viewport(0, 0, block.tex.W/(1<<uint(i)), block.tex.H/(1<<uint(i))) gl.LoadIdentity() //gl.Ortho(0, float64(tex.w), 0, float64(tex.h), -1, 1) gl.Ortho(-2, -2+WIDTH, 2, -2, -1, 1) glh.With(glh.Matrix{gl.MODELVIEW}, func() { gl.LoadIdentity() //gl.Hint(gl.LINES, gl.NICEST) //gl.LineWidth(4) /* glh.With(glh.Primitive{gl.LINES}, func() { gl.Color4f(1, 1, 1, 1) gl.Vertex2f(-2, 0) gl.Vertex2f(2, 0) }) */ gl.PointSize(4) glh.With(glh.Matrix{gl.MODELVIEW}, func() { gl.Translated(0, -2, 0) gl.Scaled(1, 4/float64(block.nrecords), 1) block.vertex_data.Render(gl.POINTS) }) /* gl.Color4f(0.5, 0.5, 1, 1) With(Primitive{gl.LINE_LOOP}, func() { b := 0.2 Squared(-2.1+b, -2.1+b, 4.35-b*2, 4.2-b*2) }) */ }) }) }) } //block.img = block.tex.AsImage() if !block.detail_needed { block.vertex_data = nil runtime.GC() } blocks_rendered++ }