MCPcopy
hub / github.com/g3n/engine / GetUniformLocation

Method GetUniformLocation

gls/program.go:142–162  ·  view source on GitHub ↗

GetUniformLocation returns the location of the specified uniform in this program. This location is internally cached.

(name string)

Source from the content-addressed store, hash-verified

140// GetUniformLocation returns the location of the specified uniform in this program.
141// This location is internally cached.
142func (prog *Program) GetUniformLocation(name string) int32 {
143
144 // Try to get from the cache
145 loc, ok := prog.uniforms[name]
146 if ok {
147 prog.gs.stats.UnilocHits++
148 return loc
149 }
150
151 // Get location from OpenGL
152 loc = prog.gs.GetUniformLocation(prog.handle, name)
153 prog.gs.stats.UnilocMiss++
154
155 // Cache result
156 prog.uniforms[name] = loc
157 if loc < 0 {
158 log.Warn("Program.GetUniformLocation(%s): NOT FOUND", name)
159 }
160
161 return loc
162}
163
164// CompileShader creates and compiles an OpenGL shader of the specified type, with
165// the specified source code, and returns a non-zero value by which it can be referenced.

Callers 2

LocationMethod · 0.45
LocationIdxMethod · 0.45

Calls 1

WarnMethod · 0.80

Tested by

no test coverage detected