c++ - Should my GLSL Shader object/wrapper encapsulate loading/setting a VertexArrayObject? -


I am working on a 2D game in C ++ with a simple rendering layer on OpenGL.

I have a cover for GLSL shaders and shard programs, these wrappers finish the shutter object in C ++ classes and automatically handle loading / compilation / linking and shader programs.

VertexArrayObjects, it seems to me, is basically a collection of configurations settings to use with a particular shader program.

My question is as follows: Should I place VAO within my Shader Programs objects or within Sprite Objects? Does VAO change on a per-shader basis or do I need a new VAO for each type of drawable object? If the latter, do I need a VAO to attract all the sprites (each of the four corners, position / orientation etc.) in the game, or a VAO per spread object?

Vertex array objects are only a container for those settings that determine whether Opgele from the corner They are not associated with any shader; You can use the same VAO with more than one shader, as long as the top attributes match. Therefore, they should have their own, separate class.

For 2D Phantom based games, where you mostly make rectangles, I only recommend creating a VAO with rectangular traps, and drawing springs while using it.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -