mirror of
https://github.com/bloeys/nmage.git
synced 2025-12-29 13:28:20 +00:00
Correct loading of png textures to match opengl coords
This commit is contained in:
@ -50,7 +50,7 @@ func LoadPNGTexture(file string) (Texture, error) {
|
||||
|
||||
//NOTE: We only support 8-bit channels (32-bit colors) for now
|
||||
i := 0
|
||||
for y := 0; y < img.Bounds().Dy(); y++ {
|
||||
for y := img.Bounds().Dy() - 1; y >= 0; y-- {
|
||||
for x := 0; x < img.Bounds().Dx(); x++ {
|
||||
|
||||
c := color.NRGBAModel.Convert(img.At(x, y)).(color.NRGBA)
|
||||
|
||||
7
main.go
7
main.go
@ -26,6 +26,7 @@ import (
|
||||
//Flesh out the material system
|
||||
|
||||
//Low Priority:
|
||||
// Abstract keys enum away from sdl
|
||||
// Abstract UI
|
||||
// Proper Asset loading
|
||||
|
||||
@ -137,8 +138,10 @@ func (g *OurGame) Update() {
|
||||
}
|
||||
|
||||
//Rotating cubes
|
||||
modelMat.Rotate(10*timing.DT()*gglm.Deg2Rad, gglm.NewVec3(1, 1, 1).Normalize())
|
||||
simpleMat.SetUnifMat4("modelMat", &modelMat.Mat4)
|
||||
if input.KeyDown(sdl.K_SPACE) {
|
||||
modelMat.Rotate(10*timing.DT()*gglm.Deg2Rad, gglm.NewVec3(1, 1, 1).Normalize())
|
||||
simpleMat.SetUnifMat4("modelMat", &modelMat.Mat4)
|
||||
}
|
||||
|
||||
imgui.DragFloat3("Cam Pos", &camPos.Data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user