5 Replies - 3368 Views - Last Post: 01 January 2013 - 08:04 PM Rate Topic: -----

#1 Spck  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 01-January 13

Rendering many 2D texture quads (Modern OpenGL)

Posted 01 January 2013 - 02:57 PM

I'm creating my own graphics engine (for educational purposes), in which I'd like to render hundreds of texture quads in a 3D world. I'm new to OpenGL, but have followed multiple tutorials on the subject. I have a "decent" understanding of what I'm doing. However there is just one aspect I can't seem to grasp, correct use of VBOs.


These are the following ways I've thought of using them:

1. Each textured quad(game object's renderComp) has it's own VBO containing vertex data(vertices, texture coords, colors)
-Pros: Easy to implement, adding/removing objects to render would be as simple as creating/deleting VBOs
-Cons: The VBOs would be so small that it'd be a huge performance hit to Bind/Draw/Unbind every VBO each frame

2. Have one(potentially more if it fills up) VBO containing ALL the textured quads vertex data interleaved
-Pros: Only 1 Bind/Draw/Unbind call per frame, should provide much better performance
-Cons: I have no idea how to keep track of what vertex data belongs to which game object. I could ADD to the VBO, but have no idea how I would remove (no longer render) from the VBO. (Unless I delete, recreate the whole VBO each time I remove something).


3. Have a STATIC VBO for objects that won't be changed i.e. Map, and have an additional VBO for objects that will be created/deleted at runtime.
-Pros: Same as #1 with a slight performance boost (less GL calls)
-Cons: Still more calls than I would prefer


I feel like there is something I am missing here. Could someone fill me in?

Is This A Good Question/Topic? 0
  • +

Replies To: Rendering many 2D texture quads (Modern OpenGL)

#2 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: -4
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Rendering many 2D texture quads (Modern OpenGL)

Posted 01 January 2013 - 04:29 PM

Not sure what you're after here. The normal progression would be to have some kind of concept for your engine, then look at the pros and cons to see what you're missing.
Was This Post Helpful? 0
  • +
  • -

#3 Spck  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 01-January 13

Re: Rendering many 2D texture quads (Modern OpenGL)

Posted 01 January 2013 - 04:54 PM

Am I not making any sense? I might be doing all of this completely wrong.

What I'm after is figuring out the ideal way to store rendering components(in my case, quad vertices and texture coords) and rendering them to the screen.
Was This Post Helpful? 0
  • +
  • -

#4 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: -4
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Rendering many 2D texture quads (Modern OpenGL)

Posted 01 January 2013 - 07:15 PM

No, you're making sense really. Have you done any graphics programming before? Do terms like triangle fan, triangle strip, vertex, edge, vector, shading confuse you?
Was This Post Helpful? 0
  • +
  • -

#5 Spck  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 01-January 13

Re: Rendering many 2D texture quads (Modern OpenGL)

Posted 01 January 2013 - 07:30 PM

This will be my first attempt at graphics programming, but yes I do understand all of those terms. That's not what I am having an issue with.

All of my game objects will consist of a single 2D quad composed of GL_TRIANGLES.

The vertex shader will be given transformation(orientation in world)/texture coord(animations) values which are computed at the beginning of each game loop.

I'm no expert on the topic, but I have a basic understanding of the process. Like I said, I'm trying to figure out the best way to store my renderable data so that I not only have good performance, but also ease of access.
Was This Post Helpful? 0
  • +
  • -

#6 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: -4
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Rendering many 2D texture quads (Modern OpenGL)

Posted 01 January 2013 - 08:04 PM

It depends on the content of your environment and the platform it will be running on. For instance, are you going to have a large terrain with lots of objects? I know you mentioned hundreds, but that in itself is not meaningful. You can have hundreds of eight poly objects, or hundreds of hundred or more poly objects.

You need to think about your game content as each of your methods under consideration have significant pros and cons depending on how your game engine is built.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1