I am trying to simply write anything on the screen. Drawing rectangles is easy enough. I am trying to place a text string sideways superimposed on a "book". It seems very simple and yet...
Just as a note, I tried to take advice from these forums so glDisable(GL_DEPTH_TEST); and glDisable(GL_LIGHTING); are probably not necessary. Additionally, is there a way to enable debugging myself? I am usually a fan of adding cout << "i reached this far yay" << endl; but it doesn't seem to like me when I place it in void Bookshelf()... it gives me a C2381 error ('function' : redefinition; __declspec(noreturn) differs)
main.cpp
#include "bookshelf.h" void Initialize() { glClearColor (1.0, 1.0, 1.0, 0.0 ); glMatrixMode( GL_PROJECTION ); glOrtho(0,899,899,0,1,0); } void main( int argc, char *argv[] ) { glutInit( &argc, argv ); glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB ); glutInitWindowSize( 900, 900 ); glutInitWindowPosition( 510, 100 ); glutCreateWindow("Bookshelf - Ankit Ahuja"); Initialize(); glutDisplayFunc(Bookshelf); glutMainLoop(); } bookshelf.h
#include <GL/glut.h> void Bookshelf() { glClear( GL_COLOR_BUFFER_BIT ); glColor3f( 0.0, 0.0, 0.0 ); glBegin( GL_QUADS ); //Code that draws a bookshelf //Book1 glColor3f( 1.0, 0.25, 0.25 ); glVertex3i(240,70,0.5); glVertex3i(260,70,0.5); glVertex3i(260,180,0.5); glVertex3i(240,180,0.5); //BookTitle1 glPushMatrix(); glLoadIdentity(); glDisable(GL_DEPTH_TEST); glRotatef(90f,0.0f,0.0f,0.0f); glColor3f( 0.0, 1.0, 0.0 ); glDisable(GL_LIGHTING); glRasterPos3i(100,100,1); char text[50]="Alphabet Soup is the best guys"; for(int i=0; i<50; i++) { glutBitmapCharacter(GLUT_BITMAP_9_BY_15,(int)text[i]); } glPopMatrix(); //Book2 glColor3f( 0.8, 0.8, 0.0 ); glVertex2i(270,70); glVertex2i(290,70); glVertex2i(290,180); glVertex2i(270,180); //More books and shelves glEnd(); glFlush(); }