Archived

This topic is now archived and is closed to further replies.

sekuru

rendering bitmap fonts with GLUT (Visual C++)

Recommended Posts

I am doing a project which models the solar system. I am still in the process of learning OpenGL. My problem is this: I have the following code in my program: //Draws a Bitmap character at whatever position void write(int x, int y, void *font, char *string) { char *c; glRasterPos2f(x,y); for(c=string; c!= ''\0'';c++) { glutBitmapCharacter(GLUT_BITMAP_8_BY_13,*c); } } void setOrtho() { //change to the Projection matrix mode glMatrixMode(GL_PROJECTION); //Save previous settings of projection matrix glPushMatrix(); glLoadIdentity(); //reset matrix //Set Orthographic view gluOrtho2D(0,0,0,0); //Invert y axis glScalef(1,-1,1); //Making the origin the upper left corner glTranslatef(0,-k,0); //revert back to Model View matrix to be able // draw glMatrixMode(GL_MODELVIEW); } void resetOrtho() { glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); } This is how I use the above functions: //This code Writes project name on the screen. //It is in the draw function. setOrtho(); write(10,10,(void *)font, "The Solar system by Joseph Kasere."); resetOrtho(); The problem is that everytime I run this it shows a message box error saying "The Solar System.: orbit.exe - Application Error The instruction at "0x004010ff" referenced memory at "0x0042f000". The memory could not be "read". Click on OK to terminate the program or CANCEL to debug the program." I am very confused, since my program ran very well without the above lines of code yet the exact same lines of code ran in another program! Please help! In pursuit of knowledge.

Share this post


Link to post
Share on other sites