Resolve TODOs

This commit is contained in:
Hajime Hoshi 2015-01-09 02:02:56 +09:00
parent 02b1f7d798
commit 636ae84ad5
5 changed files with 4 additions and 11 deletions

View File

@ -28,8 +28,6 @@ const (
screenHeight = 240
)
// TODO: Add Key.String() by stringer
var keyNames = map[ebiten.Key]string{
ebiten.KeyBackspace: "Backspace",
ebiten.KeyComma: "','",

View File

@ -39,10 +39,10 @@ type TextureQuads interface {
var initialized = false
// TODO: Use unsafe.SizeOf?
const float32Size = 4
func DrawTexture(c *opengl.Context, texture opengl.Texture, projectionMatrix *[4][4]float64, quads TextureQuads, geo Matrix, color Matrix) error {
// unsafe.SizeOf can't be used because unsafe doesn't work with GopherJS.
const float32Size = 4
// TODO: Check len(quads) and gl.MAX_ELEMENTS_INDICES?
const stride = 4 * 4
if !initialized {
@ -56,7 +56,6 @@ func DrawTexture(c *opengl.Context, texture opengl.Texture, projectionMatrix *[4
return nil
}
// TODO: Check performance
program := useProgramColorMatrix(c, glMatrix(projectionMatrix), geo, color)
// TODO: Do we have to call gl.ActiveTexture(gl.TEXTURE0)?

View File

@ -46,8 +46,7 @@ func initialize(c *opengl.Context) error {
}
const stride = 4 * 4
v := make([]float32, stride*size)
c.NewBuffer(c.ArrayBuffer, v, c.DynamicDraw)
c.NewBuffer(c.ArrayBuffer, stride*size, c.DynamicDraw)
indices := make([]uint16, 6*size)
for i := uint16(0); i < size; i++ {
@ -70,7 +69,6 @@ func useProgramColorMatrix(c *opengl.Context, projectionMatrix []float32, geo Ma
c.UseProgram(programColorMatrix)
lastProgram = programColorMatrix
}
// TODO: Check the performance.
program := programColorMatrix
c.UniformFloats(program, "projection_matrix", projectionMatrix)

View File

@ -35,7 +35,6 @@ func shader(c *opengl.Context, id shaderId) string {
return str
}
// TODO: Create version 100 for WebGL
var shaders = map[shaderId]string{
shaderVertex: `
uniform highp mat4 projection_matrix;

View File

@ -259,7 +259,6 @@ func (c *Context) NewBuffer(bufferType BufferType, v interface{}, bufferUsageTyp
gl := c.gl
b := gl.CreateBuffer()
gl.BindBuffer(int(bufferType), b)
// TODO: Can we assign integer to gl.bufferData?
gl.BufferData(int(bufferType), v, int(bufferUsageType))
}