GithubHelp home page GithubHelp logo

Comments (3)

giawa avatar giawa commented on September 15, 2024

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.

  1. 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?
  2. 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.
  3. 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.

TheAIBot avatar TheAIBot commented on September 15, 2024

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.

giawa avatar giawa commented on September 15, 2024

I think that method is fine. I'll accept the pull request once the code review is complete. Thanks!

from opengl4csharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.