I made a new project and pretty much copied this guide, but whenever I call any OpenGL function it the spot marked // Drawing code here
it crashes. I have this there :
glViewport(0, 0, [self bounds].size.width, [self bounds].size.height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, [self bounds].size.width, [self bounds].size.height, 0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.375, 0.375, 0.0);
glClearColor(1, 1, 1, 1);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0, 0, 0);
glBegin(GL_LINES);
glVertex2f(10, 10);
glVertex2f(300, 300);
glEnd();
glFlush();
But just calling one OpenGL function crashes it, reporting GDB: Program received signal: "EXC_BAD_ACCESS".
First of all, if it did work, is that code good? Doing all that stuff at the top every time it gets called? Its supposed to be for 2d, with origin at top-left. And why is it crashing? I have CoreVideo and OpenGL linked and imported... I want to get a Cocoa application set up to use OpenGL so I can focus on the game code.
Thanks.