Thanks for your assistance. However, I get, “undefined reference to glvertex3fv.” Perhaps I’m misusing it.
#include <GL/gl.h>
#include <GL/glut.h>
void display(void)
{
// Vertex Data.
GLfloat vertex0[] = {-51, 412, 2}; // To bypass the "Invalid Initializer" error in GLfloat, these were required instead of parenthesis.
GLfloat vertex1[] = {-55, 8, -453};
GLfloat vertex2[] = {-59, -358, -161};
// Clear all pixels.
glClear(GL_COLOR_BUFFER_BIT);
// Draw white polygon.
//glOrtho(-16000,8000,-8000,4000,-8000,8000);
glOrtho(-8000,4000,-4000,1500,-4000,4000);
glColor3f (1.0, 1.0, 1.0);
// Load Vertex Data.
glBegin(GL_POLYGON);
glvertex3fv (vertex0);
glvertex3fv (vertex1);
glvertex3fv (vertex2);
glEnd();
glFlush ();
}
void init (void)
{
// Select clearing (background) color.
glClearColor (0.0, 0.0, 0.0, 0.0);
// Initialize Viewing Values
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
// Lighting Stuff.
GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 };
// light_position is NOT default value
GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
glLightfv (GL_LIGHT0, GL_AMBIENT, light_ambient);
glLightfv (GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv (GL_LIGHT0, GL_SPECULAR, light_specular);
glLightfv (GL_LIGHT0, GL_POSITION, light_position);
glEnable (GL_LIGHTING);
glEnable (GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (100, 100);
glutCreateWindow ("Waist");
init ();
glutDisplayFunc(display);
glutMainLoop();
return(0);
}
I’m using Version 10.04 Xubuntu, the Code::Blocks IDE, and MinGW’s compiler. (Other, more simple OpenGL utilities work.)
Problem solved! I was using glvertex3fv instead of glVertex3fv!