Hello. I am willing to learn programming Using C++ and OpenGL. I have knowledge of C++, but I know nothing about OpenGL.
I bought a book to start learning OpenGL, but is seems that I can't work with it...
Firstly, the book is called "OpenGL Superbible, Third Edition", by Richard S. Wrightm and Benjamin Lipchak.
I want to know what type of project must I create in xCode and what headers must I include in order to make my OpenGL programs to work. I tried this program (which is an example of the book)
but it doesn't work. It can't even find the OpenGL.h file! What can I do? Can you give me specific instructions on how to make my programs work? I thought that OpenGL language was cross-platform. Why aren't the same commands used in this case?
The book comes with a cd in it, which includes the code of some of the programs, written in both xCode and Visual Studio for Microsoft. But it seems that these examples are old news, since they are tested with OS X 10.3.3 and xCode 1.1, therefore some of them can be compiled and some can't. What can I do? Must I obtain another book?
EDIT: Found the sample program included in the CD:
Doesn't compile. It get's me warnings about implicit function declarations everywhere and it says that GLUT_SINGLE, GLUT_RGB, GL_COLOR_BUFFER_BIT are undeclared. I use OS X Tiger 10.4.3 and xCode 2.1.
I bought a book to start learning OpenGL, but is seems that I can't work with it...
Firstly, the book is called "OpenGL Superbible, Third Edition", by Richard S. Wrightm and Benjamin Lipchak.
I want to know what type of project must I create in xCode and what headers must I include in order to make my OpenGL programs to work. I tried this program (which is an example of the book)
Code:
#include <OpenGL.h>
void renderscene(){
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
void SetupRC(){
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}
int main(){
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("Simple");
glutDisplayFunc(RenderScene);
SetupRC();
glutMainLoop();
}
The book comes with a cd in it, which includes the code of some of the programs, written in both xCode and Visual Studio for Microsoft. But it seems that these examples are old news, since they are tested with OS X 10.3.3 and xCode 1.1, therefore some of them can be compiled and some can't. What can I do? Must I obtain another book?
EDIT: Found the sample program included in the CD:
Code:
#include <OpenGL/OpenGL.h> // System and OpenGL Stuff
#include <Carbon/Carbon.h>
///////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
{
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Flush drawing commands
glFlush();
}
///////////////////////////////////////////////////////////
// Setup the rendering state
void SetupRC(void)
{
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}
///////////////////////////////////////////////////////////
// Main program entry point
void main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(800,600);
glutCreateWindow("Simple");
glutDisplayFunc(RenderScene);
SetupRC();
glutMainLoop();
}