graphic plotter

i want it to b in 3d ,

Page 1 of 1

2 Replies - 754 Views - Last Post: 05 May 2010 - 09:07 PM

#1 musaib.k  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 28-January 10

graphic plotter

Posted 02 May 2010 - 07:15 AM

i have doing a project called graphic plotter in 2d but now my head of d project wants it to b in 3d so i have less tym about 3 to 34 days so any one can just guide me ...
code is in the attachments..
Header file,which in turn includes other system and user defined// 
//Header Files and has declaration for all the function used in the prog////
//and contains all the global variables used in the program/////////////////

#include<GP/glob.h>

//Function to detect Mouse Move and Call puMouse to take necessary actions//
//if user has clicked on any of the widgets/////////////////////////////////
//This is a Call Back Function//////////////////////////////////////////////
void MouseMove(int x,int y)
{
	/* Pass information about the position of the mouse to pui */
	puMouse(x,y);
	glutPostRedisplay();
}

//Function to detect Key Pressed.If its q or Q,the application will be closed//
//If the key pressed is b or B,the application will goto Main Screen////////// 
//This is a Call Back Function//////////////////////////////////////////////
void mykey(unsigned char key,int x,int y)
{
	if(key=='q' || key=='Q' )
		exit(0);
	if(key=='b' || key=='B' )
		fork_c();
	puKeyboard(key,PU_DOWN);
	glutPostRedisplay();
}

//Function to Initialize PUI,and display the Main Screen///////////////////// 
void InitUI()
{
	int x1,y1,x2,y2;
	puSetDefaultStyle( PUSTYLE_BEVELLED) ;
	puSetDefaultColourScheme( 0.9f, 0.7f, 0.5f );
	otow(-40.0,40.0,x1,y1);
	otow(40.0,60.0,x2,y2);
	puOneShot *b = new puOneShot( x1,y1,x2,y2);
	otow(-40.0,10.0,x1,y1);
	otow(40.0,30.0,x2,y2);
	puOneShot *c = new puOneShot( x1,y1,x2,y2);
	otow(-40.0,-20.0,x1,y1);
	otow(40.0,0.0,x2,y2);
	puOneShot *d = new puOneShot( x1,y1,x2,y2);
	otow(-40.0,-50.0,x1,y1);
	otow(40.0,-30.0,x2,y2);
	puOneShot *e = new puOneShot( x1,y1,x2,y2);
	//Set the control's text label and callback function
	b -> setLegend   ( "LINE GRAPH" );
	b -> setCallback ( ReadL );
	c -> setLegend   ( "BAR GRAPH" );
	c -> setCallback ( ReadB );
	d -> setLegend   ( "PIE CHART" );
	d -> setCallback ( ReadP );
	e -> setLegend   ( "EXIT" );
	e -> setCallback (  quit_CB1 );
}

//This Function is required by PUI library///////////////////////////////////
//This is a Call Back Function//////////////////////////////////////////////
void SpecialKeyBoard(int key,int x,int y)
{
	puKeyboard(key+PU_KEY_GLUT_SPECIAL_OFFSET,PU_DOWN);
	glutPostRedisplay();
}

////////////////////////////////////////////////////////////////////////////////////////////////
// Called to draw the first scene giving the user option to choose among the types of graphs////
////////////////////////////////////////////////////////////////////////////////////////////////
//This is a Call Back Function//////////////////////////////////////////////
void RenderScene(void)
{
	// Clear the window with current clearing color
	glClear(GL_COLOR_BUFFER_BIT);
	roundrec(-100,-75,100,80,10,0,0.5,0.8);
	// Set current drawing color
	glColor4f(0.0f, 0.0f, 0.0f,1.0f);
	glRasterPos2i(-35,65);
	DispString("GRAPH PLOTTER");
	puDisplay(id);
	// Flush drawing commands
	glutSwapBuffers();
}

//Function to detect Mouse Click and Call puMouse to take necessary actions//
//if user has clicked on any of the widgets/////////////////////////////////
//This is a Call Back Function//////////////////////////////////////////////
void MouseButton(int button,int state,int x,int y)
{
	/* see if the mouse clicked on any of the user interface controls */
	puMouse(button,state,x,y);
	glutPostRedisplay();
	puDisplay(id1);
}

/////////////////////////////
// Main program entry point//
/////////////////////////////
int main(int argc, char* argv[])
{
	glutInit(&argc, argv);
	width=glutGet(GLUT_SCREEN_WIDTH);
	height=glutGet(GLUT_SCREEN_HEIGHT);  
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowPosition(0,0);
	glutInitWindowSize(width,height);
	id=glutCreateWindow("GRAPH PLOTTER");
	myInit();
	puInit();
	InitUI();
	glutReshapeFunc(ChangeSize);
	glutKeyboardFunc(mykey);
	glutSpecialFunc(SpecialKeyBoard);
	glutDisplayFunc(RenderScene);
	glutMouseFunc(MouseButton);
	glutMotionFunc(MouseMove);
	glutFullScreen();
	glutMainLoop();
	return 0;
}


Email me

Is This A Good Question/Topic? 0
  • +

Replies To: graphic plotter

#2 musaib.k  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 28-January 10

Re: graphic plotter

Posted 02 May 2010 - 07:16 AM

i have doing a project called graphic plotter in 2d but now my head of d project wants it to b in 3d so i have less tym about 3 to 34 days so any one can just guide me ...
code is in the attachments..
Header file,which in turn includes other system and user defined// 
//Header Files and has declaration for all the function used in the prog////
//and contains all the global variables used in the program/////////////////

#include<GP/glob.h>

//Function to detect Mouse Move and Call puMouse to take necessary actions//
//if user has clicked on any of the widgets/////////////////////////////////
//This is a Call Back Function//////////////////////////////////////////////
void MouseMove(int x,int y)
{
	/* Pass information about the position of the mouse to pui */
	puMouse(x,y);
	glutPostRedisplay();
}

//Function to detect Key Pressed.If its q or Q,the application will be closed//
//If the key pressed is b or B,the application will goto Main Screen////////// 
//This is a Call Back Function//////////////////////////////////////////////
void mykey(unsigned char key,int x,int y)
{
	if(key=='q' || key=='Q' )
		exit(0);
	if(key=='b' || key=='B' )
		fork_c();
	puKeyboard(key,PU_DOWN);
	glutPostRedisplay();
}

//Function to Initialize PUI,and display the Main Screen///////////////////// 
void InitUI()
{
	int x1,y1,x2,y2;
	puSetDefaultStyle( PUSTYLE_BEVELLED) ;
	puSetDefaultColourScheme( 0.9f, 0.7f, 0.5f );
	otow(-40.0,40.0,x1,y1);
	otow(40.0,60.0,x2,y2);
	puOneShot *b = new puOneShot( x1,y1,x2,y2);
	otow(-40.0,10.0,x1,y1);
	otow(40.0,30.0,x2,y2);
	puOneShot *c = new puOneShot( x1,y1,x2,y2);
	otow(-40.0,-20.0,x1,y1);
	otow(40.0,0.0,x2,y2);
	puOneShot *d = new puOneShot( x1,y1,x2,y2);
	otow(-40.0,-50.0,x1,y1);
	otow(40.0,-30.0,x2,y2);
	puOneShot *e = new puOneShot( x1,y1,x2,y2);
	//Set the control's text label and callback function
	b -> setLegend   ( "LINE GRAPH" );
	b -> setCallback ( ReadL );
	c -> setLegend   ( "BAR GRAPH" );
	c -> setCallback ( ReadB );
	d -> setLegend   ( "PIE CHART" );
	d -> setCallback ( ReadP );
	e -> setLegend   ( "EXIT" );
	e -> setCallback (  quit_CB1 );
}

//This Function is required by PUI library///////////////////////////////////
//This is a Call Back Function//////////////////////////////////////////////
void SpecialKeyBoard(int key,int x,int y)
{
	puKeyboard(key+PU_KEY_GLUT_SPECIAL_OFFSET,PU_DOWN);
	glutPostRedisplay();
}

////////////////////////////////////////////////////////////////////////////////////////////////
// Called to draw the first scene giving the user option to choose among the types of graphs////
////////////////////////////////////////////////////////////////////////////////////////////////
//This is a Call Back Function//////////////////////////////////////////////
void RenderScene(void)
{
	// Clear the window with current clearing color
	glClear(GL_COLOR_BUFFER_BIT);
	roundrec(-100,-75,100,80,10,0,0.5,0.8);
	// Set current drawing color
	glColor4f(0.0f, 0.0f, 0.0f,1.0f);
	glRasterPos2i(-35,65);
	DispString("GRAPH PLOTTER");
	puDisplay(id);
	// Flush drawing commands
	glutSwapBuffers();
}

//Function to detect Mouse Click and Call puMouse to take necessary actions//
//if user has clicked on any of the widgets/////////////////////////////////
//This is a Call Back Function//////////////////////////////////////////////
void MouseButton(int button,int state,int x,int y)
{
	/* see if the mouse clicked on any of the user interface controls */
	puMouse(button,state,x,y);
	glutPostRedisplay();
	puDisplay(id1);
}

/////////////////////////////
// Main program entry point//
/////////////////////////////
int main(int argc, char* argv[])
{
	glutInit(&argc, argv);
	width=glutGet(GLUT_SCREEN_WIDTH);
	height=glutGet(GLUT_SCREEN_HEIGHT);  
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowPosition(0,0);
	glutInitWindowSize(width,height);
	id=glutCreateWindow("GRAPH PLOTTER");
	myInit();
	puInit();
	InitUI();
	glutReshapeFunc(ChangeSize);
	glutKeyboardFunc(mykey);
	glutSpecialFunc(SpecialKeyBoard);
	glutDisplayFunc(RenderScene);
	glutMouseFunc(MouseButton);
	glutMotionFunc(MouseMove);
	glutFullScreen();
	glutMainLoop();
	return 0;
}


Email me
Was This Post Helpful? 0
  • +
  • -

#3 X@MPP  Icon User is offline

  • 僕わ馬鹿ですね?
  • member icon

Reputation: 36
  • View blog
  • Posts: 1,014
  • Joined: 20-February 09

Re: graphic plotter

Posted 05 May 2010 - 09:07 PM

Sorry to tell you Wrong Forum. oh and ill check the other topic but i think you posted twice :/
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1