/////////////////////////////////////////////////

/////////////////////////////////////////////////
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>

#ifdef _WIN32
#include <windows.h>
#else
#include <sys/time.h>
#include <unistd.h>
#endif


#include <SDL/SDL.h>
#include <SDL/SDL_thread.h>

#ifdef _WIN32
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")
#endif

#include "geometory.h"
#include "collision_detec_3d.h"




//各種OpenGL変数宣言
const int WIDTH = 800, HEIGHT = WIDTH;//ウィンドウのサイズ

void draw_string(string str, int w=WIDTH, int h=HEIGHT, int x0=10, int y0=10);
void move_obstacle_view();

void robot_expect_path_view(double target_v,double target_w,double x=0,double y=0,double theta=0);
void robot_view(struct ROBOT &robot);
void urg_view( ROBOT &robot,URG &urg_data);
void obstacle_view();
void path_view();
void robot_log_view(double dt);
void mySetLight(void);

void cv_bridge_init();


void display2();
void myMouse2( int button, int state, int x, int y );
void myMotion2( int x, int y );
void resetview2( void );
void polarview2( void );
void reshape2(int ,int);
void myMouse2( int button, int state, int x, int y );
void reshape2(int,int);

void main_draw();

class Graphics{
private:
	static void display();
	static void myMouse( int button, int state, int x, int y );
	static void myMotion( int x, int y );
	static void resetview( void );

	static void idle(void);
	static void myInit(char *progname);
	static void mySkey( int key, int x, int y );
	static void myKbd( unsigned char key, int x, int y );
	static void myKbdup( unsigned char key, int x, int y );
	static void reshape(int ,int);
	
	static void polarview( void );
	static void* start_gui(void *);
	static int GUImain();
	void gui_start();
	void gui_end();
	double timer_ms();

	SDL_Thread *th1;
//	static int POINTS;
	float click_Depth(int x, int y);//マウスのX/Y座標からDepthを算出
	static void click_pickup(int x,int y,double &ax,double &ay,double &az);//マウスのX/Y座標からX/Y/Z座標を算出

	//static void urg_view_sub( URG &urg_data);
	//static void display2();
	//static void myMouse2( int button, int state, int x, int y );
	//static void myMotion2( int x, int y );
	//static void resetview2( void );
	//static void polarview2( void );
	//static void reshape2(int ,int);
	static void gl_disp_save();

public:
    Graphics();
    virtual ~Graphics();

};




static void glVertex3f_p(double x,double y,double z){
			glVertex3f(y,z,x);
}