开发者

no-render with OpenGL --> contexts

开发者 https://www.devze.com 2023-04-06 17:57 出处:网络
i have a program that does some GPU computing with Optional OpenGL rendering. The use dynamic is as follow:

i have a program that does some GPU computing with Optional OpenGL rendering. The use dynamic is as follow:

  1. init function (init GLEW being the most relevant).
  2. load mesh from file to GPU (use glGenBuffers are related functions to make VBO).
  3. process this mesh in parallel (GPU Computing API).
  4. save mesh into file.

my problem is that when mesh is loading i use opengl calls and wihout context created i just get segmentation fault.

Edit: Evolution of the problem:

  1. I was missing GL/glx.h I thought that GL/glxew.h inclu开发者_如何学编程ded it, thanks to the answers that got fixed.
  2. I was missing glXMakeCurrent; and therefore it was having zero contexts.
  3. After this fixes, it works :).

also thanks for the tools suggestions, i would gladly use them it is just that i needed the low level code for this particular case.


i tried making a context with this code ( i am using glew, so i change the header to GL/glxew.h but the rest of this code remains the same)

Don'd do it. glxew is used for loading glx functions. You probably don't need it.

If you want to use GLEW, replace GL/gl.h with GL/glew.h leave GL/glx.h as it is.

X11 and GLX are quite complex, consider using sdl of glfw instead.


Just wildly guessing here, but could it be that GLEW redefined glXChooseFBConfig with something custom? Something in the call of glXChooseFBConfig dereferences an invalid pointer. So either glXChooseFBConfig itself is invalid, or fbcount to so small, or visual_attribs not properly terminated.


GLEW has nothing to do with context creation. It is an OpenGL loading library; it loads OpenGL functions. It needs you to have an OpenGL context in order for it to function.

Since you're not really using this context for drawing stuff, I would suggest using an off-the-shelf tool for context creation. GLFW or FreeGLUT would be the most light-weight alternatives. Just use them to create a context, do what you need to do, then destroy the windows they create.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号