Jump to content
  • Advertisement

Gabriele Giuseppini

Member
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Gabriele Giuseppini

  • Rank
    Newbie

Personal Information

Social

  • Github
    GabrieleGiuseppini

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi all, I'm targeting OpenGL 2.1 (so no VAO's for me 😢) and I have multiple shaders rendering quite different things at each frame; for the sake of argument, say that I have just two shaders - one shader draws the background (so it uses vertex attributes for texture coordinates, 2D positions, etc.) while the other draws some meshes (so it uses vertex attributes for colors and 3D positions, and no textures). The data provided to each of the shaders changes for each frame. Now, I've realized I can choose between two different strategies when it comes to binding vertex attribute locations. With the first strategy I reuse vertex attribute indices, whereby the first shader would bind to, say, attribute locations 0, 1, 2, 3 and the second shader would bind to, say, 0, 1, 2. With this approach I'll have to constantly call glVertexAttribPointer for these indices, as for each frame one shader would require one set of VBO's to feed 0, 1, 2, 3 and the other shader would require another set of VBO's to feed 0, 1, 2. With the second strategy, instead, I use "dedicated" vertex attribute indices: the first shader would bind to 0, 1, 2, 3 and the second shader would bind to 4, 5, 6. In other words, each vertex attribute index has its own dedicated VBO to feed data to it. The advantage of this approach is that I need to call glVertexAttribPointer only once per index, say at program initialization, but at the same time it's limiting my capacity to "grow" shaders in the future (my GPU only supports 16 vertex attributes, hence it'll be hard to add new shaders or to add new attributes to existing shaders). Now, in my implementation I can't see any performance benefit of one versus the other, but truth to be told, I'm developing on an ancient Dell laptop with an Intel mobile card...😩 nonetheless I would like this code to run as fast as possible on modern GPU's. Is there any performance benefit to choosing one of the two strategies over the other? And in case there's no performance benefit, is one strategy preferable over the other for reasons that I can't think of at the moment? Thanks so much in advance for any tips!!!!
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!