Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

Advanced search

1037400 Posts in 41905 Topics- by 33512 Members - Latest Member: M3OW

August 30, 2014, 10:26:21 AM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)OpenGL Interleaved VBOs, Strides and Offsets
Pages: 1 [2]
Author Topic: OpenGL Interleaved VBOs, Strides and Offsets  (Read 2294 times)
Level 10

Alex Diener

View Profile WWW
« Reply #15 on: March 20, 2013, 07:19:30 PM »

1. Lets say I wanted to do a textured cube with the same texture on every side. I can't use indexed VBOs can I because if I reuse vertices the texture coordinates won't work right?

Kinda. You can still use indexed VBOs, but some of your entries might need to have the same vertex positions with different normals and texture coordinates. Off the top of my head, I don't think there's a way to index the different arrays separately, so duplicating some of the data is the normal way to go about things.

2. glDrawRangeElements, I understand all of the arguments except for the 'end' and 'count' arguments (the 3rd and 4th ones), I know they have to do with the amount of things being drawn but is it the amount of triangles or vertices or what?

I'm pretty sure count is the number of vertices. start and end seem a bit confusing, though... I've only ever used glDrawElements, but from what I'm reading of the glDrawRangeElements man page, it looks like you just need to specify the minimum and maximum allowable values that will be pulled from your index array. I guess that makes it safer than glDrawElements, since you won't be able to index an element outside your VBO if your index buffer is filled with memory garbage or something?
Sean A.
Level 8

View Profile Email
« Reply #16 on: March 20, 2013, 08:07:46 PM »

Ok thanks, everything's running smoothly now but I started moving everything into init() render() and exit() functions. init() is called once on object creation and contains all of the code before glDrawRangeElements(), which is the only code in the render loop. exit() is called when objects are destroyed and contains everything after glDrawRangeElements(). The result of this is that it only draws one cube, if I create multiple cubes while everything was in the render loop it worked fine but as soon as I moved it, it only draws one.
Pages: 1 [2]
Jump to:  

Theme orange-lt created by panic