示例#1
0
GLWidget::GLWidget(const QGLFormat & format, QWidget * parent) : QGLWidget(format, parent),
                                                                 mShaderProgram(this),
                                                                 mViewMatrix(),
                                                                 mProjectionMatrix(){

    float ratio = float(geometry().width())/float(geometry().height());
    mProjectionMatrix.perspective(60, ratio, .1, 100); // ortho(-5,5,-5,5,-5,5);//Orthogonal projection
    mViewMatrix.translate(0.0,0.0,-10.0);

    ModelLoader* loader = ModelFactory::getModelLoader("models/monkey.obj");
    if(loader != NULL){
        objTest = (StaticModel*)loader->loadModel();
    }
    objTest->mModelMatrix.translate(0,0,0);
    delete loader;

    manip = new SphereManipulator("cube manipulator", objTest);
    this->grabKeyboard();
}
void trainingMode(){
	/* *********************      Interface part      **********************/
	/* ********************* **** ************** **** **********************/
	cout << endl << endl;

	cout << " ================== Training mode  =============" << endl;
	cout << " == Enter number of training examples: "; 	cin >> numTrainingExamples;
	cout << " == Enter number of LBFGS iterations: " ; 	cin >> numLbfgsIterations;
	cout << " == Enter lambda: "                     ; 	cin >> lambda;

	/* Checking if input is valid */
	if (numTrainingExamples > 40000) numTrainingExamples = 40000;
	if (numTrainingExamples <= 0) numTrainingExamples = 150;
	if (numLbfgsIterations < 1) numLbfgsIterations = 5;

	/* Reading model */
	//NNModel* model = readModel();
	ModelLoader l;
	NNModel* model = l.loadModel("modelL56.nn");

	trainModel(model);
}