c++ - OpenGL and Game Entities -
i have been looping through game entity list , calling virtual render fn uses: glbegin/glend. i've learned vertex-buffer-arrays way go (especially ios/android).
- when create new entity world, merely have bind entity's vao vbo, set vao id. if have n entities, have n vao/vbo's?
- on render function don't need re-bind anything, call "gldrawarray/element"?
- can use both glbegin/glend-style opengl vao/vbo's in render fn?
- it seems opengl hates oop, need oop game programming... how solve paradox?
thus if have n entities, have n vao/vbo's?
in decent game engine, if have thousands of objects same geometry (say, discarded bullet cases or something), there's 1 instance (vao/vbo/whatever) of geometry/mesh loaded game engine. object , mesh used object 2 different things. multiple objects can use same mesh instance.
can use both glbegin/glend-style opengl vao/vbo's in render fn?
yes, although people insist because opengl 3/4 available, should avoid glbegin/glend , similar old-style functions. still, you.
it seems opengl hates oop, need oop game programming... how solve paradox?
it doesn't. technically, integer ids used opengl objects , function operate on them methods of objects. isn't hard wrap integer ids structures/classes, anyway.
on hand, don't have use oop. (opinion) nowadays "oop" overused. if can solve problem using simple structures/arrays, , code readable/easy maintain, there's no reason go nuts , design full-blown object hierarchy everything.
Comments
Post a Comment