Sign in to follow this  
randomgc

OpenGL Crash with glDrawArrays and VBOs

Recommended Posts

Hi everybody,
I'm almost new to OpenGL and i'm trying to learn how to use VBOs. I'm following some simple examples from Nehe and Swiftless' tutorials, which are very similar, but I'm able to get them work.
In facts, when I attempt to draw VBOs I created, my application crashes with a segmentation fault. I'm using Linux with AMD proprietary drivers which support OpenGL 4.1.11251.

Here's the code I'm trying to run (if you need the entire application, I'll post it) http://pastebin.com/DHPxJhVn

I thank you in advance, I really need some help, because I still haven't found a solution for such a stupid seg fault.

Giulio

(Sorry if I don't speak English correctly, I'm not mother tongue)

Share this post


Link to post
Share on other sites
Are you certain the error is in the VBO code, and not somewhere else in the program? Have you tried to isolate the line of code that causes the fault?

I look at the code briefly and I don't see any illegal use of opengl, but your heightmap code looks suspect. Looks like you fread an array of w * h, but I think you should have (w+1)*(h+1) entries in the heightmap. Something like this you should be easily able to diagnose in a debugger.

Let me know if I'm not correct, or if it really is OpenGL call causing the crash.

Share this post


Link to post
Share on other sites
It does crash when I call glDrawArrays, I already tried to isolate that line.

I've observed that if I call glDrawArrays with these arguments (GL_TRIANGLES, 0, 0) (or 1) instead of (GL_TRIANGLES, 0, mVertexCount), it doens't crash either, but nothing is drawn on the screen obviously.

[quote name='karwosts' timestamp='1329714358' post='4914731']
Are you certain the error is in the VBO code, and not somewhere else in the program? Have you tried to isolate the line of code that causes the fault?

I look at the code briefly and I don't see any illegal use of opengl, but your heightmap code looks suspect. Looks like you fread an array of w * h, but I think you should have (w+1)*(h+1) entries in the heightmap. Something like this you should be easily able to diagnose in a debugger.

Let me know if I'm not correct, or if it really is OpenGL call causing the crash.
[/quote]
I've tried to use Lists and that heightmap is displayed correctly.

Maybe linux proprietary ati driver doesn't support vbos?

Thanks for your help,
Giulio

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this