Update examples

This commit is contained in:
Milan Nikolic 2021-11-11 16:36:32 +01:00
parent 2013bc4628
commit 7b91ce25fb
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75
8 changed files with 32 additions and 36 deletions

View file

@ -1,7 +1,7 @@
package main
import (
"github.com/gen2brain/raylib-go/raylib"
rl "github.com/gen2brain/raylib-go/raylib"
)
const numProcesses = 8
@ -35,9 +35,9 @@ func main() {
rl.InitWindow(screenWidth, screenHeight, "raylib [textures] example - image processing")
image := rl.LoadImage("parrots.png") // Loaded in CPU memory (RAM)
image := rl.LoadImage("parrots.png") // Loaded in CPU memory (RAM)
rl.ImageFormat(image, rl.UncompressedR8g8b8a8) // Format image to RGBA 32bit (required for texture update)
texture := rl.LoadTextureFromImage(image) // Image converted to texture, GPU memory (VRAM)
texture := rl.LoadTextureFromImage(image) // Image converted to texture, GPU memory (VRAM)
currentProcess := None
textureReload := false
@ -98,8 +98,8 @@ func main() {
break
}
pixels := rl.GetImageData(image) // Get pixel data from image (RGBA 32bit)
rl.UpdateTexture(texture, pixels) // Update texture with new image data
pixels := rl.LoadImageColors(image) // Get pixel data from image (RGBA 32bit)
rl.UpdateTexture(texture, pixels) // Update texture with new image data
textureReload = false
}