0


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();

  • Would not it make more sense to use the discrete AMD GPU instead of the integrated Intel GPU? – Andon M. Coleman Jan 25 '14 at 11:09
  • 1
    Just stating the obvious here, but did you make sure that all extension and modern OpenGL entry points were loaded successfully? – datenwolf Jan 25 '14 at 12:18
  • I just got an actual problem: I installed the recommended proprietary fglrx-driver. After reboot I log in and get a black screen. Only the mouse is visible. Since then I'm trying to reset the driver via terminal in recovery-mode - which seems to be awfull :C – user3234792 Jan 25 '14 at 14:22
  • Ok I got it back to work. @datenwolf sorry if this is a stupid question but how do I do that? – user3234792 Jan 25 '14 at 20:45
  • @user3234792: Well, for anything later than OpenGL-1.2 you have to use the extension mechanism to load the supported functions. On Linux you may be deceived by libGL.so seemingly export all symbols, but that's not the specified way to do it and may cause trouble (I have a gut feeling that this is the trap you fell in). To properly get modern OpenGL features you must load extension/newer version symbols though glXGetProcAddress; a tedious process if done manually. Hence there are helper libraries like GLEW. When using GLEW, after calling `glewInit` you can query, which functions could be loaded – datenwolf Jan 26 '14 at 02:06
  • @user3234792: See http://glew.sourceforge.net/basic.html for how to check for specific extensions. Also query the OpenGL version you actually got. `glGetIntegerv(GL_{MAJOR|MINOR}_VERSION, ...)` – datenwolf Jan 26 '14 at 02:09
  • @datenwolf thank you. I added a solution. – user3234792 Jan 26 '14 at 09:24
  • @user3234792: The canonocal way to mark solutions is to write them into an answer yourself, which you can then (later) accept (without gaining rep points). – datenwolf Jan 26 '14 at 12:27

0 Answers0