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 > opengl in c

opengl in c
Thread Tools
Altair
Forum Regular
Join Date: Sep 2002
Location: The land of evil: Redmond
Status: Offline
Reply With Quote
Apr 27, 2004, 05:45 PM
 
I am trying to figure out how to program opengl using C. I want this to be easy to port over to other Operating systems so Objective C will not work. Does anybody have any experience in setting up opengl/glut in OSX for use in C? I can't seem to get anything to work.
12" PB 867 *Retired :( *
2.2 Ghz 15" Macbook Pro
     
arekkusu
Mac Enthusiast
Join Date: Jul 2002
Status: Offline
Reply With Quote
Apr 27, 2004, 06:43 PM
 
     
Arkham_c
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Apr 27, 2004, 10:25 PM
 
Originally posted by Altair:
I am trying to figure out how to program opengl using C. I want this to be easy to port over to other Operating systems so Objective C will not work. Does anybody have any experience in setting up opengl/glut in OSX for use in C? I can't seem to get anything to work.
OpenGL is all natively C code. Most of the examples out there should be C. You could always download the Quake 2 Source code too, since it's all C/OpenGL.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
arekkusu
Mac Enthusiast
Join Date: Jul 2002
Status: Offline
Reply With Quote
Apr 28, 2004, 01:44 AM
 
To be precise, rendering OpenGL content is done in C. But you first have to create some sort of window to render INTO, and that might be in C/C++ (Carbon, GLUT) or Obj-C (Cocoa). The GL core does not know anything about the windowing system, so you have to pick an interface (NSGL/AGL/CGL). GLUT uses Cocoa underneath, btw.
     
Altair  (op)
Forum Regular
Join Date: Sep 2002
Location: The land of evil: Redmond
Status: Offline
Reply With Quote
Apr 28, 2004, 02:03 AM
 
Originally posted by arekkusu:
http://203.79.121.211/~keith/XcodeGLUT/
Thank you, this is exactly what i needed!
12" PB 867 *Retired :( *
2.2 Ghz 15" Macbook Pro
     
Altair  (op)
Forum Regular
Join Date: Sep 2002
Location: The land of evil: Redmond
Status: Offline
Reply With Quote
Apr 28, 2004, 02:10 AM
 
I tried doing the above tutorial but i get the same error that i was having earlier:

gltutorial:0: Undefined symbols: _glClear _glViewport _glutCreateWindow _glutDisplayFunc _glutIdleFunc _glutInit _glutInitDisplayMode _glutInitWindowSize _glutMainLoop _glutPostRedisplay _glutReshapeFunc _glutSwapBuffers


Anybody have a clue on what is causing this?
12" PB 867 *Retired :( *
2.2 Ghz 15" Macbook Pro
     
arekkusu
Mac Enthusiast
Join Date: Jul 2002
Status: Offline
Reply With Quote
Apr 28, 2004, 06:22 AM
 
Those are linker errors complaining that GL functions can't be found. You have to link against the GL framework. In Xcode, add the framework to your project. Or in a makefile, "-framework OpenGL".

Keith shows this in his seventh screenshot in the tutorial.
     
Altair  (op)
Forum Regular
Join Date: Sep 2002
Location: The land of evil: Redmond
Status: Offline
Reply With Quote
Apr 30, 2004, 03:26 AM
 
Originally posted by arekkusu:
Those are linker errors complaining that GL functions can't be found. You have to link against the GL framework. In Xcode, add the framework to your project. Or in a makefile, "-framework OpenGL".

Keith shows this in his seventh screenshot in the tutorial.
Thank you. The gcc command is what i needed. For some reason xCode didn't register the frameworks or something. Also I found out that you have to include the Cocoa framework as well.
12" PB 867 *Retired :( *
2.2 Ghz 15" Macbook Pro
     
int69h
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 1, 2004, 04:05 PM
 
     
   
 
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
Top
Privacy Policy
All times are GMT -4. The time now is 06:22 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,