//-------------------------------------------------------
bool CDistortLayer::init()
{
	do{
		CC_BREAK_IF(!CCLayer::init());
		
		m_fMouseX = m_fMouseY = 0.0f;
		m_bIsShake = m_bIsTakeImage = false;
		m_pTexture2D = CCTextureCache::sharedTextureCache()->addImage( s_szCommonBackgroundImgPath );
		m_pMass = NULL;
		m_pSpring = NULL;
		m_nGrab = -1;
		memset( &m_usIndices, 0, GRID_SIZE_X * GRID_SIZE_Y * 6 * sizeof(GLushort) );

		// 自己的初始化
		MyInit();

		// 开启帧更新
		this->scheduleUpdate();
		// 开启Input消息
		this->setTouchEnabled(true);

		return true;
	}while(0);
	return false;
}
int main( int argc, char** argv )
{    
    glutInit( &argc, argv );
    glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutInitWindowSize( winWidth, winHeight );
    glutCreateWindow( "Radiosity Viewer" );

    MyInit();

	// Read model file.
	model = RAD_ReadFile( radiosityModelFilename );

	// Make OpenGL display lists.
	gathererQuadsDList = MakeGathererQuadsDisplayList( &model );
	gathererQuadsNoColorDList = MakeGathererQuadsNoColorDisplayList( &model );

    // Register the callback functions.
    glutDisplayFunc( MyDisplay ); 
    glutReshapeFunc( MyReshape );
    glutKeyboardFunc( MyKeyboard );
	glutMouseFunc( MyMouse );
	glutMotionFunc( MyMotion );

    // Display user instructions in console window.
    printf( "Press 'R' to reset view.\n" );
    printf( "Press 'X' to toggle axes.\n" );
	printf( "Press 'C' to toggle back-face culling.\n" );
    printf( "Press 'S' to cycle thru different drawing styles.\n" );
    printf( "Press 'Q' to quit.\n\n" );

    // Enter GLUT event loop.
    glutMainLoop();
    return 0;
}
Beispiel #3
0
int _tmain(int argc, _TCHAR* argv[])
{

	srand(time(NULL));

	
	
	
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB |GLUT_DEPTH);
    glutInitWindowSize(800, 800);
	
    glutCreateWindow("jajko");
    glutDisplayFunc(RenderScene);
	glutReshapeFunc(ChangeSize);

	glutMouseFunc(Mouse);
// Ustala funkcj? zwrotn? odpowiedzialn? za badanie stanu myszy
   
glutMotionFunc(Motion);
// Ustala funkcj? zwrotn? odpowiedzialn? za badanie ruchu myszy
	//glutIdleFunc(spinEgg);
    MyInit();
    glEnable(GL_DEPTH_TEST);
    glutMainLoop();
   
}
DIALOG_FREEROUTE::DIALOG_FREEROUTE( PCB_EDIT_FRAME* parent ):
    DIALOG_FREEROUTE_BASE( parent )
{
    m_Parent = parent;
    MyInit();

    m_sdbSizer1OK->SetDefault();
    GetSizer()->SetSizeHints( this );
    Centre();
}
Beispiel #5
0
int main (int argc, char ** argv)
{
    glutInit (& argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize (600,600);
    glutInitWindowPosition (200,50);
    glutCreateWindow ("veham");
    glutDisplayFunc (veham);
    MyInit ();
    glutMainLoop ();
    return 0;
}
LabyrinthGLContext::LabyrinthGLContext(wxGLCanvas *canvas)
             : wxGLContext(canvas)
{
    SetCurrent(*canvas);

    wxRect rect = canvas->GetRect();
    m_width = rect.GetWidth();
    m_height = rect.GetHeight();

    MyInit();

    DrawScene();

    CheckGLError();
}
Beispiel #7
0
int _tmain(int argc, _TCHAR* argv[])
{

	srand(time(NULL));

	float u = 0.0, v=0.0;
    
	for(int i=0; i< N; i++)
	{
		for(int j=0; j<N; j++)
		{
			u = (float)i/(N-1);
            v = (float)j/(N-1);
			tab[i][j][0] =(-90 * pow(u,5.0f) + 225*pow(u,4.0f) - 270*pow(u,3.0f)+180*pow(u,2.0f)-45*u)*cos(PI * v) ;
			tab[i][j][1] = 160*pow(u,4.0f) - 320*pow(u,3.0f)+160*pow(u,2.0f) - 5.0;
			tab[i][j][2] = (-90 * pow(u,5.0f) + 225*pow(u,4.0f) - 270*pow(u,3.0f)+180*pow(u,2.0f)-45*u)*sin(PI * v);
		   
		}

	}
	randCol();
	
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB |GLUT_DEPTH);
    glutInitWindowSize(800, 800);
	
    glutCreateWindow("jajko");
    glutDisplayFunc(RenderScene);
	glutReshapeFunc(ChangeSize);
	glutKeyboardFunc(keys);
	glutMouseFunc(Mouse);
// Ustala funkcj? zwrotn? odpowiedzialn? za badanie stanu myszy
   
glutMotionFunc(Motion);
// Ustala funkcj? zwrotn? odpowiedzialn? za badanie ruchu myszy
	//glutIdleFunc(spinEgg);
    MyInit();
    glEnable(GL_DEPTH_TEST);
    glutMainLoop();
   
}
Beispiel #8
0
int main( int argc, char** argv )
{    
    glutInit( &argc, argv );
    glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutInitWindowSize( winWidth, winHeight );
    glutCreateWindow( "Quads Viewer" );

    MyInit();

	// Read model file and subdivide the quads.
	model = QM_ReadFile( inputModelFilename );
	QM_Subdivide( &model, maxShooterQuadEdgeLength, maxGathererQuadEdgeLength );

	// Make OpenGL display lists.
	origQuadsDList = MakeOrigQuadsDisplayList( &model );
	shooterQuadsDList = MakeShooterQuadsDisplayList( &model );
	gathererQuadsDList = MakeGathererQuadsDisplayList( &model );

    // Register the callback functions.
    glutDisplayFunc( MyDisplay ); 
    glutReshapeFunc( MyReshape );
    glutKeyboardFunc( MyKeyboard );
	glutMouseFunc( MyMouse );
	glutMotionFunc( MyMotion );

    // Display user instructions in console window.
    printf( "Press 'R' to reset view.\n" );
    printf( "Press 'X' to toggle axes.\n" );
	printf( "Press 'C' to toggle back-face culling.\n" );
    printf( "Press 'S' to cycle thru different drawing styles.\n" );
	printf( "Press 'M' to cycle thru different types of quads.\n" );
    printf( "Press 'Q' to quit.\n\n" );

    // Enter GLUT event loop.
    glutMainLoop();
    return 0;
}