err, actually that IS the command i am using (i mistyped it the first time without any reference). Here is the command im using straight from the code (at least as far as i have gotten):
/* Clear the window to black */
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
and here is the code in entirety, just for reference:
#include <windows.h>
#include <gl/glut.h>
#include <iostream.h>
#include <string.h>
int x1=100;
int y1=100;
// Keep track of windows changing width and height
GLfloat windowWidth=600;
GLfloat windowHeight=800;
// Constant font size
void *font=GLUT_BITMAP_HELVETICA_18;
// Variable to hold background texture
GLubyte* TextureLoadBitmap(char* filename, int *w, int *h);
//----------------------------
// Available fonts |
// |
// GLUT_BITMAP_8_BY_13 |
// GLUT_BITMAP_9_BY_15 |
// GLUT_BITMAP_TIMES_ROMAN_10 |
// GLUT_BITMAP_TIMES_ROMAN_24 |
// GLUT_BITMAP_HELVETICA_10 |
// GLUT_BITMAP_HELVETICA_12 |
// GLUT_BITMAP_HELVETICA_18 |
//----------------------------
//*****************************************************************************************
// Function Prototypes
//*****************************************************************************************
void SplashScreen();
void test();
void DispTank();
void init();
void displayfancychar(GLfloat x, GLfloat y, char *text);
void initialsetup();
//*****************************************************************************************
// Function to display fancier text on the screen, with antialiasing
//*****************************************************************************************
void displayfancychar(GLfloat x, GLfloat y, char *text)
{
char *p;
glPushMatrix();
glTranslatef(x, y, 0);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glLineWidth(20.0);
for (p = text; *p; p++)
glutStrokeCharacter(GLUT_STROKE_ROMAN, *p);
glPopMatrix();
}
//*****************************************************************************************
// Function to display text on the screen
//*****************************************************************************************
void bitmapfontoutput(int x, int y, char *string, void *font)
{ int len, i;
glRasterPos2i(x, y); // Locate Raster Position in 2d-space
len = (int) strlen(string); // Find length of string
for (i = 0; i < len; i++) // Loop through plotting all characters in font style
glutBitmapCharacter(font, string[i]);
}
//*****************************************************************************************
// Displays the intro screen
//*****************************************************************************************
void SplashScreen()
{
/*int teximageWidth, teximageHeight;
GLubyte teximage;/
glClear(GL_COLOR_BUFFER_BIT);
/*
teximage = TextureLoadBitmap("a:BITMAP.bmp",&teximageWidth,
&teximageHeight);
glTexImage2D(GL_TEXTURE_2D, 0, 3, teximageWidth, teximageHeight,
0, GL_RGB, GL_UNSIGNED_BYTE, teximage);
glEnable(GL_TEXTURE);
glTexImage2D(GL_TEXTURE_2D, 0, 3, teximageWidth, teximageHeight, 0,
GL_RGB, GL_UNSIGNED_BYTE, teximage);
glDisable(GL_TEXTURE);
*/
glColor3f(0.2, 0.8, 0.2);
displayfancychar(175,600,"Ballistics");
glColor3f(1.0, 1.0, 1.0);
bitmapfontoutput(750,25,"Version 1.0",GLUT_BITMAP_TIMES_ROMAN_10);
glColor3f(0.0, 0.0, 1.0);
bitmapfontoutput(325,150,"Press Enter",GLUT_BITMAP_TIMES_ROMAN_24);
glFlush();
glutSwapBuffers(); // Flush drawing commands
}
//************************************************************************
// Called by GLUT library when the window has chanaged size
//************************************************************************
void ChangeSize(GLsizei windowWidth, GLsizei windowHeight)
{
// Prevent a divide by zero
if(windowHeight == 0)
windowHeight = 1;
// Set Viewport to window dimensions
glViewport(0, 0, windowWidth, windowHeight);
// Reset coordinate system
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Keep the square square, this time, save calculated
// width and height for later use
if (windowWidth <= windowHeight)
{
windowHeight = windowHeight*windowHeight/windowWidth;
windowWidth = 600;
}
else
{
windowWidth = windowWidth*windowWidth/windowWidth;
windowHeight = 800;
}
// Set the clipping volume
gluOrtho2D(0, windowWidth, 0, windowHeight);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
//*****************************************************************************************
// Accepts an initial x and y value for position, and draws a tank facing left
//*****************************************************************************************
void DispTank()
{
// Set current drawing color to brown
// R G B
glColor3f(0.55f, 0.4f, 0.12f);
bitmapfontoutput(10,500,"Here is the tank",font);
// Set Drawing color to green
glColor3f(0.1, 0.9, 0.1);
// Draw lower part of tank
glBegin(GL_POLYGON);
glVertex2i(x1+10, y1+7);
glVertex2i(x1+10, y1+5);
glVertex2i(x1+12, y1+1);
glVertex2i(x1+26, y1+1);
glVertex2i(x1+28, y1+5);
glVertex2i(x1+28, y1+7);
glEnd();
// Draw turret ex1cept gun
glBegin(GL_POLYGON);
glVertex2i(x1+15, y1+7);
glVertex2i(x1+15, y1+9);
glVertex2i(x1+18, y1+11);
glVertex2i(x1+23, y1+11);
glVertex2i(x1+23, y1+7);
glEnd();
//glutSwapBuffers();
}
//*****************************************************************************************
// Function used for display tests
//*****************************************************************************************
void test()
{
/* Clear the window to black */
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
/* Draw a vertical line down the center of the window */
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LINES);
glVertex2i(12, 0);
glVertex2i(20, 5);
glEnd();
glutSwapBuffers();
}
//*****************************************************************************************
// Function to check what key is pressed, and determine a result
//*****************************************************************************************
void HandleKeyboard(unsigned char keyval, int xloc, int yloc)
{
switch(keyval)
{
case 13:
// Set Viewport to window dimensions
glViewport(0, 0, windowWidth, windowHeight);
glColor3i(0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
break;
/*case 27:
close();
break;*/
default:
break;
}
glutPostRedisplay();
}
//*****************************************************************************************
// Sets up the initial display properties
//*****************************************************************************************
void initialsetup()
{
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.0,0.0,0.0,1.0);
}
//*****************************************************************************************
// Main program
//*****************************************************************************************
void main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(800, 600) ; // set window size
glutInitWindowPosition(0,0) ; // set the window position correctly on screen
glutCreateWindow("Ballistics");
//glutFullScreen();
initialsetup();
glutDisplayFunc(SplashScreen);
glutKeyboardFunc(HandleKeyboard);
//glutSpecialFunc(ProcessSpecialKey);
glutReshapeFunc(ChangeSize);
glutMainLoop();
}
[This message has been edited by darkenreaper57 (edited 02-22-2004).]