View Full Version : Opengl example
beard
2002.05.22, 04:07 AM
Im trying to begin developing an Opengl game but I cant find some examples which show how you make it full screen. I was told Nehe had some but Nehe is for Visual C++. I found two on the Apple website but one is for Cocoa and one is 1500 lines long and doesnt explain anything. Is there any other good examples? I only kjnow Pascal and C so I want to do Opengl with Carbon.
I am currently making a game that is fullscreen OGL. I use BeginFullScreen and then attach a regular AGL context to it. It works for me, though on a few other computers it is failing to draw. That may be because of other things, though. I am not sure if BeginFullScreen is Carbonized, but I would imagine so. If you want to see the code that I use, just email me.
Jeff Binder
2002.05.22, 09:41 AM
If you're working for OS X only, you can use CGDirectDisplay to get into full screen and CGL to set up GL. There's also SDL, which is for OS 9 and X, and can do both.
CGDirectDisplay:
http://developer.apple.com/technotes/tn/tn2007.html
SDL:
http://www.libsdl.org/
I'm not sure if there is any documentation for CGL apart from that example, but you might want to look at the CocoaGLFullscreen example on this page. Sure, it's Cocoa, but it uses CGL which is a plain C API. You can probably figure something out from it.
beard
2002.05.22, 01:39 PM
jabber I would like to see your code but cant email you. could you send it to my email is beardy@talk21.com
codemattic
2002.05.22, 08:23 PM
If you are using Carbon - check out Carbon Setup GL (http://developer.apple.com/samplecode/Sample_Code/Graphics_3D/Carbon_SetupGL.htm) which will work os9 and osx. you can also look at the code in fullscreen cgl (http://developer.apple.com/samplecode/Sample_Code/Graphics_3D/fullscreen_CGL.htm) and Open GL Full Screen (http://developer.apple.com/samplecode/Sample_Code/Graphics_3D/OpenGL_Full_Screen.htm)
if you are using Cocoa and Obj-C check out Cocoa GL Fullscreen (http://www.idevgames.com/fileshow.php3?showid=221) in idevgames.com source code section
and lastly - you can use SDL (http://www.libsdl.org) which not only will handle setting up a full-screen contex. but also let your game run on windows, linux, whatever...
CMagicPoker
2002.05.22, 11:12 PM
Nehe?
Yeah, Nehe made his example in VCS, but if you scroll at the end f each tutorial, you;ll see tghat some people made some conversion, theres some for macos, kinux, IRIX I think, and even BeOS! Im sure I saw some carbon or cocoa tutorials at nehe.
It's GLUT, tought.
For the AGL specific things, whats already posted in this thread are good, you can also check the AGL GLUT source code, if you're adventurous.
THere's nehe.gamedev.net, good site!
Originally posted by beard
jabber I would like to see your code but cant email you. could you send it to my email is beardy@talk21.com I will send it asap, but right now I am not at my home comp.
Iceman
2002.05.24, 05:17 PM
I've saved half of the OS 9 NeHe tutorials e-mail me if any of you guys want any of them.
Iceman
CMagicPoker
2002.05.24, 07:32 PM
Oops, Im sorry, Ive got a bit confused.
Ive jsut visited Nehe's website, and now they just gives the VC++ examples.
They used to provides them in a lot of different formats.
What happened?
furballphat
2002.05.24, 08:17 PM
http://www.cocoadevcentral.com/ has a good tutorial on cocoa full screen. It's in the regular topics sction.
Originally posted by CMagicPoker
Oops, Im sorry, Ive got a bit confused.
Ive jsut visited Nehe's website, and now they just gives the VC++ examples.
They used to provides them in a lot of different formats.
What happened? I think he (Nehe) decided that some of the ports were of such bad quality that they were useless. He is looking for someone to do good ports... anyone? Probably he still has the old ports and will give them to you if you email him. Personally, I think bad ports are better than no ports at all... :(
Deland
2002.05.25, 02:49 AM
Hey guys, I have the NeHe CD and it has almost all tutorials for Mac. Actualy, 31 tutorials for Mac OS 8/9 and 12 for Mac OS X. I'm not sure I'm willing to send them to all of you by email, so maybe we could ask Jeff (NeHe) if we could host the files on idevgames...
Carlos?
( On another note, maybe you guys should buy the CD to help him, it's really worth it. )
beard
2002.05.25, 10:18 AM
Iceman could you email those Nehe examples you saved? my email is beardy@talk21.com thanks!
I would buy the Nehe cd, but if the examples are not on the site will they be on te cd, and I really dont have any money. should be able a job after my exams. I hope.
Iceman
2002.05.25, 02:13 PM
Sure. I'd prefer to put it on my iDisk (I have slow internet), but I can e-mail them to you instead if you'd like.
Update: I could only find one OS 9 Lesson (Lesson 31) the others I must have thrown away since I'm programming in OS X now. I have most of the OS X Cocoa ones; although, I'd like to get my hands on the Cel-Shading(formerly lesson 38) which is Lesson 37.
Hope this helps,
Iceman
CMagicPoker
2002.05.25, 04:23 PM
jabber >> I dont know for the other ports, but the MacOS Classic ones were very correct imho.
Iceman >> I had it, but done some cleaning in my disk, and I disposed of evethyng I thought were not useful for me in the immediate future. And I thought it was possible to download again when needed, as it was the first time.
I dont want to be the devil's advocate, but is the fact that Nehe offers VC++.NET at 89$ has something to do with the fact that the GLUT ports are gone now? (like, kind of a deal with the devil?)
I have *some* of the ports. If you want a specific one, email me. Unfortunately, I don't have any higher than lesson 36. The ports that are fullscreen, use DrawSprocket which for some reason I could never get to run. Of course, I have NEVER figured Drawsprocket out... kinda Apple's half-hearted try to please game developers...
CMagicPoker: Yeah, I know. I always thought that the ports were good too.
Iceman: Sorry, I too want the cel-shading tutorial but don't have it. :(
Does anyone know if the new Nehe CD has the Mac ports? I would doubt it, but maybe he really wants people to buy the CD :D
sealfin
2002.05.26, 04:07 AM
that cell-shading tutorial I've still got on a cd somewhere. if anybody wants to be emailed a copy (no binaries though) just email and I'll find it.
[edit] I may (stress the 'may') also have the rest of NeHe's tutorials; I've either got them all or none of them at all though. I'll go look for them as well if anybody's interested.
Griggs
2002.05.26, 02:12 PM
We would be very happy to host the Mac ports of NeHe's tutorials. But only if we wouldn't be stepping on any toes by doing so. If someone wants to contact Jeff Molofee (I think thats his name) at NeHe and ask him about this. E-Mail me webmaster@idevgames.com with any info you can get.
Nickolei
2002.05.26, 09:16 PM
Well I had a bunch of examples from Nehe I was going to share...but..
Nehe.gamedev.net claims to have all the ports back online ... the Mac ones for the few that I tried didn't seem to be there, but some of the others (including glut which seems to be fine for examples) did work.
Try it! They're bundles of fun.
-P
Iceman
2002.06.04, 04:45 PM
They don't have the cel-shading lesson in either GLUT or Mac could someone e-mail it to me I tried e-mailing one of you but you never responded. I think I'd probably perfer GLUT though.
Iceman
sealfin
2002.06.05, 05:23 AM
Iceman, I did recieve your email, just when I tried to reply I got fatal 'time out' errors (for three days :rolleyes: ); I'll try again...
Iceman
2002.06.05, 03:25 PM
Hmm weird my e-mail is jonwhitejamos@yahoo.com if that doesn't work try jonwhite@mac.com.
sorry,
Iceman
Feanor
2002.06.07, 11:35 AM
When you guys talk about cel-shading do you mean like cartoons with flat colours and black lines around them? There's a Cocoa demo here:
http://homepage.mac.com/joshuadavis/
along with other stuff. (That's not me, but Josh has some cool stuff, including SMea Kit, his cool and ever-evolving Cocoa 3D object library).
Brent
Iceman
2002.06.07, 08:23 PM
Looks very cool I like it. :D
Iceman
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.