c++ - OpenGL: how to clip a 2D area to avoid text with GlutBitmap to be printed out of this area? -
how can define in app areas text can printed, without overflowing out of them?
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); } sample:
void window_function() { // printing things before on 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 clipping aera complete screen //printing other stuff }
glscissor() + glenable(gl_scissor_test).
Comments
Post a Comment