如何在应用程序中定义一些可以打印文本而又不会溢出的区域?
int printText(char *myChar, int color, double x, double y, double z)
{
call_color(color);
int end_of_char=strlen(myChar);
glRasterPos3d(x,y,-1);
for(int i=0;i<end_of_char;i++)
{
glutBitmapCharacter(GLUT_BITMAP_8_BY_13,myChar[i]);
}
return(0);
}
样品:
void window_function()
{
// printing things before on all screen
// define clipping aera
char tem[64];
sprintf(tem,"mouse x: %.4f mouse y: %.4f",mouse_ox,mouse_oy);
printText(tem,COL_LIGHT_GREY,x+0.005,y-0.085,1.0);
//re opening the clipping aera to the complete screen
//printing other stuff
}
最佳答案
glScissor()
+ glEnable(GL_SCISSOR_TEST)
。