|
|
sorlok_reaves
|
 |
Reply #17 Posted on: October 04, 2014, 07:21:11 pm |
|
|
 Joined: Dec 2013
Posts: 260
|
Unfortunately, it still crashes at the same line:
fbc = glXChooseFBConfig(enigma::x11::disp, DefaultScreen(enigma::x11::disp), visual_attribs, &fbcount); Fun time; I just figured out that glXChooseFBConfig is NULL on my machine. Like, the function pointer returned by glxew is null. This shouldn't be happening (modern graphics card, etc.), but I'll dig into it a bit more.
EDIT: Ok, so it seems the function pointers are only set to non-null if glxewInit() is called. But that can only work if GLEW_MX is defined... which requires us to track the current render context.
My question is... did glXChooseFBConfig() work before, or was it added just to this commit?
|
|
« Last Edit: October 04, 2014, 07:29:37 pm by sorlok_reaves »
|
Logged
|
|
|
|
TheExDeus
|
 |
Reply #18 Posted on: October 05, 2014, 07:24:34 am |
|
|
 Joined: Apr 2008
Posts: 1860
|
Actually it's defined in line 303, where there is no GLEW_MX required. glxewInit calls glxewContextInit() which is in glew.c line 13227. So the whole thing seems weird to me. My question is... did glXChooseFBConfig() work before, or was it added just to this commit? It was added. Previously only glXChooseVisual was called. For proper GL3 context it seems we need glXChooseFBConfig as well. I'm honestly out of ideas. You can try using GLEW_MX, as glxewGetContext() shouldn't cause problems. GLEW homepage says that GLEW_MX is not actually included in default release. So you might need to make a custom glew build to enable that ( http://glew.sourceforge.net/advanced.html). But it does look that we have everything we need already. It would be 100x easier for me to fix this if I had Linux. I guess I will have to either dual-boot or do a vm thing. Try compiling this simple example: https://www.opengl.org/wiki/Tutorial:_OpenGL_3.0_Context_Creation_%28GLX%29 . It doesn't use glew, and uses old school pointer stuff. But if nothing else, then you can at least get the pointer for that function alone. And use glew for the rest. Also, we might look into glbinding, https://github.com/hpicgs/glbinding . It the newest and most recently worked on binding framework. It basically replaces glew and many others. It uses C++11 features and is quite interesting. But changing this will probably be a little painful, and we haven't decided if we go towards supporting C++11 compilers only, so I guess we should hold off of that for a while.
|
|
« Last Edit: October 05, 2014, 07:26:31 am by TheExDeus »
|
Logged
|
|
|
|
sorlok_reaves
|
 |
Reply #19 Posted on: October 05, 2014, 10:51:28 am |
|
|
 Joined: Dec 2013
Posts: 260
|
Actually it's defined in line 303, where there is no GLEW_MX required. glxewInit calls glxewContextInit() which is in glew.c line 13227. So the whole thing seems weird to me. Which file are we talking about? I'm referring to glxew.h, where glxewInit() is defined on line 1566, but only if GLEW_MX is defined. glXChooseFBConfig() will always be defined, but it might point to nothing if glxewInit() is never called. Previously only glXChooseVisual was called. For proper GL3 context it seems we need glXChooseFBConfig as well. I'm honestly out of ideas. You can try using GLEW_MX, as glxewGetContext() shouldn't cause problems. GLEW homepage says that GLEW_MX is not actually included in default release. So you might need to make a custom glew build to enable that (http://glew.sourceforge.net/advanced.html). But it does look that we have everything we need already. It would be 100x easier for me to fix this if I had Linux. I guess I will have to either dual-boot or do a vm thing. You might want to look at putting Ubuntu in a VM; I've tried enabling GLEW_MX, and got a bit stuck since it requires you to manually handle the render contexts yourself. Try compiling this simple example: https://www.opengl.org/wiki/Tutorial:_OpenGL_3.0_Context_Creation_%28GLX%29 . It doesn't use glew, and uses old school pointer stuff. But if nothing else, then you can at least get the pointer for that function alone. And use glew for the rest. The example works. Also, we might look into glbinding, https://github.com/hpicgs/glbinding . It the newest and most recently worked on binding framework. It basically replaces glew and many others. It uses C++11 features and is quite interesting. But changing this will probably be a little painful, and we haven't decided if we go towards supporting C++11 compilers only, so I guess we should hold off of that for a while. From my point of view, C++11 support would be great! I think the main concern is double-checking that MinGW on Windows has all the C++11 features we'll need. The other devs will probably have different opinions. Actually, if this is just in the graphics Bridge, couldn't we selectively enable C++11 on Linux when GL3 is used?
|
|
|
Logged
|
|
|
|
TheExDeus
|
 |
Reply #20 Posted on: October 06, 2014, 04:58:42 am |
|
|
 Joined: Apr 2008
Posts: 1860
|
The example works. Then maybe you can try that method. Get the glXChooseFBConfig pointer and use that. From my point of view, C++11 support would be great! I think the main concern is double-checking that MinGW on Windows has all the C++11 features we'll need. The other devs will probably have different opinions. New MinGW (that is last few years) supports C++11 just fine. We also pack our own MinGW in ENIGMA installation, so we can control what version they are using. But supporting C++11 is a lot bigger decision, for which I would want Josh's input. Running on master compiles and runs, and then the game is unplayable (just a single blue screen and the cursor, but it's not clear if I'm actually moving, since everything is blue). But when you were running minecraft on the branch (when you also saw ground and some blocks), were you able to hit those blocks then? Because if we cannot do this context fix properly, then I might as well revert so Linux at least partly works. Because it might have been that it rendered fine (your scaling and text was still messed up, but still), and it was the world generation that broke. You also said that you fixed the shader example segfault, by disabling the build path. Did render correctly then? Can you post a picture? Because it seems that Linux might have worked fine for the most part. Even if you don't have a proper GL3.3 context and debugging. This can be done later.
|
|
|
Logged
|
|
|
|
|
|
sorlok_reaves
|
 |
Reply #23 Posted on: October 06, 2014, 09:39:17 am |
|
|
 Joined: Dec 2013
Posts: 260
|
If I force the pointer (using these changes), then the program runs past initialization and crashes immediately on: Program received signal SIGSEGV, Segmentation fault. 0x0000000000000000 in ?? () (gdb) bt #0 0x0000000000000000 in ?? () #1 0x0000000000483ad8 in enigma::Shader::Shader (this=0x919620, type=0) at Graphics_Systems/OpenGL3/GLSLshader.h:40 #2 0x000000000047cd3d in enigma_user::glsl_shader_create (type=0) at Graphics_Systems/OpenGL3/GL3shader.cpp:490 #3 0x00000000004990de in enigma::graphicssystem_initialize () at Graphics_Systems/OpenGL3/OPENGL3Std.cpp:101 #4 0x000000000051d598 in enigma::initialize_everything () at Universal_System/loading.cpp:59 #5 0x0000000000455f1c in main (argc=1, argv=0x7fffffffe0b8) at Platforms/xlib/XLIBmain.cpp:306 Does this look like we're making progress, or did I just cause all sorts of nondeterminism by casting function pointers around? After all, the point of Glew is to handle this kind of stuff automatically.
|
|
|
Logged
|
|
|
|
TheExDeus
|
 |
Reply #24 Posted on: October 06, 2014, 10:45:40 am |
|
|
 Joined: Apr 2008
Posts: 1860
|
You should try debug mode. It crashed on glCreateShader(), which means you either don't support shaders, glCreateShader is also NULL, or the core context just says we using something deprecated. You can also try uncommenting "//GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB," in xlib bridge. That will turn on the compatibility context, so it's more probable that it will run. Nvidia actually discourages disabling this compatibility context (because when later even GL3.3 is deprecated, your already compiled programs will not run without it), and I actually only did it to make the code compatible with GLES. After all these changes, I will probably turn that flag back on.
|
|
|
Logged
|
|
|
|
|
|
|
|
|
|