Inputting dynamic data to the VBO's

I develop applications for the target processor Fujitsu ruby MB86298. I work in the Linux environment . I am very new to the concept of VBO. In one of the applications, I have to develop a moving dial.I know how to draw a rectangle or any other primitive which requires just 3 vertices. But here to draw a dial I have to compute many vertices and pass them to VBO. To render crown part of the dial, I calculated the vertices and stored all of them in an array. Similarly I stored all the color components of each vertex in an array. I computed the size of the vertex array and color array. I have created two VBOs one for color and the other for vertices.I copied the vertex and color arrays into the VBOs .But when I execute the code,I am getting segmentation error.Have I followed a right method to send the vertex and color data of the crown to VBO . Is there any easy way to load the VBO with dynamic data? Or if anyone has a code to draw a circle using VBO please share with me.

That typically means a memory access error. You could be passing a bad address, offset, or size to OpenGL, or you don’t have VBOs enabled properly.

Grab a working VBO tutorial and see how they do it. Or run your app in gdb to see where it crashes. You can also run a memory debugger such as valgrind on your code to help sanity check what you’re doing further. If specific GL questions, feel free to post. Also check the wiki ( for info on VBOs – IIRC some good info on what you need to do. Also don’t hesitate to consult the OpenGL Programming Guide.

First thing I’d advise is to get it working with static buffers (don’t worry about the dial animation yet). You say you’re new to VBOs so this is important: it’s a sanity-check to make sure that your buffer setup is correct before you go adding extra functionality. The objective is to do one thing at a time and therefore be able to isolate problems to that one thing rather than getting confused over which part of your code could be causing the problem.

According to your target GPU is a GL ES 2.0 capable device, so the next step for you is to evaluate if you even need a dynamic buffer at all. Is the dial animation something you could do with a vertex shader and a handful of uniforms instead? Much of the time VBOs and vertex shaders go hand-in-hand, and if you’ve a CPU-side calculation for position updates, it’s definitely worth evaluating if you can instead keep the data static but move the calculation to the GPU. This will likely run faster, be more robust and give you cleaner code.

Hi. I am able to render primitives like line,triangle and rectangle using the VBO where I take the vertex data data and color data into arrays and pass them to VBO. When it comes to drawing an arc or any other curve like crown(drawn using TRINAGLE_FAN), I have to compute more than 50 vertices (say for example) . I need a way to send this vertex data to the VBO.How to send the computed vertices in each run of the TRIANGLE_FAN to the single VBO?

There was a small mistake in the code. I corrected it and I am not getting segmentation error. I am able to draw a crown using VBO but it is taking alot of time for getting rendered.I didn’t see any significant improvement in performance. May be the the I input the vertex and color information is wrong. Please suggest me the best way to draw crowns and circles using VBO

If the vertices do not change position relative to each other every frame, i.e. they only move as a solid block, it is very inefficient to update all of them each frame. Applying a transformation in the vertex shader to all of them that places them at the desired location is much faster.
It’s very difficult to give you concrete advice, because you haven’t shown what exactly you are doing so it’s not even possible to guess where the bottleneck of your app is - of course it would be even better if you used profiling tools to measure, since that tends to be more reliable than guessing :wink:

I am trying to develop an application, in which I am drawing pressure and temperature indicators. To represent them,I have put two crowns and two moving needles.I have rendered them using immediate mode rendering. No of frames that are getting drawn per second is an important aspect of the application. I have rendered the indicators using immediate mode rendering method. It is taking considerable time as vertex and color information is getting copied from local RAM to GPU in every frame. So, I decided to use VBOs. Please suggest me a way to draw the crown using VBO

Any tutorial on ‘modern’ OpenGL will cover how to render using VBOs, you can pick any one from the wiki tutorials list. They’ll probably just draw a single triangle or so, but the principle how to load data into a buffer object and how to set up vertex attributes is the same.