OpenGL q's

Member
Posts: 567
Joined: 2004.07
Post: #1
I have a dilemma. I used the NeHe OpenGL tutorials, and I can't even create a window. in main.c, i used ZeroLink, and it built fine, but quit on start. i disabled ZeroLink, and it returned a warning an an error:
opengl mainframe:0: Undefined symbols: _DrawGLScene _InitGL _ReSizeGLScene
opengl mainframe:0: warning prebinding disabled because of undefined symbols

BTW, here is the code:
Code:
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#define kWindowWidth    400
#define kWindowHeight   300
GLvoid InitGL(GLvoid);
GLvoid DrawGLScene(GLvoid);
GLvoid ReSizeGLScene(int Width, int Height);
int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize (kWindowWidth, kWindowHeight);
    glutInitWindowPosition (100, 100);
    glutCreateWindow (argv[0]);
    
    InitGL();
    
    glutDisplayFunc(DrawGLScene);
    glutReshapeFunc(ReSizeGLScene);
    
    glutMainLoop();
    
    return 0;
}

It's not magic, it's Ruby.
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #2
I'm not quite sure where you are with those tutorials, but if you're at the stage where you're just trying to get a window to appear, you're nearly there apart from the fact you haven't defined the functions. You've got prototypes, but you still need to add the following before your main() line:

Code:
GLvoid InitGL(GLvoid)
{
}

GLvoid DrawGLScene(GLvoid)
{
}

GLvoid ReSizeGLScene(int Width, int Height)
{
}
This code won't do anything much because there's no code in the functions, but it will eliminate your link errors.

EDIT: In case it isn't obvious, don't remove the prototypes when you insert the functions. You (usually) want both.

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Member
Posts: 156
Joined: 2002.11
Post: #3
Get the source code from http://webpages.charter.net/utopiaplanet...Struct.dmg

You may not understand all of it in the beginning, but it will show you how to create a window, play sounds, read mouse and keyboard, read and save preferences, load textures (PNG, TGA, JPG), all with Carbon, CoreAudio, and OpenGL.
Quote this message in a reply
Member
Posts: 567
Joined: 2004.07
Post: #4
Cool. Thanx guys!

It's not magic, it's Ruby.
Quote this message in a reply
Member
Posts: 567
Joined: 2004.07
Post: #5
new problem:
on lesson 2, it says, when I return TRUE, that TRUE is undeclared. Why?

It's not magic, it's Ruby.
Quote this message in a reply
Moderator
Posts: 3,573
Joined: 2003.06
Post: #6
Probably because it's not. Try "true" instead of "TRUE". You could also define it yourself by:
Code:
#define TRUE 1
#define FALSE 0
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #7
Personally, I never trust TRUE and FALSE to be defined. I always just use 1 and 0. Same difference.

Alex Diener
Quote this message in a reply
Member
Posts: 567
Joined: 2004.07
Post: #8
ahh, I see. It's been A while since I used C, normally sticking with OBJ-C.
one more problem, (yes, i know). it runs fine, makes a triangle and a square, but thee window is automatically minimized. Any idea why?

It's not magic, it's Ruby.
Quote this message in a reply
Post Reply