Beispiel #1
0
int main(int argc, const char *argv[])
{
	int ret;
	char ch;
	
	srand(time(NULL));
	ret = fb_open();
	key_init();	
	draw_back();
	draw_grid();
	signal(SIGALRM, sig_handler);
	alarm(1);

	while (1) {
		ch = getchar();
		switch (ch) {
			case 'a':
				if(canleft(pos_x, pos_y, cur_type, arr)) {
					draw_type(pos_x, pos_y, cur_type, BACK);
					pos_x--;
				}
				break;
			case 'd':
				if(canright(pos_x, pos_y, cur_type, arr)) {
					draw_type(pos_x, pos_y, cur_type, BACK);
					pos_x++;
				}
				break;	
			case 's':
				if(candown(pos_x, pos_y, cur_type, arr)) {
					draw_type(pos_x, pos_y, cur_type, BACK);
					pos_y++;
				}
				break;
			case 'w':
				if(canchange(pos_x,pos_y,cur_type,arr)) {
					draw_type(pos_x, pos_y, cur_type, BACK);
					type_chg(&cur_type);
				}
				break;
			default :
				break;
		}
		draw_type(pos_x, pos_y, cur_type, COLOR);
		draw_grid();
		if(!candown(pos_x, pos_y, cur_type, arr)) {
			draw_flag(pos_x, pos_y, cur_type, arr);
			if(gameover(arr)) {
				exit(0);
			}
			deleteone(arr);
			pos_x = XNUM/2; pos_y = 0;
			cur_type = rand()%14;
		}
	}

	fb_close();

	return 0;
}
Beispiel #2
0
int draw_ui()
{

	int menubuffer_location_x = 0, menubuffer_location_y = 0;
	//draw the tile grid around the map
	if (draw_grid_on_map==1)
	draw_grid(0,0,639,639, tile_width, map_buffer, makecol(255,255,255));

	if (draw_grid_on_tiles==1)
	draw_grid(0,0,tilebuffer_width_in_tiles * tile_width , tilebuffer_height_in_tiles * tile_width, tile_width, tile_buffer, makecol(255,255,255));


	// when changing the names of buttons, remember to make sure they call the corresponding function in get_user_input()
	rect(menu_buffer,5,5,90,40,makecol(255,255,255));	//fill button
	textprintf_ex(menu_buffer, font, 30 , 20, makecol(255,255,255), -1, "Fill" );
	rect(menu_buffer,5,45,90,80,makecol(255,255,255));	//fill area button
	textprintf_ex(menu_buffer, font, 30 , 50, makecol(255,255,255), -1, "Fill" );
	textprintf_ex(menu_buffer, font, 30 , 60, makecol(255,255,255), -1, "area" );
	rect(menu_buffer,5,85,90,120,makecol(255,255,255));// copy button
	textprintf_ex(menu_buffer, font, 30 , 100, makecol(255,255,255), -1, "Copy" );
	rect(menu_buffer,5,125,90,160,makecol(255,255,255)); // repeat copy button
	textprintf_ex(menu_buffer, font, 25 , 130, makecol(255,255,255), -1, "Repeat" );
	textprintf_ex(menu_buffer, font, 30 , 140, makecol(255,255,255), -1, "copy" );
	rect(menu_buffer,5,165,90,200,makecol(255,255,255)); // mirror x copy button
	textprintf_ex(menu_buffer, font, 20 , 170, makecol(255,255,255), -1, "Mirror H" );
	textprintf_ex(menu_buffer, font, 30 , 180, makecol(255,255,255), -1, "copy" );
	rect(menu_buffer,5,205,90,240,makecol(255,255,255)); // mirror y copy button
	textprintf_ex(menu_buffer, font, 20 , 210, makecol(255,255,255), -1, "Mirror V" );
	textprintf_ex(menu_buffer, font, 30 , 220, makecol(255,255,255), -1, "copy" );

	rect(menu_buffer,5,245,90,280,makecol(255,255,255));
	rect(menu_buffer,5,285,90,320,makecol(255,255,255));

	rect(menu_buffer,5,325,90,360,makecol(255,255,255)); // toggle grids button
	textprintf_ex(menu_buffer, font, 25 , 330, makecol(255,255,255), -1, "Toggle" );
	textprintf_ex(menu_buffer, font, 30 , 340, makecol(255,255,255), -1, "grids" );
	rect(menu_buffer,5,365,90,400,makecol(255,255,255)); // reload map
	textprintf_ex(menu_buffer, font, 25 , 380, makecol(255,255,255), -1, "Reload" );	
	rect(menu_buffer,5,405,90,440,makecol(255,255,255)); // save map
	textprintf_ex(menu_buffer, font, 30 , 420, makecol(255,255,255), -1, "Save" );


	//here's where the layers all get flattened onto screen_buffer
	blit (menu_buffer, screen_buffer, 0,0,0,0,100,768);
	blit (map_buffer, screen_buffer, 0,0,mapbuffer_location_x,mapbuffer_location_y,641,641);
	blit (tile_buffer, screen_buffer, 0,0,tilebuffer_location_x,tilebuffer_location_y,255,768);
	destroy_bitmap (tile_buffer);
	tile_buffer=load_bitmap("tiles.bmp",0);

	//then I draw the mouse and I'm done.
	line (screen_buffer,	mouse_x-11,	mouse_y-9,	mouse_x+9,	mouse_y+11,	makecol(0,0,0));	//draw the cursor
	line (screen_buffer,	mouse_x-11,	mouse_y-11,	mouse_x+11,	mouse_y+11,	makecol(0,0,0));	//draw the cursor
	line (screen_buffer,	mouse_x-8,	mouse_y-8,	mouse_x+8,	mouse_y+8,	makecol(255,255,255));	//draw the cursor
	line (screen_buffer,	mouse_x-9,	mouse_y-11,	mouse_x+11,	mouse_y+9,	makecol(0,0,0));	//draw the cursor
	line (screen_buffer,	mouse_x-11,	mouse_y+9,	mouse_x+9,	mouse_y-11,	makecol(0,0,0));	//draw the cursor
	line (screen_buffer,	mouse_x-11,	mouse_y+11,	mouse_x+11,	mouse_y-11,	makecol(0,0,0));	//draw the cursor
	line (screen_buffer,	mouse_x-8,	mouse_y+8,	mouse_x+8,	mouse_y-8,	makecol(255,255,255));	//draw the cursor
	line (screen_buffer,	mouse_x-9,	mouse_y+11,	mouse_x+11,	mouse_y-9,	makecol(0,0,0));	//draw the cursor
	return 0;
}
Beispiel #3
0
/*!
	@brief 描画プロシージャ
*/
void mine_tile::paint(Graphics* g){
	switch(state){
	case init:
	case init_lock:
		draw_frame(g);
		break;
	case opened:
		draw_grid(g);
		draw_number(g);
		break;
	case marked:
	case mark_lock:
		draw_frame(g);
		draw_flag(g);
		break;
	case bomb:
		draw_grid(g);
		draw_bomb(g);
		break;
	case exploded:
		draw_grid(g);
		draw_bomb(g);
		draw_cross(g);
		break;
	case missmark:
		draw_frame(g);
		draw_flag(g);
		draw_cross(g);
		break;
	default:
		break;
	}
}
t_jit_err jit_gl_videoplane_draw(t_jit_gl_videoplane *x)
{
	t_jit_err result = JIT_ERR_NONE;
	GLenum prim;
	
	CLIP (x->nudge,0.,0.5);
	prim = (x->gridmode) ? GL_TRIANGLE_STRIP : GL_QUAD_STRIP;
	
	if (x->recalc) {
		jit_gl_videoplane_recalc(x);
		if (x->displaylist) 
		{
			t_jit_gl_context ctx;
			
			// cache/restore context in case in capture mode
			ctx = jit_gl_get_context();			
			jit_ob3d_set_context(x);
			
			if (x->dlref) {
				glDeleteLists(x->dlref,1);
				x->dlref = 0;
			}
			if (x->dlref=glGenLists(1)) {
				glNewList(x->dlref, GL_COMPILE);
				if (x->chunk&&x->chunk->m_vertex) 
					draw_grid(x,x->chunk->m_vertex, prim);
				glEndList();
			}
		
			jit_gl_set_context(ctx);
		}		
		x->recalc = 0;
	}
	
	// draw our chunk of OpenGL geometry. 
	if (x->chunk&&x->chunk->m_vertex) {
		if (!jit_attr_getlong(x,gensym("matrixoutput"))) {
			if (x->displaylist&&x->dlref)
				glCallList(x->dlref);
			else 
				draw_grid(x,x->chunk->m_vertex, prim);
			if(jit_attr_getlong(x, _jit_sym_boundcalc))
				jit_object_method(x, gensym("calcbounds"), x->chunk, NULL);				
		} else{
			color_surface(x);
			result = jit_ob3d_draw_chunk(x->ob3d, x->chunk); //output matrix
		}
	}	
	
	return result;
}
Beispiel #5
0
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_surface_t *source;
    cairo_pattern_t *pattern;

    cairo_paint (cr);

    source = create_source (cairo_get_target (cr), 2560, 1280);
    pattern = cairo_pattern_create_for_surface (source);
    cairo_surface_destroy (source);

    cairo_pattern_set_filter (pattern, CAIRO_FILTER_NEAREST);
    cairo_pattern_set_extend (pattern, CAIRO_EXTEND_NONE);

    draw_grid (cr, pattern, 50, 0);
    draw_grid (cr, pattern, 130, 0);
    draw_grid (cr, pattern, 210, 0);
    draw_grid (cr, pattern, 290, 0);

    draw_grid (cr, pattern, 50,  230);
    draw_grid (cr, pattern, 130, 230);
    draw_grid (cr, pattern, 210, 230);
    draw_grid (cr, pattern, 290, 230);

    cairo_pattern_destroy (pattern);

    return CAIRO_TEST_SUCCESS;
}
Beispiel #6
0
static bool
run_test(const struct image_target_info *target,
         const struct image_extent size)
{
        const struct grid_info grid = {
                GL_FRAGMENT_SHADER_BIT,
                get_image_format(GL_RGBA32F),
                image_optimal_extent(size)
        };
        const struct image_info img = {
                target, grid.format, size,
                image_format_epsilon(grid.format)
        };
        GLuint prog = generate_program(
                grid, GL_FRAGMENT_SHADER,
                concat(image_hunk(img, ""),
                       hunk("readonly uniform IMAGE_T src_img;\n"
                            "writeonly uniform IMAGE_T dst_img;\n"
                            "\n"
                            "GRID_T op(ivec2 idx, GRID_T x) {\n"
                            "        imageStore(dst_img, IMAGE_ADDR(idx),"
                            "                imageLoad(src_img, IMAGE_ADDR(idx)));\n"
                            "        return x;\n"
                            "}\n"), NULL));
        bool ret = prog && init_fb(grid) &&
                init_image(img, 0) &&
                init_image(img, 1) &&
                set_uniform_int(prog, "src_img", 0) &&
                set_uniform_int(prog, "dst_img", 1)  &&
                draw_grid(grid, prog) &&
                check(img);

        glDeleteProgram(prog);
        return ret;
}
Beispiel #7
0
//! LA fonction d'affichage
void GLDraw(void)
{
    // Efface la couleur et le ZBuffer
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glLightfv(GL_LIGHT1, GL_POSITION, LightPosition);

    // Place la scène comme on veut
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    camSetGL(cam);

    glPushAttrib( GL_ENABLE_BIT);
    glPointSize(18);
    glColor3f(1,1,1);
    glDisable(GL_TEXTURE_2D);
    glDisable(GL_LIGHTING);
    glBegin(GL_POINTS);
    glVertex3f( LightPosition[0], LightPosition[1], LightPosition[2]  );
    glEnd();

    if (bAxe) draw_axes();
    if (bGrid) draw_grid();
    if (bAnim) animDraw(scene.anim);

    glPopAttrib();
    sceneDraw(scene);


    // since this is double buffered, swap the buffers to display what just got drawn.
    glutSwapBuffers();
}
Beispiel #8
0
static bool
run_test(GLbitfield shaders)
{
        const struct grid_info grid = {
                shaders,
                get_image_format(GL_R32UI),
                { W, H, 1, 1 }
        };
        const struct image_info img = image_info_for_grid(grid);
        GLuint prog = generate_program(
                grid,
                GL_VERTEX_SHADER,
                generate_source(grid, img, GL_VERTEX_SHADER),
                GL_TESS_CONTROL_SHADER,
                generate_source(grid, img, GL_TESS_CONTROL_SHADER),
                GL_TESS_EVALUATION_SHADER,
                generate_source(grid, img, GL_TESS_EVALUATION_SHADER),
                GL_GEOMETRY_SHADER,
                generate_source(grid, img, GL_GEOMETRY_SHADER),
                GL_FRAGMENT_SHADER,
                generate_source(grid, img, GL_FRAGMENT_SHADER),
                GL_COMPUTE_SHADER,
                generate_source(grid, img, GL_COMPUTE_SHADER));
        bool ret = prog && init_fb(grid) &&
                init_images(img) &&
                bind_images(grid, prog) &&
                draw_grid(grid, prog) &&
                check(grid, img);

        glDeleteProgram(prog);
        return ret;
}
Beispiel #9
0
static gboolean
expose_callback (GtkWidget      *event_box,
                 GdkEventButton *,
                 TSignalData    *sigdata)
{
    cairo_t *cr;
    if (sigdata->event_box != NULL)
        cr = gdk_cairo_create (GDK_DRAWABLE (sigdata->event_box->window));
    else
    {
        cr = gdk_cairo_create (GDK_DRAWABLE (event_box->window));
        sigdata->event_box = event_box;
    }


    if (sigdata->image != NULL)
    {
        GdkPixbuf *pxbf = gtk_image_get_pixbuf(GTK_IMAGE(sigdata->image));

        gdk_cairo_set_source_pixbuf (cr, pxbf, 0,0);

        cairo_paint (cr);

        draw_grid(cr, sigdata->idata);
    }


    return TRUE;
}
Beispiel #10
0
/**
 * Copy from a source image into a destination image of the specified
 * format and check the result.
 *
 * If \a strict_layout_qualifiers is false, uniform layout qualifiers
 * will be omitted where allowed by the spec.  If \a
 * strict_access_qualifiers is false, the "readonly" and "writeonly"
 * qualifiers will be omitted.  If \a strict_binding is false, the
 * image will be bound as READ_WRITE, otherwise only the required
 * access type will be used.
 */
static bool
run_test(const struct image_format_info *format,
         bool strict_layout_qualifiers,
         bool strict_access_qualifiers,
         bool strict_binding)
{
        const struct grid_info grid =
                grid_info(GL_FRAGMENT_SHADER,
                          image_base_internal_format(format), W, H);
        const struct image_info img =
                image_info(GL_TEXTURE_2D, format->format, W, H);
        GLuint prog = generate_program(
                grid, GL_FRAGMENT_SHADER,
                concat(image_hunk(img, ""),
                       test_hunk(strict_layout_qualifiers,
                                 strict_access_qualifiers),
                       hunk("SRC_IMAGE_Q uniform IMAGE_BARE_T src_img;\n"
                            "DST_IMAGE_Q uniform IMAGE_BARE_T dst_img;\n"
                            "\n"
                            "GRID_T op(ivec2 idx, GRID_T x) {\n"
                            "        imageStore(dst_img, IMAGE_ADDR(idx),"
                            "                   imageLoad(src_img, IMAGE_ADDR(idx)));\n"
                            "        return x;\n"
                            "}\n"), NULL));
        bool ret = prog && init_fb(grid) &&
                init_image(img, 0, strict_binding) &&
                init_image(img, 1, strict_binding) &&
                set_uniform_int(prog, "src_img", 0) &&
                set_uniform_int(prog, "dst_img", 1) &&
                draw_grid(grid, prog) &&
                check(grid, img);

        glDeleteProgram(prog);
        return ret;
}
Beispiel #11
0
static bool
run_test(const struct image_op_info *op,
         unsigned w, unsigned h,
         bool (*check)(const struct grid_info grid,
                       const struct image_info img,
                       unsigned w, unsigned h),
         const char *body)
{
        const struct grid_info grid =
                grid_info(GL_FRAGMENT_SHADER, GL_R32UI, W, H);
        const struct image_info img = image_info_for_grid(grid);
        GLuint prog = generate_program(
                grid, GL_FRAGMENT_SHADER,
                concat(image_hunk(img, ""),
                       hunk("uniform IMAGE_T img;\n"),
                       hunk(op->hunk),
                       hunk(body), NULL));
        bool ret = prog &&
                init_fb(grid) &&
                init_image(img) &&
                set_uniform_int(prog, "img", 0) &&
                draw_grid(set_grid_size(grid, w, h), prog) &&
                check(grid, img, w, h);

        glDeleteProgram(prog);
        return ret;
}
Beispiel #12
0
bool render_editor()
{
    cursor c = cursor_get();
    map_view v = view_get();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    update_view(v.x, v.y, v.zoom);
    /*update_cursor_data(&selected_map, &selected_tile_x, &selected_tile_y);*/
    bool can_place = cursor_in_bounds(c.selected_tile_x, c.selected_tile_y);

    mat4 t = ident;
    mat4 cursor_pos = ident;
    uint16_t tile_w = (TILE_WIDTH * v.zoom);
    uint16_t tile_h = (TILE_HEIGHT * v.zoom);
    if(tile_w == 0)
        tile_w = 1;
    if(tile_h == 0)
        tile_h = 1;
    mat4_translate(&cursor_pos, c.selected_tile_x * TILE_WIDTH + (c.selected_map % 3 * TILEMAP_DIMS * TILE_WIDTH), c.selected_tile_y * TILE_HEIGHT + (c.selected_map / 3 * TILEMAP_DIMS * TILE_HEIGHT), 0);
    draw_maps(t);
    if(can_place) {
        draw_single_tile(get_tileset_texture(), c.set_id, c.current_id, cursor_pos);
    }
    for(int i = 0; i < 3; ++i)
        for(int j = 0; j < 3; ++j) {
            mat4_translate(&t, TILEMAP_DIMS * TILE_WIDTH * i, TILEMAP_DIMS * TILE_HEIGHT * j, 0);
            draw_grid(t);
        }
    
    glFlush();

    return true;
}
Beispiel #13
0
void test_image(void)
{
     int x, y;
     int fntWidth;
     int fntHeight;
     const int height = 10;
     const int width = 30;

     ruint16* fontbuf;
     int byteWidth;

     draw_grid();
     FntSetFont(&FntGlobalContext, FntIDAlpha);

     byteWidth = FntGetByteWidth(&FntGlobalContext);
     fntHeight = FntGetTextHeight(&FntGlobalContext);
     fntWidth = FntGetTextWidth(&FntGlobalContext, "abcdefg", 4);
     fontbuf = FntGetStrImage(&FntGlobalContext, 0, 0, fntWidth, fntHeight, "abcdefg", 4, 0);

     draw_red_frame(0, 0, fntWidth, fntHeight);

     for ( y = 0 ; y < fntHeight ; y++ )
     {
	  for ( x = 0 ; x < fntWidth ; x++ )
	  {
	       if ( fontbuf[ fntWidth*y + x ] ) draw_box(x, y);
	  }
     }
}
Beispiel #14
0
void tetris_update() {
	int i;
	for(i = 0; i < MAX_PLAYERS; i++) {
		update_grid(&grids[i]);
		draw_grid(&grids[i]);
	}
}
void GLWidget::paintGL(){
	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(60.0f,(GLfloat)width/(GLfloat)height,0.01f,650.0f);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	gluLookAt(
		0.0, cam_radius, cam_radius,
		0.0, 0.0, 0.0,
		0.0, 0.0, 1.0);
	glViewport(0, 0, width, height);
	glRotatef( rotate_x, 1.0, 0.0, 0.0 );
	glRotatef( rotate_y, 0.0, 0.0, 1.0 );

	draw_layers();
	if (show_grid)
		draw_grid(-0.5,-0.5,0.1,0.1,11,11,&guide_z,&guide_col);
	if (show_axis)
		draw_axis();

	glFlush();
}
Beispiel #16
0
static gboolean
preview_expose(GtkWidget *widget, GdkEventExpose *event)
{
   cairo_t *cr;
   gint width = preview_get_width (widget);
   gint height = preview_get_height (widget);

   cr = gdk_cairo_create (event->window);
   gdk_cairo_region (cr, event->region);
   cairo_clip (cr);
   cairo_set_line_width (cr, 1.);
   draw_grid (cr, width, height);
   
   draw_shapes (cr);

   if (_tmp_obj)
   {
      /* this is a bit of a hack */
      gdouble dash = 4.;
      _tmp_obj->selected |= 4;
      cairo_set_source_rgb (cr, 1., 0., 1.);
      cairo_set_dash (cr, &dash, 1, dash);
      object_draw (_tmp_obj, cr);
   }

   cairo_destroy (cr);
   return FALSE;
}
Beispiel #17
0
Datei: FED.C Projekt: MegaGod/TW
void draw_char( void ) {
	static int first = 1;
	int i, j;
	if ( load_first ) {
		first = 1;
		load_first = 0;
	}
	if ( !first ) {
		putimage( 0 + align, 0, matrix_image, COPY_PUT );
	} else {
		draw_grid( X, Y );
		matrix_image = ( char * ) realloc( matrix_image,
			imagesize( 0 + align, 0, ( WIDTH_X + 2 )*X + align, ( WIDTH_Y + 2 )*Y ) );
		getimage( 0 + align, 0, ( WIDTH_X + 2 )*X + align,
			( WIDTH_Y + 2 )*Y, matrix_image );
	}

	for ( j = 0; j < Y; j++ ) {
		for ( i = 0; i < X; i++ ) {
			if ( edit_font[i][j] ) {
				put_dot( i, j );
			} else if ( first ) {
				square( i, j );
			}
		}
	}
	first = 0;
}
Beispiel #18
0
bool
restart_game(void)
{
    // reload current game
    if (!load_board())
        return false;

    // redraw board
    draw_grid();
    draw_numbers();
    copy_board();

    // get window's dimensions
    int maxy, maxx;
    getmaxyx(stdscr, maxy, maxx);

    // move cursor to board's center
    g.y = g.x = 4;
    show_cursor();

    // remove log, if any
    remove("log.txt");

    // w00t
    return true;
}
Beispiel #19
0
int main(int argc, char *argv[])
{
RGBPic *p;
PLOT *plot;

p=make_RGBPic(800,600);
RGBPic_clear_area(p,COLOR(60,80,50),0,0,p->width,p->height);

plot=make_plot(640,480);
plot->lower_x=3.1415;
plot->upper_x=12423;
plot->lower_y=2.34E-10;
plot->upper_y=43.5E-8;
draw_grid(p,plot,50,50);
free_plot(plot);

//RGBPic_printf(p,30,30,COLOR(255,240,210),COLOR(1,2,3),"Hello all !\n line 2 %d %p",argc,p);
//RGBPic_printf_v(p,300,300,COLOR(255,240,210),COLOR(1,2,3),"Hello all 2 !\n line 2 %d %p",argc,p);
RGBPic_draw_line(p,COLOR(40,255,80), 40,50,60,70);
RGBPic_draw_line(p,COLOR(250,255,80), 30,50,60,30);

RGBPic_dump_ppm("test1.ppm",p);
free_RGBPic(p);
return 0;
}
Beispiel #20
0
void
draw_scene()
{
  static int first_run = 1;
  static rc_t rc;
  static est2User_t e2u;
  static sensors2Estimator_t s2e;
  static system_energy_t se;

  if (first_run == 1){
    first_run = 0;
    /* set up telemetry stream */
    initialize_visualizer_telemetry(&rc, &e2u, &s2e, &se);
    init_object_manager();
    init_spline_geometry();
    init_tether_vis();
    init_spline_trajectory_vis();
    init_wind_vis();
    init_simple_model_vis();
    init_path_vis();
  }

  telemetry_periodic();
  manage_high_score( &e2u, &rc);

  // Render GL stuff
  glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);	// Clear The Screen And The Depth Buffer
  glPushMatrix();

  // put the visualizer in NED
  glRotatef( 90.0f, 1.0f, 0.0f, 0.0f);

  draw_grid();
  draw_object_manager_objects();
  draw_tether();
  draw_axes_from_euler(0.0f,0.0f,0.0f,0.0f,0.0f,-1.0f,30.0f,8.0f); // origin
  draw_all_spline_trajectories();
  draw_spline_geometry( 10 );
  draw_wind_est( &e2u );
  draw_wind_vis( DT );
  draw_simple_model_vis();
  draw_path_vis();

  draw_camera_focus();

  // satellite imagery
  manage_imagery();
 
  draw_text( &rc, &e2u, &s2e, &se, window_width, window_height, current_score, session_high_score );

  glPopMatrix();

  visualizer_talk( &s2e, &e2u, &rc);

  run_realtime( DT );

  // swap the buffers to display, since double buffering is used.
  glutSwapBuffers();
}
Beispiel #21
0
static void
draw_box (ModeInfo *mi)
{
  /* boing_configuration *bp = &bps[MI_SCREEN(mi)]; */
  glPushMatrix();
  glTranslatef (0, 0, -0.5);
/*  glFrontFace (GL_CCW);*/
  draw_grid (mi);
  glPopMatrix();

  glPushMatrix();
  glRotatef (90, 1, 0, 0);
  glTranslatef (0, 0, 0.5);
/*  glFrontFace (GL_CW);*/
  draw_grid (mi);
  glPopMatrix();
}
Beispiel #22
0
static void see_grid(void)
{
	save_undo();
	draw_grid();
	zoom_it();
	wait_wndo_input(ANY_CLICK);
	zoom_unundo();
}
Beispiel #23
0
static bool
run_test(const struct image_qualifier_info *qual,
         const struct image_stage_info *stage_w,
         const struct image_stage_info *stage_r,
         unsigned l)
{
        const struct grid_info grid = {
                stage_w->bit | stage_r->bit,
                get_image_format(GL_RGBA32UI),
                { l, l, 1, 1 }
        };
        const struct image_info img = image_info_for_grid(grid);
        GLuint prog = generate_program(
                grid,
                /*
                 * Write (11, 22, 33, 44) to some location on the
                 * image from the write stage.
                 */
                stage_w->stage,
                concat(qualifier_hunk(qual),
                       image_hunk(img, ""),
                       hunk("IMAGE_Q uniform IMAGE_T img;\n"
                            "\n"
                            "GRID_T op(ivec2 idx, GRID_T x) {\n"
                            "       imageStore(img, idx, DATA_T(11, 22, 33, 44));"
                            "       return x;"
                            "}\n"), NULL),
                /*
                 * The same location will read back the expected value
                 * if image access is coherent, as the shader inputs
                 * of the read stage are dependent on the outputs of
                 * the write stage and consequently they are
                 * guaranteed to be executed sequentially.
                 */
                stage_r->stage,
                concat(qualifier_hunk(qual),
                       image_hunk(img, ""),
                       hunk("IMAGE_Q uniform IMAGE_T img;\n"
                            "\n"
                            "GRID_T op(ivec2 idx, GRID_T x) {\n"
                            "       DATA_T v = imageLoad(img, idx);"
                            "       if (v == DATA_T(11, 22, 33, 44))"
                            "             return GRID_T(33, 33, 33, 33);"
                            "       else"
                            "             return GRID_T(77, 77, 77, 77);"
                            "}\n"), NULL));
        bool ret = prog &&
                init_fb(grid) &&
                init_image(img) &&
                set_uniform_int(prog, "img", 0) &&
                draw_grid(grid, prog) &&
                (check(grid, img) || qual->control_test);

        glDeleteProgram(prog);
        return ret;
}
Beispiel #24
0
void GameArea::drawArea()
{
  _game_area->fill(_area_color);

  if (_grid)
    draw_grid();

  draw_map();
  update();
}
Beispiel #25
0
void board_dump(board_t b, int y, int x) { 
    int i, j;
    draw_grid(y, x);
    for (i = 0; i < SIZE; i++) {
        for (j = 0; j < SIZE; j++) {
            if (b[i][j])
                mvprintw(i * 4 + 2 + y, j * 9 + 3 + x, "%d", value_real[b[i][j]]);
        }
    }
}
static gboolean draw_event (GtkWidget * widget, cairo_t * cr, GtkWidget * area)
{

    draw_background (widget, cr);
    draw_visualizer (widget, cr);
#if 0
    draw_grid (widget, cr);
#endif

    return TRUE;
}
Beispiel #27
0
void mouse_pointer::update()
{
    point p;
    GLint viewport[4];
    gl_vector3 pos;
    gl_vector3 angle;
    unsigned long t;

    t = SDL_GetTicks() % 3600;
    pulse_ = (GLfloat)sin(((GLfloat)t / 10.0f) * (GLfloat)(acos(-1) / 180)) * 1.0f;
    // WinMousePosition(&p.x, &p.y);

    if((last_mouse_.get_x() == p.get_x()) && (last_mouse_.get_y() == p.get_y())) {
        return;
    }

    last_mouse_ = p;

    // This sets the viewport[4] to the size and location
    // of the screen relative to the window
    // glViewport(0, 0, WinWidth(), WinHeight());
    glGetIntegerv(GL_VIEWPORT, viewport);
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    
    // This creates a matrix that will zoom up to a small portion
    // of the screen
    gluPickMatrix((GLdouble)p.get_x(),
                  (GLdouble)(viewport[3] - p.get_y()),
                  2.0f,
                  2.0f,
                  viewport);

    // Apply the perspective matrix
    gluPerspective(45.0f,
                   (GLfloat)(viewport[2] - viewport[0]) / (GLfloat)(viewport[3] - viewport[1]),
                   0.1f,
                   1024.0f);

    // Select the modelview matrix
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    pos = camera_->get_position();
    angle = camera_->get_angle();
    glRotatef(angle.get_x(), 1.0f, 0.0f, 0.0f);
    glRotatef(angle.get_y(), 0.0f, 1.0f, 0.0f);
    glRotatef(angle.get_z(), 0.0f, 0.0f, 1.0f);
    glTranslatef(-pos.get_x(), -pos.get_y(), -pos.get_z());
    last_cell_ = draw_grid();
    glMatrixMode(GL_PROJECTION);
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
}
Beispiel #28
0
void draw(void)
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glLoadIdentity();

  //draw working window and panel with set of tools
  draw_grid();
  draw_panel(border);
  glColor3f(0, 0, 0);
  drawBitmapText("Tools", 2, 770);
  draw_buttons();
}
Beispiel #29
0
void GLWidget::paintGL() {
  if (_modelLighting)
    glEnable(GL_LIGHTING);
  else
    glDisable(GL_LIGHTING);

  glClearColor(_BackgroundColorR, _BackgroundColorG, _BackgroundColorB, 0.0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  gluLookAt(eyex, eyey, eyez, // camera position
            targetx, targety, targetz,          // target position
            up_vector.x, up_vector.y, up_vector.z);

  float scale_size(1 / 1.5);

	glPushMatrix();
	if (_showFilteredMesh && !filtered_mesh.empty()) {
		glTranslatef(0.6, 0, 0);
		glScalef(scale_size, scale_size, scale_size);
	}
	if (!primary_meshes.empty()) {
		draw_mesh(primary_meshes[0]);
		//draw_mesh_test(primary_meshes[0]);
		//*
		if (vertex_chosen) {
			drawSphereOnVertex(chosen, 0.05);
			drawSphereOnVertex(chosen, 0.14);
			drawSphereOnVertex(chosen, 0.22);
		}
		//*/
	}
	if (_showGrid)
		draw_grid(primary_meshes[0]);
	glPopMatrix();

  if (_showFilteredMesh && !filtered_mesh.empty()) {
    glPushMatrix();
    glTranslatef(-0.5, 0, 0);
    glScalef(scale_size, scale_size, scale_size);
    draw_mesh(filtered_mesh);
    glPopMatrix();
  }

  if (_showAxis) {
    glPushMatrix();
    glScalef(scale_size, scale_size, scale_size);
    draw_axis();
    glPopMatrix();
  }

}
Beispiel #30
0
void LPOut::draw() {
	if(plotter->openpl() < 0) {
		std::cerr << "Couldn't open plotter" << std::endl;
	}
	plotter->fspace(0.0, 0.0, gridsize + 20, gridsize + 20);
	plotter->ftranslate(10, 10);
	
	
	for(int i=0; i < highlighted_boxes.size(); i++) {
		Out_Highlight h = highlighted_boxes[i];
	}
	
	for(int i=0; i < highlighted_rows.size(); i++) {
		Out_Highlight h = highlighted_rows[i];
	}
	
	for(int i=0; i < highlighted_cols.size(); i++) {
		Out_Highlight h = highlighted_cols[i];
	}
	
	for(int i=0; i < highlighted_cells.size(); i++) {
		Out_Highlight h = highlighted_cells[i];
	}
	
	for(int i=0; i < links.size(); i++) {
		Out_Link h = links[i];
	}
	
	for(int i=0; i < highlighted_candidates.size(); i++) {
		Out_Highlight h = highlighted_candidates[i];
	}
	
	for(int i=0; i < outlined_cells.size(); i++) {
		Out_Outline h = outlined_cells[i];
	}
	
	for(int i=0; i < candidates.size(); i++) {
		Out_Number n = candidates[i];
		draw_candidate(plotter, n.p, n.val);
	}
	
	for(int i=0; i < fullnumbers.size(); i++) {
		Out_Number n = fullnumbers[i];
		draw_fullnumber(plotter, n.p, n.val);
	}
	
	draw_grid(plotter);
	
	if(plotter->closepl() < 0) {
		std::cerr << "Couldn't close plotter" << std::endl;
	}
}