Saturday, November 27, 2010

SDL XCode OpenGL Project Template (Whales and Fish swimming)

Steps to get it to work in Windows XP Visual Studio 2010

Dynamically Linked
  • Install Nate Robin's GLUT for Win32.
  • Install SDL libs.
  • Setup the lib and include folders
          Project properties -> Configuration properties (CP) -> VC++ Directories -> Include Directories, Library Directories
  • CP -> Linker -> Input -> Additional Dependencies
          glut32.lib
          SDLmain.lib
          SDL.lib
  • Function mtime giving us shit. Spent time finding a replacement with CTime.h and the SDL Timer, that was stupid. Since mtime is not used, just scratch it and return 0.
  • Comment out glutSwapBuffers() in Atlantis_Display(void). The display works without it, might be an issue with glEnd() not being called afterwards. Didn't look into it deeper, don't need to, it works.
  • Copy SDL.dll and glut32.dll to the same folder as the executable.

Statically Linked (Single Executable)
  • Download GLUT and SDL source, compile them into static libs.
          CP -> General -> Configuration Type -> Static Library (.lib)
  • Disable the post build events for GLUT
          CP -> Build Events -> Post-Build Event -> Use In Build -> No
  • Fuck with the Runtime Library settings
          CP -> Code Generation -> Runtime Library -> /MD (for all 3 projects)
          CP -> General -> Use of MFC (Don't think this matters too much, but here's the config currently)
          This Project = Use Standard Windows Libraries
          GLUT = Use Standard Windows Libraries
          SDL = Use MFC in a Shared DLL
  • Turn on verbose
          CP -> Linker -> General -> Show Progress -> /Verbose
  • Realize from the output that searching in glut32.lib is not finding glutBitmapCharacter()
  • Added a all of the directX libs because thought SDL needed it, verbose also let us know we only need dxguid.lib
  • Try a whole bunch of shit, read a whole bunch of pages to resolve the glutBitmapCharacter() issue.
  • Cannot have __declspec(dllimport) on static lib functions, so just delete GLUTAPI at the front, making it
          void APIENTRY glutBitmapCharacter(void *font, int character);
  • You don't even need the extern keywords because it's all statically linked.
  • Change for both the header file in source and the include one, recompile GLUT, overwrite old lib, recompile project.

Conclusion

      Don't use GLUT, stick to SDL bitch.

Dynamic
Static
Static libs
SDL
GLUT