@@ -216,8 +216,8 @@ template newShaderStatic*(computePath: string): Shader =
216
216
# # so it is compiled into the binary.
217
217
const
218
218
computeCode = staticRead(computePath)
219
- dir = currentSourcePath()
220
- computePathFull = dir.parentDir() / computePath
219
+ dir = currentSourcePath().parentDir()
220
+ computePathFull = dir / computePath
221
221
newShader((computePathFull, computeCode))
222
222
223
223
proc newShader* (vert, frag: (string , string )): Shader =
@@ -241,9 +241,9 @@ template newShaderStatic*(vertPath, fragPath: string): Shader =
241
241
const
242
242
vertCode = staticRead(vertPath)
243
243
fragCode = staticRead(fragPath)
244
- dir = currentSourcePath()
245
- vertPathFull = dir.parentDir() / vertPath
246
- fragPathFull = dir.parentDir() / fragPath
244
+ dir = currentSourcePath().parentDir()
245
+ vertPathFull = dir / vertPath
246
+ fragPathFull = dir / fragPath
247
247
newShader((vertPathFull, vertCode), (fragPathFull, fragCode))
248
248
249
249
proc hasUniform* (shader: Shader, name: string ): bool =
@@ -430,6 +430,14 @@ proc bindUniforms*(shader: Shader) =
430
430
431
431
uniform.changed = false
432
432
433
+ proc bindUniformBuffer* (
434
+ shader: Shader, name: string , buffer: Buffer, binding: GLuint
435
+ ) =
436
+ assert buffer.target == GL_UNIFORM_BUFFER
437
+ let index = glGetUniformBlockIndex(shader.programId, name)
438
+ glBindBufferBase(GL_UNIFORM_BUFFER, binding, buffer.bufferId)
439
+ glUniformBlockBinding(shader.programId, index, binding)
440
+
433
441
proc bindAttrib* (
434
442
shader: Shader,
435
443
name: string ,
0 commit comments