cginternals / cginternals/globjects
New binding system concept
- Dominant language
- C++
- Stars
- 563
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Description
Hello. I suggest to make new binding system. I suggest to add binding objects.
```C++
auto BufferBinding = new BufferBaseBinding(0, GL_SHADER_STORAGE_BUFFER);
BufferBinding.setBuffer(SomeBufferObject);
BufferBinding.apply();
// or Context.apply();
```
After will possible to just use `BufferBinding.apply();`. I suggest to base buffer binding on `WeakPtr`.
Also I suggest to make multi-bind support.
https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_multi_bind.txt
```C++
auto MultiBinding = new MultiBufferBindingBase(0, GL_SHADER_STORAGE_BUFFER);
MultiBinding.addBuffer(SomeBufferObject);
MultiBinding.addBuffer(AnotherBufferObject);
// removing buffers
MultiBinding.spliceBuffer(0);
MultiBinding.spliceBuffer(AnotherBufferObject);
MultiBinding.apply();
```
Also, I tired support my own OpenGL wrapper. I also planned rewrite ray tracer host code.
About ranged binding and setting.
```C++
auto Range = new Range(0, 16);
auto Range = new Range(0, strided(16)); // probably this (without template)
RangedBinding.setBuffer(SomeBuffer, Range);
MultiRangedBinding.addBuffer(SomeBuffer, Range);
```
Only, I don't know how should work multi-bind with range objects.
I suggest to multi-bind textures.
```C++
auto MultiBindTexture = new MultiTextureBinding(0); // bind from zeros
MultiBindTexture.addTexture(TextureObject);
MultiBindTexture.apply();
MultiBindTexture.setUniformStride(UniformLocation, 48); // if uniform is array, length optional
MultiBindTexture.setUniformStride(UniformLocation, new Range(0, 48)); // if need offset from
auto MultiBindSampler = new MultiSamplerBinding(0); // from zero texture bindings
MultiBindSampler.addSampler(SamplerObject);
MultiBindSampler.apply();
```
And just binding textures.
```
auto TextureBindingObject = new TextureBinding(0);
TextureBindingObject.setTexture(TextureObject);
TextureBindingObject.apply();
TextureBindingObject.setUniform(UniformLocation); // to uniform
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.