(path string)
| 92 | } |
| 93 | |
| 94 | func (t *Texture) load(path string) int { |
| 95 | index := t.lru() |
| 96 | delete(t.lookup, t.reverse[index]) |
| 97 | t.mark(index) |
| 98 | t.lookup[path] = index |
| 99 | t.reverse[index] = path |
| 100 | x := int32((index % textureDim) * 256) |
| 101 | y := int32((index / textureDim) * 256) |
| 102 | im := copyImage(t.loadThumbnail(path)) |
| 103 | size := im.Rect.Size() |
| 104 | gl.TexSubImage2D( |
| 105 | gl.TEXTURE_2D, 0, x, y, int32(size.X), int32(size.Y), |
| 106 | gl.RGBA, gl.UNSIGNED_BYTE, gl.Ptr(im.Pix)) |
| 107 | return index |
| 108 | } |
| 109 | |
| 110 | func (t *Texture) loadThumbnail(romPath string) image.Image { |
| 111 | _, name := path.Split(romPath) |
no test coverage detected