Changeset 1623 for trunk/tools/neercs/video
- Timestamp:
- Jul 11, 2012, 1:40:41 AM (11 years ago)
- Location:
- trunk/tools/neercs/video
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/neercs/video/render.cpp
r1622 r1623 82 82 float beat_speed = 2.0f; // speed 83 83 /* window variable */ 84 i nt window_m;// margin84 ivec2 border; // margin 85 85 int window_vtx[8]; // vertex array 86 ivec2 ratio_2d(2,4); // 2d ratio 86 /* text variable */ 87 ivec2 ratio_2d(2,2); // 2d ratio 87 88 ivec2 map_size(256,256); // texture map size 88 89 ivec2 font_size(8,8); // font size 89 ivec2 text_size( 80,25);// text size90 ivec2 text_size(0,0); // text size 90 91 ivec2 blit_top(0,0); // text blit top position 91 92 ivec2 blit_bottom(0,0); // text blit bottom position 92 int shell_vtx[8]; // vertex array93 float shell_tex[] = {1.0f, 0.96875f, 1.0f, 1.0f, 0.78125f, 1.0f, 0.78125f, 0.96875f};94 93 /* common variable */ 95 94 float value, angle, radius, scale, speed; … … 233 232 } 234 233 235 int Render::CreateGLWindow( )234 int Render::CreateGLWindow(caca_canvas_t *caca) 236 235 { 237 236 screen_size = Video::GetSize(); 238 237 239 window_m = 12 * ratio_2d.x;238 border = 12 * ratio_2d; 240 239 window_vtx[0] = font_size.x * ratio_2d.x / 2.0f; 241 240 window_vtx[1] = font_size.y * ratio_2d.y / 2.0f; … … 246 245 window_vtx[6] = -font_size.x * ratio_2d.x / 2.0f; 247 246 window_vtx[7] = font_size.y * ratio_2d.y / 2.0f; 248 shell_vtx[0] = window_m + 58 * ratio_2d.x; 249 shell_vtx[1] = window_m + (font_size.y + 1) * ratio_2d.y; 250 shell_vtx[2] = window_m + 58 * ratio_2d.x; 251 shell_vtx[3] = window_m + ratio_2d.y; 252 shell_vtx[4] = window_m + 2 * ratio_2d.x; 253 shell_vtx[5] = window_m + ratio_2d.y; 254 shell_vtx[6] = window_m + 2 * ratio_2d.x; 255 shell_vtx[7] = window_m + (font_size.y + 1) * ratio_2d.y; 256 257 blit_top = ivec2(window_m, window_m + font_size.y * ratio_2d.y) + ratio_2d * 2; 258 blit_bottom = screen_size - ivec2(window_m * 2, window_m * 2 + font_size.y * ratio_2d.y) + ratio_2d * 2; 259 260 //caca_set_canvas_size(m_caca,20,10); 247 248 ivec2 current_size = (screen_size - border * 2); 249 text_size = current_size / (font_size * ratio_2d); 250 251 //border 252 253 blit_top = border; 254 blit_bottom = screen_size - border * 2; 255 256 caca_set_canvas_size(caca,text_size.x,text_size.y); 261 257 262 258 InitDraw(); … … 269 265 m_pause(false), 270 266 m_polygon(true), 271 m_shader( true),267 m_shader(false), 272 268 m_shader_blur(true), 273 269 m_shader_glow(true), … … 315 311 if (!m_ready) 316 312 { 317 CreateGLWindow( );313 CreateGLWindow(m_caca); 318 314 text_render->Init(); 319 315 m_ready = true; … … 400 396 glDisable(GL_BLEND); 401 397 glColor3f(1.0f,1.0f,1.0f); 402 rectangle(window_m,window_m,screen_size.x-53*ratio_2d.x-window_m*2,(font_size.y+2)*ratio_2d.y); 403 rectangle(screen_size.x-51*ratio_2d.x-window_m,window_m,22*ratio_2d.x,(font_size.y+2)*ratio_2d.y); 404 rectangle(screen_size.x-27*ratio_2d.x-window_m,window_m,22*ratio_2d.x,(font_size.y+2)*ratio_2d.y); 405 rectangle(screen_size.x-3*ratio_2d.x-window_m,window_m,3*ratio_2d.x,(font_size.y+2)*ratio_2d.y); 406 rectangle(window_m,window_m+(font_size.y+2)*ratio_2d.y,2*ratio_2d.x,screen_size.y-(font_size.y+2)*ratio_2d.y-window_m*2); 407 rectangle(screen_size.x-2*ratio_2d.x-window_m,window_m+(font_size.y+2)*ratio_2d.y,2*ratio_2d.x,screen_size.y-(font_size.y+2)*ratio_2d.y-window_m*2); 408 rectangle(window_m+2*ratio_2d.x,screen_size.y-ratio_2d.y-window_m,screen_size.x-4*ratio_2d.x-window_m*2,ratio_2d.y); 409 glColor3f(screen_color.x,screen_color.y,screen_color.z); 410 rectangle(window_m+2*ratio_2d.x,window_m+ratio_2d.y,56*ratio_2d.x,font_size.y*ratio_2d.y); 411 rectangle(window_m+60*ratio_2d.x,window_m+2*ratio_2d.y,screen_size.x-115*ratio_2d.x-window_m*2,2*ratio_2d.y); 412 rectangle(window_m+60*ratio_2d.x,window_m+6*ratio_2d.y,screen_size.x-115*ratio_2d.x-window_m*2,2*ratio_2d.y); 413 rectangle(screen_size.x-49*ratio_2d.x-window_m,window_m+ratio_2d.y,14*ratio_2d.x,6*ratio_2d.y); 414 glColor3f(1.0f,1.0f,1.0f); 415 rectangle(screen_size.x-47*ratio_2d.x-window_m,window_m+2*ratio_2d.y,10*ratio_2d.x,4*ratio_2d.y); 416 glColor3f(0,0,0); 417 rectangle(screen_size.x-45*ratio_2d.x-window_m,window_m+3*ratio_2d.y,14*ratio_2d.x,6*ratio_2d.y); 418 rectangle(screen_size.x-25*ratio_2d.x-window_m,window_m+1*ratio_2d.y,14*ratio_2d.x,6*ratio_2d.y); 419 glColor3f(screen_color.x,screen_color.y,screen_color.z); 420 rectangle(screen_size.x-21*ratio_2d.x-window_m,window_m+2*ratio_2d.y,14*ratio_2d.x,7*ratio_2d.y); 421 glColor3f(1.0f,1.0f,1.0f); 422 rectangle(screen_size.x-19*ratio_2d.x-window_m,window_m+3*ratio_2d.y,10*ratio_2d.x,5*ratio_2d.y); 423 rectangle(screen_size.x-16*ratio_2d.x-window_m,screen_size.y-9*ratio_2d.y-window_m,14*ratio_2d.x,8*ratio_2d.y); 424 glColor3f(screen_color.x,screen_color.y,screen_color.z); 425 rectangle(screen_size.x-14*ratio_2d.x-window_m,screen_size.y-8*ratio_2d.y-window_m,12*ratio_2d.x,7*ratio_2d.y); 426 glColor3f(1.0f,1.0f,1.0f); 427 rectangle(screen_size.x-8*ratio_2d.x-window_m,screen_size.y-8*ratio_2d.y-window_m,8*ratio_2d.x,2*ratio_2d.y); 428 rectangle(screen_size.x-14*ratio_2d.x-window_m,screen_size.y-5*ratio_2d.y-window_m,4*ratio_2d.x,5*ratio_2d.y); 429 rectangle(screen_size.x-12*ratio_2d.x-window_m,screen_size.y-7*ratio_2d.y-window_m,2*ratio_2d.x,1*ratio_2d.y); 430 rectangle(screen_size.x-8*ratio_2d.x-window_m,screen_size.y-5*ratio_2d.y-window_m,4*ratio_2d.x,3*ratio_2d.y); 431 glEnable(GL_BLEND); 432 if(m_polygon) glEnable(GL_TEXTURE_2D); 433 glBlendFunc(GL_ONE, GL_ONE); 434 glVertexPointer(2, GL_INT, 0, shell_vtx); 435 glTexCoordPointer(2, GL_FLOAT, 0, shell_tex); 436 glDrawArrays(GL_QUADS, 0, 4); 398 rectangle(border.x+ratio_2d.x,border.y,screen_size.x-2*ratio_2d.x-border.x*2,ratio_2d.y);//(font_size.y+2)*ratio_2d.y); 399 rectangle(border.x,border.y+ratio_2d.y,ratio_2d.x,screen_size.y-ratio_2d.y*2-border.y*2); 400 rectangle(screen_size.x-ratio_2d.x-border.x,border.y+ratio_2d.y,ratio_2d.x,screen_size.y-2*ratio_2d.y-border.y*2); 401 rectangle(border.x+ratio_2d.x,screen_size.y-ratio_2d.y-border.y,screen_size.x-2*ratio_2d.x-border.x*2,ratio_2d.y); 437 402 glEnable(GL_BLEND); 438 403 } -
trunk/tools/neercs/video/render.h
r1588 r1623 21 21 22 22 private: 23 int CreateGLWindow( );23 int CreateGLWindow(caca_canvas_t *m_caca); 24 24 int InitDraw(); 25 25 void Pause();
Note: See TracChangeset
for help on using the changeset viewer.