PDA

View Full Version : multiple objects?



snowyCoder
03-23-2015, 01:11 PM
hi, i'm new to opengl, i've read some guides but i don't know some important things.
i want to create little games from scratch so i want to create something like a "game engine" that helps the game to render all.
so i want to create a pointer array of things to render and every frame game engine get all classes of the list and call a void render that renders it.
i know how to create calsses, lists..... but i don't know how render multi objects.
can anyone tell me:
1)must or/and when i use multiple vbo/vao.
2)what and where to use glVertexAttribPointer and glEnableVertexAttribArray. (in internet every guide tells it badly!).
3)some advices.
Thanking you in advance for your help.

Dark Photon
03-23-2015, 04:12 PM
What you ask is a very general question. The complete answer is large and depends on a lot of things you haven't told us yet (about your game, the GPUs and platforms you're targetting, what version of OpenGL (or OpenGL ES) is your minimum requirement, and the performance requirements you want). I'd highly recommend you pick up a good OpenGL book and do some reading; it'll greatly accelerate your learning (OpenGL Programming Guide, OpenGL Superbible, etc.)

But to put your mind at ease: if you're writing little games, if you're reasonably careful, you're probably not going to have to sweat performance that much. It's when you need to start pushing lots of content at the GPU, particularly dynamic content, that you really need to be careful how you feed it to get the maximum throughput (i.e. minimum time per frame).

So let's start with what GPUs you're targetting, the minimum OpenGL version you'll accept, and the performance requirements you want. Then sketch out a bit about your game's needs (objs/frame, tris/obj, textures/obj, all objects/materials/textures known at startup?, shading needs, etc.)

And if you follow-up with a question, please seed discussion with a specific question (ideally, post a little code to illustrate).

mahmad
03-23-2015, 09:37 PM
you should read some tutorials on game engine programming first. Try to find "lwjgl game programming " on YouTube. For the time being just forget that it is java. Just listen and try to digest information. OpenGl is a complex library with a steep learning curve, specially if you are using programable pipeline. Move step by step, be consistant . Target just opengl in the start and once you find yourself comfortable in opengl you can look at game engine development.

snowyCoder
03-24-2015, 07:45 AM
thanks, now i want to create little games on school pcs (they are shitty) to entrantain my classmates during lesson ;).
i think i will read opengl superbible even if it costs a lot :(.
p.s. i'm using opengl 3.3 and i want to create a good base for games, like a engine class that powers other classes and calls a method inside the other's that initializes/moves/renders it. all tutorials i've read never said how to render multiple objects.