OpenGL square not showing up..
Hi, so im new to graphics programming and decided to try openGL (I'm planning on making a 2D game in it at first, possibly pacman). And I'm having trouble getting it to draw shapes on the screen.
Code:
#include "glut.h"
#define WIDTH 350
#define HEIGHT 500
void display();
void display()
{
glClearColor(1.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0, 0.0, -5.0);
glBegin(GL_QUADS);
glVertex3f(-1.0f, -1.0f, 0.0f);
glVertex3f(-1.0f, 1.0f, 0.0f);
glVertex3f(1.0f, 1.0f, 0.0f);
glVertex3f(1.0f, -1.0f, 0.0f);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(WIDTH, HEIGHT);
glutInitWindowPosition(100, 100);
glutCreateWindow("PacMan");
glutDisplayFunc(display);
glutMainLoop();
}
also once i get to the point of coding a pacman game.. would the best method be to use and array to represent a tile like system to draw the game boards, and to be used with the ghost AI