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

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -