Exemple #1
0
/*
	main gl expose ,any time sreen needs to be redrawn, this function is called by gltemplate
	,all drawings are initialized in this function
	params:ViewInfo	, global view variable defined in viewport.c
	return value:0 if something goes wrong with GL 1 , otherwise
*/
int glexpose_main(ViewInfo * view)
{
    static int doonce = 0;
    if (!glupdatecamera(view))
        return 0;

//    glEnable(GL_DEPTH_TEST);
//    draw_cube();
//    draw_cube_tex();


    if (view->activeGraph >= 0) {
        if (!doonce) {
            doonce = 1;
            btnToolZoomFit_clicked(NULL, NULL);
            btnToolZoomFit_clicked(NULL, NULL);
        }
    }
    else
        return 0;



    glexpose_grid(view);
#if UNUSED
    draw_fisheye_magnifier(view);
    draw_magnifier(view);
#endif
    drawBorders(view);
    glexpose_drawgraph(view);
    drawRotatingAxis();
    draw_selpoly(&view->Topview->sel.selPoly);
    glCompSetDraw(view->widgets);

//              draw_stuff();
//      test_color_pallete();
//      drawtestpoly();
    /*DEBUG*/
    /*	if (view->mouse.mouse_mode == MM_PAN)
    	{
    		glBegin(GL_LINE_STRIP);
    		glColor4f((GLfloat) 1, (GLfloat) 0.0, (GLfloat) 0.0,
    			(GLfloat) 1);
    		glVertex3f((GLfloat) view->GLx, (GLfloat) view->GLy,
    			(GLfloat) 0.001);
    		glVertex3f((GLfloat) view->GLx2, (GLfloat) view->GLy2,
    			(GLfloat) 0.001);


    		glEnd();
    	}*/
    /*DEBUG*/ return 1;
}
Exemple #2
0
void menu_click_center(glCompObj *obj, GLfloat x, GLfloat y,
			      glMouseButtonType t)
{
    if (view->active_camera == -1) {	/*2D mode */
	btnToolZoomFit_clicked(NULL, NULL);
    } else {			/*there is active camera , adjust it to look at the center */

	view->cameras[view->active_camera]->targetx = 0;
	view->cameras[view->active_camera]->targety = 0;
	view->cameras[view->active_camera]->r = 20;

    }
}