Hi Guys.
I'm new to OpenGL. The only experience I have in it was tweaking code in already written OpenGL code. Now I am learning it on my own.
I bought the OpenGL SuperBible and its nice but I want to learn to set it up and use it without requiring the GLTools framework the book requires. I turned to the Nehe tutorials, and started this one: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=Mac_OS_X
Anyway XCode appears to be set up correctly, here is the code in its entirety. (GLUT and OpenGL frameworks have been added to the project)
Is this code supposed to work in this form? (The functions have prototypes but no definition which makes me wonder)
Anyway the errors I get are:
I'm not sure why the program can't find GLvoid. Its a valid data type, I checked for it. I just don't know enough about OpenGL to be able to tell if this is supposed to happen or if a window is to open. Anyone have any ideas?
Basically I am just looking for bare minimum code needed to open a window that I can build the stuff I've been learning off of.
I'm new to OpenGL. The only experience I have in it was tweaking code in already written OpenGL code. Now I am learning it on my own.
I bought the OpenGL SuperBible and its nice but I want to learn to set it up and use it without requiring the GLTools framework the book requires. I turned to the Nehe tutorials, and started this one: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=Mac_OS_X
Anyway XCode appears to be set up correctly, here is the code in its entirety. (GLUT and OpenGL frameworks have been added to the project)
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;
}
Is this code supposed to work in this form? (The functions have prototypes but no definition which makes me wonder)
Anyway the errors I get are:
/Users/Scott/Documents/OpenGL Test 2/main.cpp:16: error: '<anonymous>' has incomplete type
/Users/Scott/Documents/OpenGL Test 2/main.cpp:16: error: invalid use of 'GLvoid'
/Users/Scott/Documents/OpenGL Test 2/main.cpp:17: error: '<anonymous>' has incomplete type
/Users/Scott/Documents/OpenGL Test 2/main.cpp:17: error: invalid use of 'GLvoid'
/Users/Scott/Documents/OpenGL Test 2/main.cpp: In function 'int main(int, char**)':
/Users/Scott/Documents/OpenGL Test 2/main.cpp:16: error: too few arguments to function 'GLvoid InitGL(<type error>)'
/Users/Scott/Documents/OpenGL Test 2/main.cpp:28: error: at this point in file
/Users/Scott/Documents/OpenGL Test 2/main.cpp:30: error: invalid conversion from 'GLvoid (*)(<type error>)' to 'void (*)()'
/Users/Scott/Documents/OpenGL Test 2/main.cpp:30: error: initializing argument 1 of 'void glutDisplayFunc(void (*)())'
I'm not sure why the program can't find GLvoid. Its a valid data type, I checked for it. I just don't know enough about OpenGL to be able to tell if this is supposed to happen or if a window is to open. Anyone have any ideas?
Basically I am just looking for bare minimum code needed to open a window that I can build the stuff I've been learning off of.