mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
Bug fix: opengl.NewBuffer may accept integer value (glfw)
This commit is contained in:
parent
636ae84ad5
commit
1dd1403aac
@ -208,7 +208,11 @@ func (c *Context) DisableVertexAttribArray(p Program, location string) {
|
|||||||
func (c *Context) NewBuffer(bufferType BufferType, v interface{}, bufferUsageType BufferUsageType) {
|
func (c *Context) NewBuffer(bufferType BufferType, v interface{}, bufferUsageType BufferUsageType) {
|
||||||
gl.GenBuffer().Bind(gl.GLenum(bufferType))
|
gl.GenBuffer().Bind(gl.GLenum(bufferType))
|
||||||
size := 0
|
size := 0
|
||||||
|
ptr := v
|
||||||
switch v := v.(type) {
|
switch v := v.(type) {
|
||||||
|
case int:
|
||||||
|
size = v
|
||||||
|
ptr = nil
|
||||||
case []uint16:
|
case []uint16:
|
||||||
size = 2 * len(v)
|
size = 2 * len(v)
|
||||||
case []float32:
|
case []float32:
|
||||||
@ -216,7 +220,7 @@ func (c *Context) NewBuffer(bufferType BufferType, v interface{}, bufferUsageTyp
|
|||||||
default:
|
default:
|
||||||
panic("not reach")
|
panic("not reach")
|
||||||
}
|
}
|
||||||
gl.BufferData(gl.GLenum(bufferType), size, v, gl.GLenum(bufferUsageType))
|
gl.BufferData(gl.GLenum(bufferType), size, ptr, gl.GLenum(bufferUsageType))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) BufferSubData(bufferType BufferType, data []float32) {
|
func (c *Context) BufferSubData(bufferType BufferType, data []float32) {
|
||||||
|
Loading…
Reference in New Issue
Block a user