vertex-buffer

Texturing Vertex Buffer Objects

What I want to do is drawing a (large) terrain with OpenGL. So I have a set of vertices, lets say 256 x 256 which I store in a vertex buffer object in the VRAM. I properly triangulated them, so I've got an index buffer for the faces. // vertexes glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexBufferId); glVertexPointer(3, GL_FLOAT, 0, 0); //...

When are VBOs faster than "simple" OpenGL primitives (glBegin())?

After many years of hearing about Vertex Buffer Objects (VBOs), I finally decided to experiment with them (my stuff isn't normally performance critical, obviously...) I'll describe my experiment below, but to make a long story short, I'm seeing indistinguishable performance between "simple" direct mode (glBegin()/glEnd()), vertex array ...

openGL glDrawElements with interleaved buffers

Thus far i have only used glDrawArrays and would like to move over to using an index buffer and indexed triangles. I am drawing a somewhat complicated object with texture coords, normals and vertex coords. All this data is gathered into a single interleaved vertex buffer and drawn using calls similar to ( Assuming all the serup is done c...

OpenGL vertex layout

The problem goes like this: if I have a vertex structure defined with only the position (3 floats), with a total size of 12 bytes, things work perfectly. However, if I try to use unsigned bytes or shorts for the position components (3 or 6 bytes per vertex) it crashes with an access violation at glDrawArrays. Any idea why? ...

XNA/DirectX: Should you always use indices?

I'm implementing billboards for vegetation where a billboard is of course a single quad consisting of two triangles. The vertex data is stored in a vertex buffer, but should I bother with indices? I understand that the savings on things like terrain can be huge in terms of vertices sent to the graphics card when you use indices, but usin...

Multiple meshes in one vertex buffer?

Do I need to use one vertex buffer per mesh, or can I store multiple meshes in one vertex buffer? If so, should I do it, and how would I do it? ...

Rendering different triangle types and triangle fans using vertex buffer objects? (OpenGL)

Hello, About half of my meshes are using triangles, another half using triangle fans. I'd like to offload these into a vertex buffer object but I'm not quite sure how to do this. The triangle fans all have a different number of vertices... for example, one might have 5 and another 7. VBO's are fairly straight forward using plain tri...

OpenGL ES Polygon with Normals rendering (Note the 'ES!')

Ok... imagine I have a relatively simple solid that has six distinct normals but actually has close to 48 faces (8 faces per direction) and there are a LOT of shared vertices between faces. What's the most efficient way to render that in OpenGL? I know I can place the vertices in an array, then use an index array to render them, but I ...

Is there any way to add alpha to individual vertices in OpenGL Vertex Buffers?

Hello, I'm trying to learn how to use vertex buffers by making a sprite engine. I create a new buffer for each texture page I have, and can add instances of textured quads to the buffers, interleave their vertex and uv information and render them out fine using DrawElements. However, I can't find any way of setting the alpha on individ...

How do I get the length of a VBO to render all vertices when using glDrawArrays()?

I create a VBO in a function and I only want to return the VBO id. I use glDrawArrays in another function and I want it to draw all the vertices in the VBO without needing to also pass the number of vertices. The VBO also contains texture coordinate data. Thank you. ...

Using OpenGL vertex buffers in C++.

I've loaded a Wavefront .obj file and drawn it in immediate mode, and it works fine. I'm now trying to draw the same model with a vertex buffer, but I have a question. My model data is organized in the following structures: struct Vert { double x; double y; double z; }; struct Norm { double x; double y; double z; }; struct ...

Problem when trying to use simple Shaders + VBOs

Hello I'm trying to convert the following functions to a VBO based function for learning purposes, it displays a static texture on screen. I'm using OpenGL ES 2.0 with shaders on the iPhone (should be almost the same than regular OpenGL in this case), this is what I got working: //Works! - (void) drawAtPoint:(CGPoint)point depth:(CGFloa...

How to compute bounding box/sphere across multiple meshes (C#)

I load multiple meshs from .x files in different mesh variables. Now I would like to calculate the bounding sphere across all the meshes I have loaded (and which are being displayed) Please guide me how this could be achieved. Can VertexBuffers be appended togather in one variable and the boundingSphere be computed using that? (if yes h...

XNA - Using Dynamic Vertex Buffer and only four(4) vertices.

Hiya! Just a quick question on drawing quads. I'm currently using: GraphicsDevice.DrawPrimitives(PrimitiveType primitiveType, int startVertex, int primitiveCount); This draws my quads perfectly fine but the only way I can make it work is to use six (6) vertices for my quads (drawing them as two triangles). I'm...

Better to create new VBOs or just swap the data? (OpenGL)

So in a OpenGL rendering application, is it usually better to create and maintain a vertex buffer throughout the life of an application and just swap out the data every frame with glBufferData, or is it better to just delete the VBO and recreate it every frame? Intuition tells me it's better to swap out data, but a few sample programs I...

How to 'bind' a element buffer array to vertex array object using direct state access?

Hi everyone! The title says it all. For the other buffers there are functions like: glVertexArrayVertexAttribOffsetEXT( this->handle, // vao handle vbo.getHandle(), // vbo handle index, // specifies the index of the generic vertex attribute to be modified. size, ...

Rotate individual polygons in an Open GL vertex array?

I am working on a game for Android using OpenGL ES, and I have run into a performance problem. What I am trying to do: I have a bunch of objects on screen that all share the same mesh, but all have individual rotations and translations. You could compare it to Asteroids where you have a bunch of asteroids moving around on screen. The a...

Using Vertex Buffer Objects with C++ OpenGL

I am working on a 3d tile-based strategy game and have read that implementing VBO's will significantly increase the game's frame rate and reduce the cpu usage (sounds great right?). However, among the tutorials I've looked at I can't quite get a handle on how to implement it. Has anyone had experience doing this and can either point me...