Irrlicht and Linux

BlitzMax Forums/BlitzMax Programming/Irrlicht and Linux

gman(Posted 2005) [#1]
im curious... has anyone compiled and run the Irrlicht mods in Linux yet?


DStastny(Posted 2005) [#2]
I am trying to get a linux box up and running hopefully this weekend. If I can get BMAX to work I think i can make it go :)

Doug Stastny


gman(Posted 2005) [#3]
thx Budman :) im downloading Topologi Linux. im not a linux guy though so i bet you beat me to the punch ;) i have a feeling im going to get stuck during installation or just getting a desktop to show.


jamesmintram(Posted 2005) [#4]
Hi, I have been messing around with slackware and the Irrlicht mod. I have managed to compile it to some degree, but I get a funny error right at the end of compilation even though the lib files are created.

"Could not read from Ln (or In) file included from gg.mod/irrlicht.mod/irrlicht.cpp" so I click ok then get:
"Compile error"

There need to be some changes to the source files as well for it to compile under linux:

1) You need to change all the \ to / when it comes to file names - I wrote a script to do this for me.

2) There is a file called array_SKey_something.h which has case issues ie its all lower case but within the source it has higher case within the name as well.

3) I have ( as far as i know ) compiled the module, but when I try and compile a program, there are lots of undefined references to opengl functions. If i compile the original examples using gcc it works fine. I have installed the mesa opengl libs and recompiled irrlicht and placed the new .a file into BlitzMax's lib folder. I have then rebuilt all modules but I still get undefined references, maybe it could be something to do with my mystery error when building the module.


Here is a log from compiling the module from teh command line:

http://www.mintratech.co.uk/bmakelog.txt

And here is a section of my error log when compiling example 2:

/home/james/downloads/BlitzMax109/lib/libIrrlicht.a(COpenGLTexture.o)(.text+0x755): In function `irr::video::COpenGLTexture::copyTexture()':
: undefined reference to `glBindTexture'
/home/james/downloads/BlitzMax109/lib/libIrrlicht.a(COpenGLTexture.o)(.text+0x7ae): In function `irr::video::COpenGLTexture::copyTexture()':
: undefined reference to `glTexImage2D'
/home/james/downloads/BlitzMax109/lib/libIrrlicht.a(COpenGLTexture.o)(.text+0x7ec): In function `irr::video::COpenGLTexture::copyTexture()':
: undefined reference to `glTexParameteri'
/home/james/downloads/BlitzMax109/lib/libIrrlicht.a(COpenGLTexture.o)(.text+0x806): In function `irr::video::COpenGLTexture::copyTexture()':
: undefined reference to `glTexParameteri'
/home/james/downloads/BlitzMax109/lib/libIrrlicht.a(COpenGLTexture.o)(.text+0x84b): In function `irr::video::COpenGLTexture::copyTexture()':
: undefined reference to `glTexParameterf'
/home/james/downloads/BlitzMax109/lib/libIrrlicht.a(COpenGLTexture.o)(.text+0x866): In function `irr::video::COpenGLTexture::copyTexture()':
: undefined reference to `glTexParameterf'
collect2: ld returned 1 exit status


jamesmintram(Posted 2005) [#5]
W00t Got it working!! Turns out your need to explicitly link Opnegl To your bmax app with this line:

import "-lGL"

Heres a screeny :D

http://www.mintratech.co.uk/snapshot1.png

Now the only issue obviously is the titlebar name. This goes all screwy after keyboard input, not sure why as I haven't really looked into it!

And I have just realised that the lighting looks messed up, but I think that is an issure with Irrlicht and Linux as i remember reading about it somehwere. I will investigate further.


DStastny(Posted 2005) [#6]
I got all the compile issues that james found but I cant get past the linking.

I have older Nvida card it was bad enough having to recomiple the kernal to get OpenGL support at all. Bmax works fine but there seems to be some problem linking to the appropriate call to get the glXGetProcAddress linking.

Apprently the headers defines glXGetProcAddress but the object file that Nvidia creates exports glXGetProcAddressARB. I am not a OpenGL linux person at all but Im still pluggin...

As for lighting problem james there is bug in the extension code a cut paste error, on the Irrlicht Forums that I stumbled accross. trying to get my code to link.

My ENET network module comipled and ran which was pretty cool. I brought my test server up under Linux and connected to it from my test windows client.


Doug Stastny


skidracer(Posted 2005) [#7]
I've started using glxGetProcAddressARB , in BlitzMax v1.10 which should be out tonight check out bbGLGraphicsSetSwapInterval in glgraphics.mod/glgraphics.linux.c for an example.


gman(Posted 2005) [#8]
james has been kind enough to send me a working build for linux for merging into my source. i have downloaded but wont have a chance to look at it until tomorrow. i have forwarded it to you Budman if you want to see if you can compile with it. also, i have seen a lighting issue with OpenGL as well but it was on my laptop. i figured it was driver related.


DStastny(Posted 2005) [#9]
Thanks Skid will check it out. Irrlicht doesnt use Glew which is probably the biggest compaitbility resovler with the various G/L implementations under Linux I suspect since the BMAX stuff all seems to work..

Funny that they changed the API but the vendors cant seem to agree to change there implmentations. Nvidias headers are different than XORGs. How do you code to muliple enviroments without having your users recompile the source.

I did get it up and running with kludgy hack with #defines.

To fix the lighting bug requires rebuild of the DLLs. I would probably just wait for update to Irrlicht for windows as the DirectX works better.

I have fixed and recompiled the Linux but hacked it to work on my machine so dont know how well it will work anywhere else. The CPP demos compile and run cant get BMAX to work.

Thanks gman maybe james changed something different than I did with the BMAX mods and it might fix my problems.

might have to wait few days as after poking with drivers til 3am last night. I have honey do list from my wife :P

Doug Stastny


jamesmintram(Posted 2005) [#10]
Well, I to get it working I installed the MesaGL libs after recompiling them, I had to overwrite my NVidia GL Libraries (Nasty I know) and it was a bit of a tempory hack to get it working, but I am going to work in getting it to work on the nvidia libraries.

Will update my progress here.


DStastny(Posted 2005) [#11]
Ok here is something I came across.

The C++ demos work fine with my build. BMX Demos dont.

As you saw text gets fubar'd, I have some other issues not sure if all of them are related to just this but might be to useage of Size_T as well.

The issue I tracked it down to is Blitzmax defines Unicode as a short->16bit. Irrlicht uses w_chart. Under Linux 32 bit that is a int->32 bit,under 64 bit linux its a long.

So everywhere in the wrapper that passes strings wont work.

Looks like we are gonna need some functions to translate between 16bit unicode and w_chart, to get this to work under Linux.

I think the only way to get the GL Extension issue resolved is to change the way irrlicht access the GL extentions. I still think if it was recoded to use GLEW it would give better compatibility wihtout all the damn #ifdef's.

Niko- Irrlichts author seems to really focus on DX and not OpenGL so much and although cross platform there is some nasty code at the driver levels.

Im getting pretty familar with the Irrlicht source so I might take a crack at it. First up is solve the multibyte code issue.

Doug Stastny


jamesmintram(Posted 2005) [#12]
W00t I have managed to get it working properly with the NVidia opengl drivers, theres a simple change that is needed to be made to the irrlicht source code.

Ive also had to make another change with respect to the textures going mental which is now sorted and it runs at full speed which is always good :D

Budman, I will email you the sorce code I have for irrlicht, along with a brief description of what I have changed.

http://www.mintratech.co.uk/snapshot2.png


gman(Posted 2005) [#13]
just an FYI... the mods have been updated with linux compatibility and are now available for download from the worklog.

a big thank-you to Budman and jamesmintram


Isaac P(Posted 2005) [#14]
Sorry, only just revisiting Bmax after a long period. How exactly would I use this on linux.

By that I mean, where do i have to place everything, how does it all need setting up?

And is there some kind of code reference?

Sorry if this has all been answered before but i cant get the search function to respond effectively :(


jamesmintram(Posted 2005) [#15]
Install linux Opengl drivers for your video card.
Download module archive, extract into your mods directory so its like this:

blitamax/mods/gg.mod/

Place the libIrrlicht.a file into

blitzmax/lib

And you should be able to compile your stuff! Any problems just ask.


Isaac P(Posted 2005) [#16]
Heh already got my drivers installed. Installing the ATI drivers on a FC4 installation that uses GCC4 was no easy task, but i managed it.

I see how it has to be now, i was going one directory level too far. I wasn't sure if I had to place irrlicht.mod and irrbmax.mod in the mods directory or the actual gg.mod directory.

Thanks for the help :)


Isaac P(Posted 2005) [#17]
NM see below


Isaac P(Posted 2005) [#18]
NM I'm stupid :P