Why exactly can't it work with Mac OS?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
fretnoize
Posts: 43
Joined: Sun Feb 01, 2004 4:57 am
Location: Los Angeles

Post by fretnoize »

sorry I should have been clearer. I didn't mean the larger of the two bytes is the most significant byte, but rather the 16^x place that the byte would actually represent. In the case of my example(09C4), 09 represents 16^3 and 16^2 repectively.

at least this is my understanding, and i can be wrong.

thanks, warui, for pointing out that my post needed some clarification, let me know if i have anything else wrong :)
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

I find this issue (Irrlicht on Mac) also interesting and important! I'm not a Mac person, but it would be great to have Irrlicht apps running on the mac to have it as cross-platform as possible and thus have a greater target audience.

In feburary Niko was giving an interview:
http://www.untergrund-spiele.de/interview_niko.php

There he was saying something interesting about this topic:

Q: Auf welchen Plattformen ist Irrlicht bisher verfügbar?
Niko: Offiziell bisher nur Linux und Windows, weil das die Systeme sind, die ich persönlich auch verwende. Einige Leute haben Irrlicht aber auch schon auf anderen Plattformen zum Laufen gebracht: Auf dem Mac und sogar auf der XBox. Und vor kurzem hat mir sogar jemand geschrieben, dass er versucht, Irrlicht mal auf der PS2 zum laufen zu bringen, bin mal gespannt :)

Well, it's in german. Here is a quick translation:

Q: For which platforms is Irrlicht available so far?
Niko: Officially only Linux and Windows so far. Because these are systems that I personally use. But some people have already made Irrlicht run on other platforms: On the Mac and even on the XBox. And recently somebody even wrote me that he is trying to make it run on the PS2, I'm curious about it :)

Besides in the features list of the Irrlicht homepage you can read the following:
"More platforms like MacOS are planned, but have not been implemented yet."

Maybe it would be nice to hear Niko saying something (more) about it! :-)
brcolow

Post by brcolow »

Yes, hopefully Niko can give us some more input on exactly what, in his code, won't run on the mac.
schnarr

working on a port, but a long way to go

Post by schnarr »

I've been porting 0.6 to native mac (non-SDL), and I hear others are, or have tried, as well. Still no unified effort that I know of, though. I'm using a 10.2 Project Builder project due to the relative oldness of my mac (a G3/350) and my decision last year not to upgrade to 10.3 and spend the money on a new video card for my much newer PC (bad Apple Zealot - report to brainwashing station 13), and also am building it as an embeddable framework, which may not appeal to everyone (but a port to a library would be cake at that point). I've fixed most of the library issues but still have a few flagged - primarily endian-issues which don't affect compile... it might even run, but will look really ugly without them (but may also spit up over poorly formated bitmaps) I'll worry about those when I finish the mac driver, the last piece of code I need to fix to get it to compile. Libjpeg comes with endian-ness support, so no porting was necessary.

For reference, fixing endian can be done by taking something like this:
//! returns true if the file maybe is able to be loaded by this class
bool CImageLoaderBmp::isALoadableFileFormat(irr::io::IReadFile* file)
{
u16 headerID;
file->read(&headerID, sizeof(u16));
return headerID == 0x4d42;
}

and adding something like this:
//! returns true if the file maybe is able to be loaded by this class
bool CImageLoaderBmp::isALoadableFileFormat(irr::io::IReadFile* file)
{
u16 headerID;
file->read(&headerID, sizeof(u16));
SwapBytes(&headerID, 2);
return headerID == 0x4d42;
}

The SwapBytes function (not shown, but do a google search and you'll find one... maybe even one I've written ;) checks endian-ness and swaps bytes if necessary.

After that, some file system porting would be nice (use mac FS commands rather than UNIX ones).
SwiftCoder
Posts: 32
Joined: Thu Jan 15, 2004 7:33 pm
Location: Carribean

Post by SwiftCoder »

I have a completed Mac OS X port (using the SDL device) for IrrLicht version 0.6, sittin on my laptop at home, noone seemed interested in this when I completed it a couple of months ago.
If someone had an upload location, I would be happy to upload it so others can assist.
However, I have ported all the loaders, fixed the GL device, fixed the colors, etc., but for new user interface a native ten engine would be required, and this is a lot of work under cocoa.

If you are interested, please reply,

SwiftCoder
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

That's good news! I think a good place to upload something would be maybe http://www.eve-corp.com/ by saigumi (free hosting for irrlicht based projects). Check it out!
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Take a look at the TPIM post ( do a search on the forum ). I'm sure Saigumi will host it for you if you PM him. If not, Niko (designer of the engine ) will definatly be interested if you sling him an email.
brcolow

Post by brcolow »

Yes! Please upload it man, this would be GREAT. Either eve-corp, email it to me and I'll host it, or just geocities or 50megs. Great work, can't wait to see it!
schnarr

Post by schnarr »

SwiftCoder wrote:I have a completed Mac OS X port (using the SDL device) for IrrLicht version 0.6, sittin on my laptop at home, noone seemed interested in this when I completed it a couple of months ago.
If someone had an upload location, I would be happy to upload it so others can assist.
However, I have ported all the loaders, fixed the GL device, fixed the colors, etc., but for new user interface a native ten engine would be required, and this is a lot of work under cocoa.

If you are interested, please reply,

SwiftCoder
I had heard there was an SDL port, and since you mentioned it, I AM about 1/2 - 3/4 of the way through creating a native CIrrDeviceMac - primarily using Core Graphics (full screen only), though. I've added hooks for Windowed mode, but am ignoring them at present.

It's semi-slow going, mainly because of 2 hour blocks of programming time max lately (work sucks). I completed the header port before going to work this morning, though I haven't tried to compile it (functionally complete :). I'm now working on the event loop (should be fairly trivial - maybe done tonight) and then the keyboard control (harder... but I can look at how SDL does it and that should simplify things immensely).

It'd be invaluable to have working code, though - even if to just identify problem areas. I eventually need to fix endian issues, anyway, and if you've done it, might as well not double the work. Since I also have the SDL source, I could find examples and debug quickly.

btw, you must be using OS X.3 - I had to dupe some wchar.h functions to get it to compile on X.2. I suspected it was in X.3 because it's in FreeBSD after 4.3 (which X.2 is based on) and verified today.
timdoug

Post by timdoug »

I've gotten it to compile and run on my 10.3.4 box. Just some changes to the Makefile and CIrrDeviceLinux.cpp (because X11 on OSX doesn't like VidMode...). All of example 1 works except for the text (it complains about #DefaultFont, which should be easy to fix) and the actual model, which is probably caused by the endianness of Irrlicht.

I'll post a patch in a sec once I clean it up.
Guest

Post by Guest »

Yeah, so it looks like just the endianness (and that dang VidMode X11 thing) now.

DualG5:~/Desktop/irrlicht-0.6/examples/1.HelloWorld timdoug$ ./example
Irrlicht Engine version 0.6
Linux
Creating X window...
debugtest Choosing visual display with stencil...
Starting windowed mode...
Connecting glx context to window...
Window created.
This driver is not available in Linux. Trying OpenGL.
OpenGL Renderer.
OpenGL driver version is 1.2 or better.
Multitexturing disabled.
Could not load texture: #DefaultFont
Error: Could not load built-in Font.
MD2 Loader: Wrong file header: /Users/timdoug/Desktop/irrlicht-0.6/media/sydney.md2
Could not load mesh, file format seems to be unsupported: /Users/timdoug/Desktop/irrlicht-0.6/media/sydney.md2
Quit message received.
Deleting window...
DualG5:~/Desktop/irrlicht-0.6/examples/1.HelloWorld timdoug$


Here's my patch, apply with patch -p0 <the_patch in the base Irrlicht folder.

----cut here----
diff -urN source-old/CIrrDeviceLinux.cpp source/CIrrDeviceLinux.cpp
--- source-old/CIrrDeviceLinux.cpp Tue Mar 9 12:22:16 2004
+++ source/CIrrDeviceLinux.cpp Tue Jul 13 22:04:57 2004
@@ -123,6 +123,9 @@
// query extension

s32 minor, major;
+
+ // brutal OS X hack -- just untill I can figure out how to get XFree86-VidModeExtension working
+ /*
if (fullscreen && !XF86VidModeQueryVersion(display, &major, &minor))
{
os::Printer::log("VidMode extension must be intalled to let irrlicht "
@@ -156,6 +159,8 @@
VideoModeList.addMode(core::dimension2d<s32>(
modes->hdisplay, modes->vdisplay), 0);
}
+ */
+ //end brutal OSX hack

// no double buffer, 4 bits per color, 16 bit zbuffer
int visualAttrNoDoubleBuffer[] =
@@ -254,6 +259,8 @@

// switch to fullscreen if extension is installed.

+ //brutal OSX hack part 2
+ /*
if (fullscreen && bestMode != -1)
{
os::Printer::log("Starting fullscreen mode...", ELL_INFORMATION);
@@ -287,6 +294,9 @@
}
else
{
+ */
+ //end brutal OSX hack
+
// we want windowed mode
if (fullscreen)
{
@@ -311,7 +321,7 @@
wmDelete = XInternAtom(display, wmDeleteWindow, True);
XSetWMProtocols(display, window, &wmDelete, 1);
XMapRaised(display, window);
- }
+ //} //more brutal OSX hack fun

// connect glx context to window
os::Printer::log("Connecting glx context to window...", ELL_INFORMATION);
diff -urN source-old/Makefile source/Makefile
--- source-old/Makefile Tue Mar 9 12:07:10 2004
+++ source/Makefile Tue Jul 13 21:58:15 2004
@@ -2,19 +2,26 @@
# Makefile for Linux, created from Bloodshed Win32 Makefile by N.Gebhardt.

CPP = g++
-LINKOBJ = CAnimatedMeshMD2.o CAnimatedMeshMS3D.o CAnimatedMeshSceneNode.o CBillboardSceneNode.o CBspTree.o CBspTreeSceneNode.o CCameraMayaSceneNode.o CCameraSceneNode.o CColorConverter.o CDirectX8Texture.o CFileList.o CFileSystem.o CFPSCounter.o CGUIButton.o CGUIEnvironment.o CGUIFileOpenDialog.o CGUIFont.o CGUIImage.o CGUIListBox.o CGUIMeshViewer.o CGUIScrollBar.o CGUISkin.o CGUIStaticText.o CGUIWindow.o CIrrDeviceWin32.o CLightSceneNode.o CLimitReadFile.o CMemoryReadFile.o CMeshSceneNode.o COctTreeSceneNode.o COpenGLTexture.o CQ3LevelMesh.o CReadFile.o CSceneManager.o CSceneNodeAnimatorFlyCircle.o CSceneNodeAnimatorRotation.o CSoftwareTexture.o CStaticMeshOBJ.o CTestSceneNode.o CTRFlat.o CTRFlatWire.o CTRGouraud.o CTRGouraudWire.o CTRTextureFlat.o CTRTextureFlatWire.o CTRTextureGouraud.o CTRTextureGouraudWire.o CVideoDirectX8.o CVideoNull.o CVideoOpenGL.o CVideoSoftware.o CZBuffer.o CZipReader.o Irrlicht.o os.o CCameraFPSSceneNode.o CGeometryCreator.o CSceneNodeAnimatorFlyStraight.o CSceneNodeAnimatorTexture.o CDefaultMeshFormatLoader.o CSkyBoxSceneNode.o CShadowVolumeSceneNode.o C3DSMeshFileLoader.o CSceneCollisionManager.o CIrrDeviceStub.o CParticleSystemSceneNode.o CParticleFadeOutAffector.o CParticleBoxEmitter.o CParticlePointEmitter.o CParticleGravityAffector.o CDummyTransformationSceneNode.o CGUIInOutFader.o CIrrDeviceLinux.o CMeshManipulator.o CMetaTriangleSelector.o COctTreeTriangleSelector.o CSceneNodeAnimatorCollisionResponse.o CSceneNodeAnimatorDelete.o CTriangleBBSelector.o CTriangleSelector.o CVideoModeList.o CWaterSurfaceSceneNode.o CGUIMessageBox.o CGUIModalScreen.o CEmptySceneNode.o CImage.o CImageLoaderBmp.o CImageLoaderJPG.o CImageLoaderPCX.o CImageLoaderPSD.o CImageLoaderTGA.o CLogger.o CTerrainSceneNode.o CDirectX9Texture.o CGUIContextMenu.o CGUIEditBox.o CGUIMenu.o CGUITabControl.o COSOperator.o CSceneNodeAnimatorFollowSpline.o CVideoDirectX9.o CXAnimationPlayer.o CXFileReader.o CXMeshFileLoader.o CTextReader.o CXMLReader.o CWriteFile.o CGUIComboBox.o CGUIToolBar.o CXMLWriter.o CGUICheckBox.o $(RES)
+LINKOBJ = CAnimatedMeshMD2.o CAnimatedMeshMS3D.o CAnimatedMeshSceneNode.o CBillboardSceneNode.o CBspTree.o CBspTreeSceneNode.o CCameraMayaSceneNode.o CCameraSceneNode.o CColorConverter.o CFileList.o CFileSystem.o CFPSCounter.o CGUIButton.o CGUIEnvironment.o CGUIFileOpenDialog.o CGUIFont.o CGUIImage.o CGUIListBox.o CGUIMeshViewer.o CGUIScrollBar.o CGUISkin.o CGUIStaticText.o CGUIWindow.o CLightSceneNode.o CLimitReadFile.o CMemoryReadFile.o CMeshSceneNode.o COctTreeSceneNode.o COpenGLTexture.o CQ3LevelMesh.o CReadFile.o CSceneManager.o CSceneNodeAnimatorFlyCircle.o CSceneNodeAnimatorRotation.o CSoftwareTexture.o CStaticMeshOBJ.o CTestSceneNode.o CTRFlat.o CTRFlatWire.o CTRGouraud.o CTRGouraudWire.o CTRTextureFlat.o CTRTextureFlatWire.o CTRTextureGouraud.o CTRTextureGouraudWire.o CVideoDirectX8.o CVideoNull.o CVideoOpenGL.o CVideoSoftware.o CZBuffer.o CZipReader.o os.o CCameraFPSSceneNode.o CGeometryCreator.o CSceneNodeAnimatorFlyStraight.o CSceneNodeAnimatorTexture.o CDefaultMeshFormatLoader.o CSkyBoxSceneNode.o CShadowVolumeSceneNode.o C3DSMeshFileLoader.o CSceneCollisionManager.o CIrrDeviceStub.o CParticleSystemSceneNode.o CParticleFadeOutAffector.o CParticleBoxEmitter.o CParticlePointEmitter.o CParticleGravityAffector.o CDummyTransformationSceneNode.o CGUIInOutFader.o CIrrDeviceLinux.o CMeshManipulator.o CMetaTriangleSelector.o COctTreeTriangleSelector.o CSceneNodeAnimatorCollisionResponse.o CSceneNodeAnimatorDelete.o CTriangleBBSelector.o CTriangleSelector.o CVideoModeList.o CWaterSurfaceSceneNode.o CGUIMessageBox.o CGUIModalScreen.o CEmptySceneNode.o CImage.o CImageLoaderBmp.o CImageLoaderJPG.o CImageLoaderPCX.o CImageLoaderPSD.o CImageLoaderTGA.o CLogger.o CTerrainSceneNode.o CGUIContextMenu.o CGUIEditBox.o CGUIMenu.o CGUITabControl.o COSOperator.o CSceneNodeAnimatorFollowSpline.o CVideoDirectX9.o CXAnimationPlayer.o CXFileReader.o CXMeshFileLoader.o CTextReader.o CXMLReader.o CWriteFile.o CGUIComboBox.o CGUIToolBar.o CXMLWriter.o CGUICheckBox.o $(RES)

LIBS = -L"/usr/X11R6/lib" -L"jpeglib" -L"zlib" --no-export-all-symbols --add-stdcall-alias -lGL -lXxf86vm -lz -ljpeg
-CXXINCS = -I"include/"
+CXXINCS = -I"include/" -I"/usr/X11R6/include/"
BIN = libIrrlicht.a
CXXFLAGS = $(CXXINCS) -DIRRLICHT_EXPORTS=1

all: $(LINKOBJ) $(BIN)
make -C jpeglib -f makefile.ansi libjpeg.a
make -C zlib -f Makefile
+ ranlib libIrrlicht.a
+ ranlib zlib/libz.a
+ ranlib jpeglib/libjpeg.a
+ rm -f ../lib/linux/libIrrlicht.a
+ rm -f ../lib/linux/libz.a
+ rm -f ../lib/linux/libjpeg.a
cp libIrrlicht.a ../lib/Linux/
- cp zlib/libz.a ../lib/Linux
- cp jpeglib/libjpeg.a ../lib/Linux
+ cp zlib/libz.a ../lib/Linux/
+ cp jpeglib/libjpeg.a ../lib/Linux/
+

clean:
rm -f $(LINKOBJ) $(BIN)
----cut here----

Sorry for such a long post. Please email any questions, comments, or anything to timdoug@GooglesNewEmailService.com (hint: replace that with gmail.com).

-tim
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

This is exactly why we need a cvs. 3-4 people working on different mac os ports :)
The Robomaniac
Project Head / Lead Programmer
Centaur Force
timdoug

Post by timdoug »

If someone sets one up I'd love to work on it.

...well there is already an sf project...hint...hint...
Guest

Post by Guest »

I thought that only Niko could set one up?
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

Niko is the only one who can and he wont :(
The Robomaniac
Project Head / Lead Programmer
Centaur Force
Post Reply