Sign in to follow this  
Alex Swinney

OpenGL Making an OpenGL game, need it to work on Mac/PC..

Recommended Posts

I'm sorry if this has been posted before, which it probably has, but the search on this site is easily the worst I have ever seen. It refuses to work, and I refuse to work with it. Anywho, I am making a physics edutainment game for high school physics AP classes under the 'guidance' of my University. I NEED it to be cross-platform, hence OpenGL, but I can't seem to find anything telling me how to get it to work on Macs and PCs at the same time, so is this possible? I have used GLUT, but this was for PC only, and I am not sure GLUT works on Mac.. So, if someone could shed some light into my dim mind I would be much appreciative! I would obviously like to make as little changes as necessary to get the program to work on Mac from PC. Thanks! [Edited by - Alex Swinney on November 16, 2004 9:26:16 AM]

Share this post


Link to post
Share on other sites
http://www.libsdl.org/index.php

That's a cross platform library that works on both Windows and Mac (among others). You will still need to compile different executables for each platform though.

Share this post


Link to post
Share on other sites


"Unofficial ports, ports in progress:
o Solaris, IRIX, FreeBSD
o MacOS "

Is there anything 'official'? Or is the documentation out of date?

See, I have no Mac to speak of, and with that said, have no Mac compiler, so if I start developing on this platform, and later find out that it won't work...I'm SOL. I don't want to be SOL.;)

Thanks!

Share this post


Link to post
Share on other sites
Quote:
Original post by Roboguy
GLUT works on Mac, Windows, and most of the UNIX flavors(including MacOSX) and possibly a few other OSes


What do I need to do to get it to work on MacOSX? Also, is there anything that allows me to get it to work with older versions of Mac OS? I mean, do I just need to get drivers and install them on the machine?

Share this post


Link to post
Share on other sites
Quote:
Original post by Alex Swinney
Quote:
Original post by Roboguy
GLUT works on Mac, Windows, and most of the UNIX flavors(including MacOSX) and possibly a few other OSes


What do I need to do to get it to work on MacOSX? Also, is there anything that allows me to get it to work with older versions of Mac OS? I mean, do I just need to get drivers and install them on the machine?


1) Nothing, your code doesn't need to be ported if it just uses OpenGL and GLUT(if it uses other, windows-only libraries, it will need to be ported)
2) Not sure, but I think most people use OSX(myself included)
3) Do you mean on the developers machine, or the users? On the developers machine, it needs to be installed and on the user's machine, it depends on wether it's statically or dynamically linked

good luck on your game

Share this post


Link to post
Share on other sites
FYI, the developers' tools in OSX (including Xcode) are free. Also, GLUT is available in OS9 and OSX, although there may be some issues here and there.

Unless someone insists on it, I wouldn't worry about OS9 and just focus on OSX. Although a lot of people still use OS9 (myself included sometimes), Apple really isn't supporting it any more. So developing in OS9 is kind of a pain.

Also look into SDL, which is cross-platform (maybe that's already been mentioned).

If you use the right libraries, you should be able to make all your code cross-platform without changes. However, you'll still of course have to get set up in a development environment on each platform in question and compile the appropriate binary.

Share this post


Link to post
Share on other sites
Don't listen to anyone here. I have expirience with both GLUT and SDL. GLUT is alright for making test apps' (though I still think SDL is better). But if you are making a game, don't waste time with GLUT, SDL all the way. If it helps your decision, UT2003, UT2004 and many other profeshional games use SDL.

Share this post


Link to post
Share on other sites
They do? I thought the UT's just used OGL, and used OS-specific initialization code and ported it to each other OS they wanted it to run on... SDL is probably a bit too slow for them...

Share this post


Link to post
Share on other sites
Quote:
Original post by Roboguy
They do? I thought the UT's just used OGL, and used OS-specific initialization code and ported it to each other OS they wanted it to run on... SDL is probably a bit too slow for them...


Bioware used it too in their NWN port.

Share this post


Link to post
Share on other sites
GLUT is a bit too noddy for games' usage. By all means use it to test some stuff out though.

As far as I'm aware, Chronic Logic ship Macos X versions of their games which use SDL (I've played them in Linux and Win32, those ones use SDL too)

I am not aware that there is any significant run-time performance cost of using SDL over writing the OS-specific code yourself - after all, the meaty stuff is all done by the hardware and/or OpenGL driver.

SDL does not wrap OpenGL calls, only wrappers the setup/shutdown code and event handling. If those are time-critical parts of your code, you are doing something very strange.

Mark

Share this post


Link to post
Share on other sites
... where did you hear that UT and such used sdl?... im not saying they dont... but i find it incredibly hard to believe because a) ive never heard of a commercial game using sdl b) ut, ut2003 and ut2004 both have openGL as well as direct 3d renderers and c) though i dont know that they dont... wouldnt sdl flaunt the fact that they were used in a commercial game?

oh and there IS a solution to your problem... java and JOGL.. you wont need to recompile between platforms, java has c++ like syntax so it shouldnt be too bad, although i dont have a link, java creator is the IDE i use (i hardly EVER do java, my friend wanted me to learn a bit so i did) youll need to get the sdk from sun's website iirc, and then jogl shouldnt be too hard to get with a couple of googles...

hope that helps
-Dan

Share this post


Link to post
Share on other sites
check the sdl website,
UT, tribes2 etc used sdl (under linux, perhaps the macOS ports if there were any used it as well)

>>SDL is probably a bit too slow for them<<

to slow?? sdl is about as close to the OS as u can get reasonably.

Share this post


Link to post
Share on other sites
Thanks for all the replies people!

The reason I asked about the >=MacOS9 is because this is being developed for local high schools, and in Indiana, they usually don't put much money into computers. I have no clue whether these computers have OSX or OS9(or less).

I did think about Java, though I guess it wouldn't be too hard, as I have some good skill in Java. I was worried about performance, but the prog can be 'dumbed' down enough to run decently anywhere I guess. I always worry about Java performance when you have the VM running in the background taking up a large chunk of memory. I think this might be the best API, though, at least because I'm sure that the others could work with it as well.

Share this post


Link to post
Share on other sites
>> I always worry about Java performance<<

java in many cases is just as fast as C/C++.
also u see a few ppl that seem to be happy using c# here, and java (setup correctly) is faster than c#. just choose whatever languge youre most comfortable with as handrix would say 'its all in the hands'

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Forum Statistics

    • Total Topics
      627738
    • Total Posts
      2978881
  • Similar Content

    • By DelicateTreeFrog
      Hello! As an exercise for delving into modern OpenGL, I'm creating a simple .obj renderer. I want to support things like varying degrees of specularity, geometry opacity, things like that, on a per-material basis. Different materials can also have different textures. Basic .obj necessities. I've done this in old school OpenGL, but modern OpenGL has its own thing going on, and I'd like to conform as closely to the standards as possible so as to keep the program running correctly, and I'm hoping to avoid picking up bad habits this early on.
      Reading around on the OpenGL Wiki, one tip in particular really stands out to me on this page:
      For something like a renderer for .obj files, this sort of thing seems almost ideal, but according to the wiki, it's a bad idea. Interesting to note!
      So, here's what the plan is so far as far as loading goes:
      Set up a type for materials so that materials can be created and destroyed. They will contain things like diffuse color, diffuse texture, geometry opacity, and so on, for each material in the .mtl file. Since .obj files are conveniently split up by material, I can load different groups of vertices/normals/UVs and triangles into different blocks of data for different models. When it comes to the rendering, I get a bit lost. I can either:
      Between drawing triangle groups, call glUseProgram to use a different shader for that particular geometry (so a unique shader just for the material that is shared by this triangle group). or
      Between drawing triangle groups, call glUniform a few times to adjust different parameters within the "master shader", such as specularity, diffuse color, and geometry opacity. In both cases, I still have to call glBindTexture between drawing triangle groups in order to bind the diffuse texture used by the material, so there doesn't seem to be a way around having the CPU do *something* during the rendering process instead of letting the GPU do everything all at once.
      The second option here seems less cluttered, however. There are less shaders to keep up with while one "master shader" handles it all. I don't have to duplicate any code or compile multiple shaders. Arguably, I could always have the shader program for each material be embedded in the material itself, and be auto-generated upon loading the material from the .mtl file. But this still leads to constantly calling glUseProgram, much more than is probably necessary in order to properly render the .obj. There seem to be a number of differing opinions on if it's okay to use hundreds of shaders or if it's best to just use tens of shaders.
      So, ultimately, what is the "right" way to do this? Does using a "master shader" (or a few variants of one) bog down the system compared to using hundreds of shader programs each dedicated to their own corresponding materials? Keeping in mind that the "master shaders" would have to track these additional uniforms and potentially have numerous branches of ifs, it may be possible that the ifs will lead to additional and unnecessary processing. But would that more expensive than constantly calling glUseProgram to switch shaders, or storing the shaders to begin with?
      With all these angles to consider, it's difficult to come to a conclusion. Both possible methods work, and both seem rather convenient for their own reasons, but which is the most performant? Please help this beginner/dummy understand. Thank you!
    • By JJCDeveloper
      I want to make professional java 3d game with server program and database,packet handling for multiplayer and client-server communicating,maps rendering,models,and stuffs Which aspect of java can I learn and where can I learn java Lwjgl OpenGL rendering Like minecraft and world of tanks
    • By AyeRonTarpas
      A friend of mine and I are making a 2D game engine as a learning experience and to hopefully build upon the experience in the long run.

      -What I'm using:
          C++;. Since im learning this language while in college and its one of the popular language to make games with why not.     Visual Studios; Im using a windows so yea.     SDL or GLFW; was thinking about SDL since i do some research on it where it is catching my interest but i hear SDL is a huge package compared to GLFW, so i may do GLFW to start with as learning since i may get overwhelmed with SDL.  
      -Questions
      Knowing what we want in the engine what should our main focus be in terms of learning. File managements, with headers, functions ect. How can i properly manage files with out confusing myself and my friend when sharing code. Alternative to Visual studios: My friend has a mac and cant properly use Vis studios, is there another alternative to it?  
    • By ferreiradaselva
      Both functions are available since 3.0, and I'm currently using `glMapBuffer()`, which works fine.
      But, I was wondering if anyone has experienced advantage in using `glMapBufferRange()`, which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
      Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
    • By xhcao
      Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness. 
  • Popular Now