Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Getting started with OpenGL.....

Getting started with OpenGL.....
Thread Tools
Junior Member
Join Date: Dec 2000
Location: Houston, TX, USA
Status: Offline
Reply With Quote
Jan 9, 2001, 10:51 PM
 
Hello,
So, how can one learn about OpenGL programming and how Cocoa implements it?
Are there any OpenGL books i should look at or read? I've never touched any code having anything to do with OpenGL; that's the level i'm at. Any help is much appreciated. As and aside, how does Quickdraw figure into Cocoa? Are QuickDraw and OpenGL the way to implement graphics into an application? Forgive me if these questions seeme misguided, this is all very new to me. Anyway, thanks!

Mike
     
Forum Regular
Join Date: Dec 2000
Status: Offline
Reply With Quote
Jan 14, 2001, 09:22 PM
 
It's not the best intro, but if you want to look at some GL code,
/Developer/Examples/GLUTExamples
Has a whole mess of OpenGL code. Take a look.
     
Admin Emeritus
Join Date: Nov 2000
Location: New Yawk
Status: Offline
Reply With Quote
Jan 23, 2001, 07:59 PM
 
Please (*please*) correct me if I'm wrong, but I believe that Mac OS X has abandoned Quickdraw in favor of Quartz, which is superior (vector; PDF) technology.

I don't know how writing for Quickdraw differs from writing for Quartz, but I do think that Quartz is what does Quickdraw's former job now.

does this even matter other than name? not too sure about this, as you can probably tell

------------------
it's only after you lose everything that you're free to do anything
"Do not be too positive about things. You may be in error." (C. F. Lawlor, The Mixicologist)
     
Mac Enthusiast
Join Date: Feb 2000
Location: Storrs,Connecticut, USA
Status: Offline
Reply With Quote
Jan 24, 2001, 08:32 AM
 
Am I missing something? I thought that you didn't need to know any special quartz commands in order to use OpenGL in Cocoa. I've never tried to program anyhting in OpenGL but I thought that It was as simple as dragging an OpenGLView into an NSWindow in Interface Builder, maybe overriding or using some of those methods in NSOpenGLView (All of which say description forthcoming so I have no clue what they do) and then putting some OpenGL code behind that view. I kind of thought that the bulk of the code for making something OpenGl is platform independent. That you'd only have to change a few things in the front end and recompile and viola: it runs on a different platform. Am I wrong?

Anyway, if you want sample code in order to do OpenGl stuff in Cocoa, then why not take a look at some of those screensavers that are popping up everywhere? A lot of them are open source and use Open GL. They might be a better source of info than Apple's description forthcoming documentation.
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Jan 24, 2001, 09:56 AM
 
Yes, using OpenGL is that simple. You just have to drag an NSOpenGLView into the window, and link a few things to it.

You'll just need to name the drawing function specifically and then you can call [self display] i.e.:

#import "MyOpenGLView.h"

#import <OpenGL/gl.h>
#import <OpenGL/glu.h>

@implementation MyOpenGLView


- (void)drawRect NSRect)aRect
{
glEnable(GL_TEXTURE_2D);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0);
// etc.
}

- (IBAction)clickButton id)sender
{
[self display]; // This will call the drawRect function ( I hope :-)
}

@end
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Jan 24, 2001, 09:58 AM
 
Whoops, Just replace those frowns with colon left-paren...

Sorry
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Professional Poster
Join Date: Jan 2000
Status: Offline
Reply With Quote
Jan 26, 2001, 12:01 AM
 
Hit the "Disable Smilies in This Post" radio button at the bottom of the text window

See
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:24 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2