GetUniformLocation returns the location of the specified uniform in this program. This location is internally cached.
(name string)
| 140 | // GetUniformLocation returns the location of the specified uniform in this program. |
| 141 | // This location is internally cached. |
| 142 | func (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. |
no test coverage detected