Comments (3)
I don't have an immediate solution, but do have some questions that might help arrive at a solution that we're both happy with.
- What do you think of having a class specifically for VBOs that will support instanced rendering (could inherit VBO to continue to be supported by existing VAO code)? Something like
public class InstancedVBO<T>
? Or, if it makes more sense to put this in the VAO, something similar? - What do you think of initializing VBO with a Divisor property that defaults to 0 and must be set non-zero to be able to render as instanced? The VAO draw function could check for the Divisor being non-zero and throw an error in the appropriate situation.
- What do you think of making the divisor a more specific constructor of the VBO. So you could simply add the new constructor
public VBO(T[] Data, int Position, int Length, uint Divisor, BufferTarget Target = BufferTarget.ArrayBuffer, BufferUsageHint Hint = BufferUsageHint.StaticDraw)
and require the developer include position and length values.
from opengl4csharp.
To support instanced drawing, each VBO needs a divisor. It's only a single uint so i think making a whole new class for it is a bit overkill. There isn't any reason why a VBO used for instanced drawing couldn't also be used for non-instanced drawing. The difference between those two is primarily which draw call is used.
I quite like 2 and 3 but i am not sure which one is the best.
You are right that there is more ways to make the divisor more distint in the constructor.
Maybe adding it to the constructor but with a default argument like this.
public VBO(T[] Data, int Length, BufferTarget Target = BufferTarget.ArrayBuffer, BufferUsageHint Hint = BufferUsageHint.StaticDraw, uint Divisor = 0)
Would be easy enough to do and there would be no need to duplicate constructors just to add the divisor. The user can always get access to the divisor if needed and default values are provided for the preceding arguments if the user doesn't care for them.
I will make a pr with this way. If it doesn't work out like we would like then it's easy to change.
from opengl4csharp.
I think that method is fine. I'll accept the pull request once the code review is complete. Thanks!
from opengl4csharp.
Related Issues (20)
- Unhandled Exception HOT 2
- Shader Uniform Arrays HOT 4
- Unable to run on Linux with Mono HOT 8
- Create More than one screen HOT 1
- Glut Window Dimensions is not scaled to Vector2 or Vector3 HOT 9
- I cant render more than one of the same polygon using my algorithm HOT 6
- Shader compile error "undefined variable in_position" HOT 10
- FileLoadException when starting program HOT 3
- rendering more than one shape with out writing them separately HOT 4
- How to subscribe key events to special keys? HOT 3
- Unhandled Exception when closing program HOT 5
- Fetching dotnetcore branch, not getting changes
- Adding Windows code to Gl class HOT 7
- Can't find anywhere else to ask this HOT 3
- Creating a .NET 5 branch, and making it the default branch. HOT 2
- Missing ImageSharp HOT 3
- ShaderProgram.Use() fails under multiple contexts. HOT 3
- Issues about OpenGL.dll file HOT 1
- animating a prism HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opengl4csharp.