OpenGL crash at glTexBuffer(...)

546 Views Asked by At


I am trying to program a particle system for my 2D opengl game. Therefore, geometry instancing seems to be good together with a TBO holding the data of each particle.
The problem is, at initialization, the function

glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, buffer);

crashes with a segmentation-fault. The init-function for the TBO:

glGenBuffers(1, &buffer);
glBindBuffer(GL_TEXTURE_BUFFER, buffer);
glBufferData(GL_TEXTURE_BUFFER, MAX_PARTICLES_N * 4 * sizeof(float), NULL,
           GL_DYNAMIC_DRAW);
glGenTextures(1, &transforms);
glBindTexture(GL_TEXTURE_BUFFER, transforms);
glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, buffer);

The OpenGL context is fine as everything else works. OpenGL-3.0 is supported as well (needed for TBOs). I'm running this on Ubuntu 13.04 with a Radeon card. The driver is Intel® Sandybridge Mobile. Solution:

My major mistake was that I expected everything in OpenGL that compiles should work as well. In fact, my OpenGL version in use is 3.0, while

glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, buffer);

needs version 3.1 or greater.

glewIsSupported("GL_ARB_texture_buffer_object")

returns false, the only way to get it to work is to set

glewExperimental = GL_TRUE;

before glewinit();

0

There are 0 best solutions below