Hi there, thanks for your awesome library! It is refreshingly easy to use!
I'm trying to use it to render a sequence of images in a glfwcanvas, but when I update the image with a new one, it keeps switching between the new and the old image. Here's a snippet of my code:
win, cv, err := glfwcanvas.CreateWindow(defaultWidth, defaultHeight, windowTitle)
if err != nil {
panic(err)
}
var lastRefresh int64
win.MainLoop(func() {
// This call returns a new image and the last timestamp it was updated
img, lastUpdate := client.Screen()
imgWidth := img.Bounds().Max.X
imgHeight := img.Bounds().Max.Y
// If the image is empty, terminate loop
if imgWidth == 0 || imgHeight == 0 {
return
}
// If there were no changes, terminate loop
if lastRefresh == lastUpdate {
return
}
// Process screen updates
cv.PutImageData(img.(*image.RGBA), 0, 0)
lastRefresh = lastUpdate
})
I tried to use cv.DrawImage() but then it does not show anything. What am I doing wrong?
Hi there, thanks for your awesome library! It is refreshingly easy to use!
I'm trying to use it to render a sequence of images in a
glfwcanvas, but when I update the image with a new one, it keeps switching between the new and the old image. Here's a snippet of my code:I tried to use
cv.DrawImage()but then it does not show anything. What am I doing wrong?