I have a 3D graphics engine/server application I was developing until about 1 year ago. When I left off work on the application, I had equivalent linux and windows versions, but also I had another windows version with more features added.
Recently I started trying to develop them again and built a new 64-bit ubuntu 10.04 system with codeblocks 10.05 to continue work. The windows system is still the same winxp64 system. But I am only developing 32-bit applications in both cases (because I haven't written the 64-bit versions of my SIMD/SSE2+ assembly language routines).
The new version on windows was based upon GLEW because GLEE had fallen behind and I needed some new features not supported then by GLEE.
When I tried to make the most up-to-date application compile on linux, it gets a segment violation when calling the following function:
glxfbconfig = glXChooseFBConfig (xdisplay, xscreen, (int*)&glxfbconfigattributes000, &glxfbconfigelements);
When I look at the assembly language where the segment violation happens, the instruction is
but register edx contains 0x00000000
Several lines up, register edx is set as follows:
mov edx, DWORD PTR ds:0x820a0b8
I spent a long time trying to figure out what I might have changed in the code that might have caused this. Eventually I did what I should have done from the start --- tested the previously working version (the compatible version that ran correctly on both linux and windows).
Well, it still runs on both linux and windows.
Then I changed the project in only one way --- switch from GLEE to GLEW. I can do this because this version was just before I switched to GLEW to gain access to more advanced features.
The result is --- the same segment violation at the exact same place for the exact same reason (register edx == zero).
All I do to switch over is the following:
#1: Change one define in the IDE from "GLEE" to "GLEW".
#2: Remove file "glee.c" from the project.
#3: Add file "glew.c" to the project.
That's all. Step #1 causes the files in the application to:
#include <GL/glxew.h> // or <GL/wglew.h> on windows
I consider this to pretty much definitely narrow down the problem to GLEW (or something about the way I include the GLEW files).
Note that I include the GLEW files in my application, not link to the libraries they provide as an alternative.
Does anyone know what the problem is? Has anyone seen a problem like this?
Is anyone up to debugging this? Note that the application runs on my windows system (with GLEE or GLEW). The only difference on windows is I develop/debug with VisualStudio2005 instead of Code::Blocks... but that shouldn't matter (sez me). If anyone has 64-bit ubuntu 10.04 and is willing to debug this problem, I'll ZIP up and send the code. I doubt the problem is the nvidia driver on my linux system (195.36.24) since GLEE versus GLEW shouldn't have anything to do with that.