mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +01:00
opengl: Remove 'normalize' argument from VertexAttribPointer
This commit is contained in:
parent
2e1e4adb84
commit
eeea25f202
@ -24,10 +24,9 @@ import (
|
||||
// arrayBufferLayoutPart is a part of an array buffer layout.
|
||||
type arrayBufferLayoutPart struct {
|
||||
// TODO: This struct should belong to a program and know it.
|
||||
name string
|
||||
dataType opengl.DataType
|
||||
num int
|
||||
normalize bool
|
||||
name string
|
||||
dataType opengl.DataType
|
||||
num int
|
||||
}
|
||||
|
||||
// arrayBufferLayout is an array buffer layout.
|
||||
@ -65,7 +64,7 @@ func (a *arrayBufferLayout) enable(program opengl.Program) {
|
||||
total := a.totalBytes()
|
||||
offset := 0
|
||||
for _, p := range a.parts {
|
||||
opengl.GetContext().VertexAttribPointer(program, p.name, p.num, p.dataType, p.normalize, total, offset)
|
||||
opengl.GetContext().VertexAttribPointer(program, p.name, p.num, p.dataType, total, offset)
|
||||
offset += p.dataType.SizeInBytes() * p.num
|
||||
}
|
||||
}
|
||||
@ -84,28 +83,24 @@ var (
|
||||
// Note that GL_MAX_VERTEX_ATTRIBS is at least 16.
|
||||
parts: []arrayBufferLayoutPart{
|
||||
{
|
||||
name: "vertex",
|
||||
dataType: opengl.Float,
|
||||
num: 2,
|
||||
normalize: false,
|
||||
name: "vertex",
|
||||
dataType: opengl.Float,
|
||||
num: 2,
|
||||
},
|
||||
{
|
||||
name: "tex_coord",
|
||||
dataType: opengl.Float,
|
||||
num: 4,
|
||||
normalize: false,
|
||||
name: "tex_coord",
|
||||
dataType: opengl.Float,
|
||||
num: 4,
|
||||
},
|
||||
{
|
||||
name: "geo_matrix_body",
|
||||
dataType: opengl.Float,
|
||||
num: 4,
|
||||
normalize: false,
|
||||
name: "geo_matrix_body",
|
||||
dataType: opengl.Float,
|
||||
num: 4,
|
||||
},
|
||||
{
|
||||
name: "geo_matrix_translation",
|
||||
dataType: opengl.Float,
|
||||
num: 2,
|
||||
normalize: false,
|
||||
name: "geo_matrix_translation",
|
||||
dataType: opengl.Float,
|
||||
num: 2,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -427,10 +427,10 @@ func (c *Context) getAttribLocationImpl(p Program, location string) attribLocati
|
||||
return attrib
|
||||
}
|
||||
|
||||
func (c *Context) VertexAttribPointer(p Program, location string, size int, dataType DataType, normalize bool, stride int, offset int) {
|
||||
func (c *Context) VertexAttribPointer(p Program, location string, size int, dataType DataType, stride int, offset int) {
|
||||
_ = c.runOnContextThread(func() error {
|
||||
l := c.locationCache.GetAttribLocation(c, p, location)
|
||||
gl.VertexAttribPointer(uint32(l), int32(size), uint32(dataType), normalize, int32(stride), gl.PtrOffset(offset))
|
||||
gl.VertexAttribPointer(uint32(l), int32(size), uint32(dataType), false, int32(stride), gl.PtrOffset(offset))
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
@ -362,10 +362,10 @@ func (c *Context) getAttribLocationImpl(p Program, location string) attribLocati
|
||||
return attribLocation(gl.GetAttribLocation(p.Object, location))
|
||||
}
|
||||
|
||||
func (c *Context) VertexAttribPointer(p Program, location string, size int, dataType DataType, normalize bool, stride int, offset int) {
|
||||
func (c *Context) VertexAttribPointer(p Program, location string, size int, dataType DataType, stride int, offset int) {
|
||||
gl := c.gl
|
||||
l := c.locationCache.GetAttribLocation(c, p, location)
|
||||
gl.VertexAttribPointer(int(l), size, int(dataType), normalize, stride, offset)
|
||||
gl.VertexAttribPointer(int(l), size, int(dataType), false, stride, offset)
|
||||
}
|
||||
|
||||
func (c *Context) EnableVertexAttribArray(p Program, location string) {
|
||||
|
@ -335,10 +335,10 @@ func (c *Context) getAttribLocationImpl(p Program, location string) attribLocati
|
||||
return a
|
||||
}
|
||||
|
||||
func (c *Context) VertexAttribPointer(p Program, location string, size int, dataType DataType, normalize bool, stride int, offset int) {
|
||||
func (c *Context) VertexAttribPointer(p Program, location string, size int, dataType DataType, stride int, offset int) {
|
||||
gl := c.gl
|
||||
l := c.locationCache.GetAttribLocation(c, p, location)
|
||||
gl.VertexAttribPointer(mgl.Attrib(l), size, mgl.Enum(dataType), normalize, stride, offset)
|
||||
gl.VertexAttribPointer(mgl.Attrib(l), size, mgl.Enum(dataType), false, stride, offset)
|
||||
}
|
||||
|
||||
func (c *Context) EnableVertexAttribArray(p Program, location string) {
|
||||
|
@ -14,12 +14,14 @@
|
||||
|
||||
package opengl
|
||||
|
||||
type Filter int
|
||||
type ShaderType int
|
||||
type BufferType int
|
||||
type BufferUsage int
|
||||
type Mode int
|
||||
type operation int
|
||||
type (
|
||||
Filter int
|
||||
ShaderType int
|
||||
BufferType int
|
||||
BufferUsage int
|
||||
Mode int
|
||||
operation int
|
||||
)
|
||||
|
||||
type CompositeMode int
|
||||
|
||||
@ -69,7 +71,7 @@ func operations(mode CompositeMode) (src operation, dst operation) {
|
||||
case CompositeModeLighter:
|
||||
return one, one
|
||||
default:
|
||||
panic("not reach")
|
||||
panic("not reached")
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,6 +84,6 @@ func (d DataType) SizeInBytes() int {
|
||||
case Float:
|
||||
return 4
|
||||
default:
|
||||
panic("not reach")
|
||||
panic("not reached")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user