0.14 OpenGL under Linux miscompiles

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
terefang
Posts: 48
Joined: Tue Jun 21, 2005 9:56 am

0.14 OpenGL under Linux miscompiles

Post by terefang »

here's the patch

Code: Select all

diff -cr Irrlicht/COpenGLDriver.cpp Irrlicht.p/COpenGLDriver.cpp
*** Irrlicht/COpenGLDriver.cpp  2005-11-30 20:02:54.000000000 +0100
--- Irrlicht.p/COpenGLDriver.cpp        2005-12-01 09:55:00.000000000 +0100
***************
*** 403,412 ****
                        if (MultiTextureExtension)
                                os::Printer::log("Multittexturing active.");

!                       #ifdef GLX_VERSION_1_4
!                               #define IRR_OGL_LOAD_EXTENSION glXGetProcAddress
!                               #else
                                #define IRR_OGL_LOAD_EXTENSION glXGetProcAddressARB
                        #endif

                        pGlActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)
--- 403,412 ----
                        if (MultiTextureExtension)
                                os::Printer::log("Multittexturing active.");

!                       #ifdef GLX_ARB_get_proc_address
                                #define IRR_OGL_LOAD_EXTENSION glXGetProcAddressARB
+                               #else
+                               #define IRR_OGL_LOAD_EXTENSION glXGetProcAddress
                        #endif

                        pGlActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)
terefang
nVidia 7800GT/256, AMD64-X2 4k2, Latest Fedora/CentOS
hybrid

Post by hybrid »

This should be the old nvidia include bug, it's not a general problem with the code. You have to adapt the include path such that the nvidia OpenGL includes are chosen. Otherwise there's a mismatch between includes and library.
terefang
Posts: 48
Joined: Tue Jun 21, 2005 9:56 am

Post by terefang »

hybrid wrote:This should be the old nvidia include bug, it's not a general problem with the code. You have to adapt the include path such that the nvidia OpenGL includes are chosen. Otherwise there's a mismatch between includes and library.
i verified this against X.org/Mesa-6.8.2-1.EL.13.20 and
nVidia-1.0-7676 headers and my fix holds true, because
Mesa defines either:

Code: Select all

GLX_ARB_get_proc_address with
extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);
or:

Code: Select all

extern void * glXGetProcAddress (const GLubyte *);
yet nvidia will always define both for compatiblety. but linking to
nvidia libraries will fail with unresolved symbols for 'glXGetProcAddress'.
Last edited by terefang on Thu Dec 01, 2005 2:07 pm, edited 2 times in total.
terefang
nVidia 7800GT/256, AMD64-X2 4k2, Latest Fedora/CentOS
hybrid

Post by hybrid »

So for me (ATI headers) its working with the original code already. And your code relies on all these things to be defines, which might not always hold. But searching for an always working scheme has been a struggle for quite some time now.
terefang
Posts: 48
Joined: Tue Jun 21, 2005 9:56 am

Post by terefang »

hybrid wrote:So for me (ATI headers) its working with the original code already. And your code relies on all these things to be defines, which might not always hold. But searching for an always working scheme has been a struggle for quite some time now.
what may be wrong is the assumption that 'glXGetProcAddressARB' is
funtionally equivalent to 'glXGetProcAddress' under both Mesa and nVidia.

i'd like to cite for Mesa install:
http://www.gamedev.net/community/forums ... _id=326004

the assumption from here:
http://lists.freebsd.org/pipermail/free ... 01686.html
is wrong since nvidia headers now define GLX_VERSION_1_4

i also verified this agains ATI (fglrx_6_8_0-8.19.10-1.i386.rpm) headers and
my fix still does no break since ATI does not define 'GLX_ARB_get_proc_address'
and links ok with 'glXGetProcAddress'.
terefang
nVidia 7800GT/256, AMD64-X2 4k2, Latest Fedora/CentOS
hybrid

Post by hybrid »

I see that I mixed up with the different symbols and functions. So GLX_ARB_get_proc_address is always a define? Is it an official OpenGL define, or just Mesa?
But why not using it's value directly? Just define the Irrlicht define to GLX_ARB_get_proc_address, which should be correct. If it does not exist use the original code as fallback. Since all current solutions are hacks it's probably best to be as fail safe as possible.
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Ah, that's an interesting discussion, and I'm really keen on getting this problem solved. I think I'll try out some versions, upload them and let lots of people try it out, that's the only way you can really be sure :)
terefang
Posts: 48
Joined: Tue Jun 21, 2005 9:56 am

Post by terefang »

hybrid wrote:I see that I mixed up with the different symbols and functions. So GLX_ARB_get_proc_address is always a define? Is it an official OpenGL define, or just Mesa?
But why not using it's value directly? Just define the Irrlicht define to GLX_ARB_get_proc_address, which should be correct. If it does not exist use the original code as fallback. Since all current solutions are hacks it's probably best to be as fail safe as possible.
as i see it, GLX_ARB_get_proc_address is defined to '1' in the opengl headers if the corresponding library supports only the ARB version of the function-call.
terefang
nVidia 7800GT/256, AMD64-X2 4k2, Latest Fedora/CentOS
pyrocrickett
Posts: 3
Joined: Fri Nov 11, 2005 2:31 am
Location: Notre Dame, IN

n00b help....

Post by pyrocrickett »

How do I apply this patch? I've copied the code from the first post into a file I called "patch" in my "irrlicht-0.14.0/" directory.
==========
pyroCrickett
--------------------
there's no place like 127.0.0.1
terefang
Posts: 48
Joined: Tue Jun 21, 2005 9:56 am

Post by terefang »

/usr/bin/patch -p1 < patch
terefang
nVidia 7800GT/256, AMD64-X2 4k2, Latest Fedora/CentOS
hybrid

Post by hybrid »

terefang wrote:/usr/bin/patch -p1 < patch
You'll have to be in directory source/Irrlicht for this to work, though. Check the filename in the first line of the patch. This is the file to be patched. But using the -p1 tells the patch tool to remove the first directory entry of the file name- you could instead use -p0 and issue that call from source/ directory.
Azgoth

Post by Azgoth »

Hi all,

My lib is compiling well, but with or without you're patch, I experience an error at each launch of examples, with a :
./example: symbol lookup error: ./example: undefined symbol: glXGetProcAddress
Any idea ?

Regards,

Phil Aka Azgoth
hybrid

Post by hybrid »

Again some problem with header/library mismatch. Your OpenGL headers used during compilation do not match with the libraries loaded at start. If you're using NVidia drivers you should search for the correct includes in some nvidia speicif directory (I think under /usr/share/doc/packages/). And be sure to use the same libraries during linking and execution as different APIs will break execution.
pyrocrickett
Posts: 3
Joined: Fri Nov 11, 2005 2:31 am
Location: Notre Dame, IN

Post by pyrocrickett »

I attempted to apply the patch, but I got the following error:

Code: Select all

$ patch -p1 < ../patches/OpenGLGetProc.patch
patching file COpenGLDriver.cpp
Hunk #1 FAILED at 403.
1 out of 1 hunk FAILED -- saving rejects to file COpenGLDriver.cpp.rej
I ran it in my source/Irrlicht/ directory (my patches, obviously, are in my source/patches/ directory).
==========
pyroCrickett
--------------------
there's no place like 127.0.0.1
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

I've had the exact same problem everytime I get a new Irrlicht version. I'm also using the nVidia drivers for OpenGL. I patch my irrlicht version by hand everytime to make it work... :\ I'm using Xandros 3.0 Deluxe, which is based on Debian.

I understand why I would need to use nVidia specific headers for nVidia specific libraries, but I'm not specifying nVidia specific libraries when I build, just -lGL. It really is a mis-configured system, IMO. If the default GL libraries are nVidia, the default GL includes should be nVidia too.


LOL I never figured out the header file thing, but I didn't try very hard. ;)
Post Reply