From 0f569807e2e99625948b4e88a87b75baacd8fa60 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 31 Dec 2014 02:46:37 +0900 Subject: [PATCH] Bug fix: rename short32Size -> float32Size --- internal/opengl/internal/shader/drawtexture.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/opengl/internal/shader/drawtexture.go b/internal/opengl/internal/shader/drawtexture.go index 8ae6ff85b..6ea834597 100644 --- a/internal/opengl/internal/shader/drawtexture.go +++ b/internal/opengl/internal/shader/drawtexture.go @@ -44,7 +44,7 @@ const size = 10000 // TODO: Use unsafe.SizeOf? const uint16Size = 2 -const short32Size = 4 +const float32Size = 4 func DrawTexture(native gl.Texture, projectionMatrix [4][4]float64, quads TextureQuads, geo Matrix, color Matrix) error { // TODO: Check len(quads) and gl.MAX_ELEMENTS_INDICES? @@ -56,7 +56,7 @@ func DrawTexture(native gl.Texture, projectionMatrix [4][4]float64, quads Textur vertexBuffer := gl.GenBuffer() vertexBuffer.Bind(gl.ARRAY_BUFFER) - s := short32Size * stride * size + s := float32Size * stride * size gl.BufferData(gl.ARRAY_BUFFER, s, nil, gl.DYNAMIC_DRAW) indexBuffer := gl.GenBuffer() @@ -94,8 +94,8 @@ func DrawTexture(native gl.Texture, projectionMatrix [4][4]float64, quads Textur vertexAttrLocation.DisableArray() }() - vertexAttrLocation.AttribPointer(2, gl.FLOAT, false, stride, uintptr(short32Size*0)) - texCoordAttrLocation.AttribPointer(2, gl.FLOAT, false, stride, uintptr(short32Size*2)) + vertexAttrLocation.AttribPointer(2, gl.FLOAT, false, stride, uintptr(float32Size*0)) + texCoordAttrLocation.AttribPointer(2, gl.FLOAT, false, stride, uintptr(float32Size*2)) vertices := []float32{} for i := 0; i < quads.Len(); i++ { @@ -108,7 +108,7 @@ func DrawTexture(native gl.Texture, projectionMatrix [4][4]float64, quads Textur x1, y1, u1, v1, ) } - gl.BufferSubData(gl.ARRAY_BUFFER, 0, short32Size*len(vertices), vertices) + gl.BufferSubData(gl.ARRAY_BUFFER, 0, float32Size*len(vertices), vertices) gl.DrawElements(gl.TRIANGLES, 6*quads.Len(), gl.UNSIGNED_SHORT, uintptr(0)) gl.Flush()