TLK and Mac Universal Binaries
by Rubes · in Torque Game Engine · 07/23/2006 (1:59 pm) · 35 replies
Just wondering if anyone has been able to compile TLK with TGE 1.4 on the Mac side while creating a Universal Binary. I was able to do it, and it works fine on my G4 desktop. But it has some pretty weird behavior on my Intel laptop...mostly some rendering issues, where at some angles everything turns green.
Has anyone been successful at getting a UB to run well on an Intel Mac, or is this something being worked on?
Has anyone been successful at getting a UB to run well on an Intel Mac, or is this something being worked on?
#22
07/29/2006 (3:46 pm)
Hmm, you know, early in testing Rob said something about green fog. Did you catch the UB change necessary in sceneGraph.cc? There's a #ifdef TORQUE_OS_MAC that should be #ifdef TORQUE_BIG_ENDIAN in the fog texture generation code.
#23
I think what happened is that I must have overwritten the sceneGraph.cc file when I merged my old project with the new Universal build code. I may have done that with other files as well, so I'll have to go back and look everything over. Thanks for all that help!
It's a real challenge to merge your old code, TGE 1.4u code, and TLK 1.4u code...
07/29/2006 (4:04 pm)
You're right, that did the trick. Everything seems to be working correctly now.I think what happened is that I must have overwritten the sceneGraph.cc file when I merged my old project with the new Universal build code. I may have done that with other files as well, so I'll have to go back and look everything over. Thanks for all that help!
It's a real challenge to merge your old code, TGE 1.4u code, and TLK 1.4u code...
#24
If you can do me a massive favor, and download a new copy of the TLK, drop in the UBTLK.zip files (and the lib files from TGE 1.4u) and just confirm that it all works on an Intel mac, I'll put it up as a resource.
07/29/2006 (4:57 pm)
Woo! Congratulations on getting a working UB build.If you can do me a massive favor, and download a new copy of the TLK, drop in the UBTLK.zip files (and the lib files from TGE 1.4u) and just confirm that it all works on an Intel mac, I'll put it up as a resource.
#25
07/29/2006 (11:12 pm)
Sure thing, I'll give it a go tomorrow and let you know.
#26
- I installed a fresh copy of TLK 1.4
- I replaced the files in the engine directory with the ones from the UBTLK download
- I replaced the files in the pb directory with the ones from the UBTLK download (including the project file)
- I created a "build" directory within the pb directory (so the compiler scripts will run properly)
- (see Edit below)
- I compiled everything
And it compiled without any problems. I then tried running the newly created app with the "starter.fps" mod for the TLK demo, and it seems to work fine on both PPC and Intel Mac sides.
Nice work!
EDIT: I forgot to mention another step -- I replaced the lib directory with the lib directory from the latest TGE 1.4u download.
07/30/2006 (1:10 pm)
I tried the following:- I installed a fresh copy of TLK 1.4
- I replaced the files in the engine directory with the ones from the UBTLK download
- I replaced the files in the pb directory with the ones from the UBTLK download (including the project file)
- I created a "build" directory within the pb directory (so the compiler scripts will run properly)
- (see Edit below)
- I compiled everything
And it compiled without any problems. I then tried running the newly created app with the "starter.fps" mod for the TLK demo, and it seems to work fine on both PPC and Intel Mac sides.
Nice work!
EDIT: I forgot to mention another step -- I replaced the lib directory with the lib directory from the latest TGE 1.4u download.
#27
At the end, in the linking process, it gives me 1 error and 5 warnings:
cd /Applications/LightingPack/pb
/usr/bin/g++-4.0 -o /Applications/LightingPack/pb/../example/torque_xcode_2_2_UB.build/Default/Torque-MacCarb-Release.build/Objects-normal/i386/Torque\ Demo\ OSX -L/Applications/LightingPack/pb/../example/Default -F/Applications/LightingPack/pb/../example/Default -F../lib/openal/macosx -F../lib/xiph/macosx -filelist /Applications/LightingPack/pb/../example/torque_xcode_2_2_UB.build/Default/Torque-MacCarb-Release.build/Objects-normal/i386/Torque\ Demo\ OSX.LinkFileList -framework AGL -framework Carbon -framework OpenGL -framework CoreFoundation -framework DrawSprocket -framework OpenAL -framework Ogg -framework Vorbis -framework Theora -framework ApplicationServices -arch i386 -prebind -mmacosx-version-min=10.4 -flat_namespace -isysroot /Developer/SDKs/MacOSX10.4u.sdk
/usr/bin/ld: warning -prebind ignored because MACOSX_DEPLOYMENT_TARGET environment variable greater or equal to 10.4
/usr/bin/ld: warning ../lib/openal/macosx/OpenAL.framework/OpenAL cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/bin/ld: warning ../lib/xiph/macosx/Ogg.framework/Ogg cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/bin/ld: warning ../lib/xiph/macosx/Vorbis.framework/Vorbis cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/bin/ld: warning ../lib/xiph/macosx/Theora.framework/Theora cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/bin/ld: Undefined symbols:
_alDeleteSources
_alDistanceModel
_alEnable
_alGenSources
_alGetBufferi
_alGetError
_alGetListener3f
_alGetListenerf
_alGetSourcef
_alGetSourcefv
_alGetSourcei
_alListener3f
_alListenerf
_alListenerfv
_alSource3f
_alSourcePlay
_alSourceStop
_alSourcef
_alSourcefv
_alSourcei
_alcCloseDevice
_alcCreateContext
_alcDestroyContext
_alcMakeContextCurrent
_alcOpenDevice
_alBufferData
_alDeleteBuffers
_alGenBuffers
_alIsBuffer
_alcGetCurrentContext
_alGetListeneri
_alGetString
_alSourceQueueBuffers
_alSourceUnqueueBuffers
_ogg_page_continued
_ogg_page_eos
_ogg_page_granulepos
_ogg_page_serialno
_ogg_stream_clear
_ogg_stream_init
_ogg_stream_packetout
_ogg_stream_packetpeek
_ogg_stream_pagein
_ogg_stream_reset
_ogg_sync_buffer
_ogg_sync_clear
_ogg_sync_init
_ogg_sync_pageseek
_ogg_sync_reset
_ogg_sync_wrote
_vorbis_block_clear
_vorbis_block_init
_vorbis_comment_clear
_vorbis_comment_init
_vorbis_dsp_clear
_vorbis_info_blocksize
_vorbis_info_clear
_vorbis_info_init
_vorbis_packet_blocksize
_vorbis_synthesis
_vorbis_synthesis_blockin
_vorbis_synthesis_headerin
_vorbis_synthesis_init
_vorbis_synthesis_pcmout
_vorbis_synthesis_read
_ogg_page_bos
_ogg_sync_pageout
_theora_clear
_theora_comment_clear
_theora_comment_init
_theora_decode_YUVout
_theora_decode_header
_theora_decode_init
_theora_decode_packetin
_theora_granule_time
_theora_info_clear
_theora_info_init
collect2: ld returned 1 exit status
Any help will be really very apreciated, since currently I just cannot compile any TLK 1.4 version at all... :(
Thank you in advance.
07/31/2006 (3:30 am)
I have just tryed the same exact stepts on my G4/1400, MacOsX 4.7 and cannot get it to compile.At the end, in the linking process, it gives me 1 error and 5 warnings:
cd /Applications/LightingPack/pb
/usr/bin/g++-4.0 -o /Applications/LightingPack/pb/../example/torque_xcode_2_2_UB.build/Default/Torque-MacCarb-Release.build/Objects-normal/i386/Torque\ Demo\ OSX -L/Applications/LightingPack/pb/../example/Default -F/Applications/LightingPack/pb/../example/Default -F../lib/openal/macosx -F../lib/xiph/macosx -filelist /Applications/LightingPack/pb/../example/torque_xcode_2_2_UB.build/Default/Torque-MacCarb-Release.build/Objects-normal/i386/Torque\ Demo\ OSX.LinkFileList -framework AGL -framework Carbon -framework OpenGL -framework CoreFoundation -framework DrawSprocket -framework OpenAL -framework Ogg -framework Vorbis -framework Theora -framework ApplicationServices -arch i386 -prebind -mmacosx-version-min=10.4 -flat_namespace -isysroot /Developer/SDKs/MacOSX10.4u.sdk
/usr/bin/ld: warning -prebind ignored because MACOSX_DEPLOYMENT_TARGET environment variable greater or equal to 10.4
/usr/bin/ld: warning ../lib/openal/macosx/OpenAL.framework/OpenAL cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/bin/ld: warning ../lib/xiph/macosx/Ogg.framework/Ogg cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/bin/ld: warning ../lib/xiph/macosx/Vorbis.framework/Vorbis cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/bin/ld: warning ../lib/xiph/macosx/Theora.framework/Theora cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/bin/ld: Undefined symbols:
_alDeleteSources
_alDistanceModel
_alEnable
_alGenSources
_alGetBufferi
_alGetError
_alGetListener3f
_alGetListenerf
_alGetSourcef
_alGetSourcefv
_alGetSourcei
_alListener3f
_alListenerf
_alListenerfv
_alSource3f
_alSourcePlay
_alSourceStop
_alSourcef
_alSourcefv
_alSourcei
_alcCloseDevice
_alcCreateContext
_alcDestroyContext
_alcMakeContextCurrent
_alcOpenDevice
_alBufferData
_alDeleteBuffers
_alGenBuffers
_alIsBuffer
_alcGetCurrentContext
_alGetListeneri
_alGetString
_alSourceQueueBuffers
_alSourceUnqueueBuffers
_ogg_page_continued
_ogg_page_eos
_ogg_page_granulepos
_ogg_page_serialno
_ogg_stream_clear
_ogg_stream_init
_ogg_stream_packetout
_ogg_stream_packetpeek
_ogg_stream_pagein
_ogg_stream_reset
_ogg_sync_buffer
_ogg_sync_clear
_ogg_sync_init
_ogg_sync_pageseek
_ogg_sync_reset
_ogg_sync_wrote
_vorbis_block_clear
_vorbis_block_init
_vorbis_comment_clear
_vorbis_comment_init
_vorbis_dsp_clear
_vorbis_info_blocksize
_vorbis_info_clear
_vorbis_info_init
_vorbis_packet_blocksize
_vorbis_synthesis
_vorbis_synthesis_blockin
_vorbis_synthesis_headerin
_vorbis_synthesis_init
_vorbis_synthesis_pcmout
_vorbis_synthesis_read
_ogg_page_bos
_ogg_sync_pageout
_theora_clear
_theora_comment_clear
_theora_comment_init
_theora_decode_YUVout
_theora_decode_header
_theora_decode_init
_theora_decode_packetin
_theora_granule_time
_theora_info_clear
_theora_info_init
collect2: ld returned 1 exit status
Any help will be really very apreciated, since currently I just cannot compile any TLK 1.4 version at all... :(
Thank you in advance.
#28
07/31/2006 (4:05 am)
Did you run the fix-up scripts in the Mac project file directory? I'm not sure why they are necessary as TGE 1.3 didn't need them, but you need to run them for TGE 1.4 based products.
#29
Looking at what was happening there was obviously z-fighting going on (same as the pictures above), and looking at the Mac interior render path the fog is rendered in a separate pass from the main interior materials (which opens up the possibility for z-fighting). This seems be a problem limited to that render pathway as the PCs use fog coords during the main render pass (in another pathway), however due to endian issues that pathway doesn't render fog correctly on Mac either (at least in TGE 1.2.x - 1.3, I haven't revisited the issue in 1.4).
This is off topic, but could help to answer questions later.
07/31/2006 (4:16 am)
Regarding Mac and fog; I honestly don't know what the issue is, however we did have a very unpleasant experience last IGC that ultimately involved us removing most of the TLK demo missions from the Mac demo machines (the PCs were unaffected). Half way through the conference I decided to take a deeper look into the issue and found that disabling the mission fog (setting the fog range to beyond the max view distance) made the problem go away.Looking at what was happening there was obviously z-fighting going on (same as the pictures above), and looking at the Mac interior render path the fog is rendered in a separate pass from the main interior materials (which opens up the possibility for z-fighting). This seems be a problem limited to that render pathway as the PCs use fog coords during the main render pass (in another pathway), however due to endian issues that pathway doesn't render fog correctly on Mac either (at least in TGE 1.2.x - 1.3, I haven't revisited the issue in 1.4).
This is off topic, but could help to answer questions later.
#30
07/31/2006 (7:04 am)
I edited my post above -- I forgot to mention one other step: replacing the lib folder with the lib folder from the latest TGE 1.4u build...this is likely causing those compilation problems.
#31
Anyway, the compiled version from the TLK1.4 download does not suffer of this, it works like a charm.
07/31/2006 (8:24 am)
Thanks, John and Rubes: doing both I finally succeded in compiling TLK 1.4. But now I see my player sometimes green, dark, and other red... I remember reading this was another issue... I will look for some more info.Anyway, the compiled version from the TLK1.4 download does not suffer of this, it works like a charm.
#32
Any advice would be very apreciated.
07/31/2006 (8:50 am)
I tried with the sceneGraph.cc change (#ifdef TORQUE_OS_MAC that should be #ifdef TORQUE_BIG_ENDIAN), but it did not resolve the problem. The strange thing is that it is only hapenning with a project of mine, but if I open the starter.fps project, all seems to work fine and Ork is not green nor red... so I think this should be something with older projects...? My project was developed in TLK1.3, but it works well if I use the binary from the oficial TLK1.4 download.Any advice would be very apreciated.
#33
08/02/2006 (7:49 am)
Gustavo, there's quite a few other places I'm finding the #ifdef needs changing, for example in the bitmapExtrude5551_c() function in dgl/gBitmap.cc. What I'm doing now is looking at all color-related references to TORQUE_OS_MAC in my TGE1.3 project, and cross-referencing the same functions in a clean TGE1.4 build, to find which ones should be changed
#34
I'm not sure what problems you're running into but the current TLK endian color conversions work correctly. You might want to make sure they're returned to the TLK defaults. The issue is that the ifdefs using TORQUE_OS_MAC are for big endian only.
I haven't seen the TGE 1.4u code yet, but there should be a Mac little endian define for the x86 platform, if so make sure the x86 platform is using the little endian code (the same code used by the win32/linux platforms).
08/02/2006 (7:59 am)
Hi guys,I'm not sure what problems you're running into but the current TLK endian color conversions work correctly. You might want to make sure they're returned to the TLK defaults. The issue is that the ifdefs using TORQUE_OS_MAC are for big endian only.
I haven't seen the TGE 1.4u code yet, but there should be a Mac little endian define for the x86 platform, if so make sure the x86 platform is using the little endian code (the same code used by the win32/linux platforms).
#35
Things are strange, and maybe problem is not TLK.
10/03/2006 (9:30 pm)
Hmmm, I have been tested Torque CVS (1.4.2 maybe) and with torque without TLK I got a strange behavior, very similar to that one reported in this thread. The Orc seems to get the wrong "color" of lightmap, but very quickly. One way to to see it happen is run into one house of FPS demo, when Korc leaves the terrain and go into the interior, during the transition some strange colors could modulate with the orc, some times red, some times green, and also, if you go into the end of the house and get very close to the wall, you'll be black (modulated with black?).Things are strange, and maybe problem is not TLK.
Torque 3D Owner Rubes
I've had no fog issues before on the Mac...does anyone else see this using a UB build?