コード例 #1
0
ファイル: main.cpp プロジェクト: NCCA/FirstShaderQt
int main(int argc, char **argv)
{
  QGuiApplication app(argc, argv);
  // create an OpenGL format specifier
  QSurfaceFormat format;
  // set the number of samples for multisampling
  // will need to enable glEnable(GL_MULTISAMPLE); once we have a context
  format.setSamples(4);
  #if defined( DARWIN)
    // at present mac osx Mountain Lion only supports GL3.2
    // the new mavericks will have GL 4.x so can change
    format.setMajorVersion(4);
    format.setMinorVersion(1);
  #else
    // with luck we have the latest GL version so set to this
    format.setMajorVersion(4);
    format.setMinorVersion(3);
  #endif
  // now we are going to set to CoreProfile OpenGL so we can't use and old Immediate mode GL
  format.setProfile(QSurfaceFormat::CoreProfile);
  // now set the depth buffer to 24 bits
  format.setDepthBufferSize(24);
  QSurfaceFormat::setDefaultFormat(format);
  // now we are going to create our scene window
  OpenGLWindow window;
  // set the window size
  window.resize(1024, 720);
  // and finally show

  window.show();

  return app.exec();
}
コード例 #2
0
ファイル: main.cpp プロジェクト: NCCA/OpenGLCode
int main(int argc, char **argv)
{
  QGuiApplication app(argc, argv);
  // create an OpenGL format specifier
  QSurfaceFormat format;
  // set the number of samples for multisampling
  // will need to enable glEnable(GL_MULTISAMPLE); once we have a context
  format.setSamples(4);
  format.setMajorVersion(3);
  format.setMinorVersion(2);
  // now we are going to set to Compat Profile OpenGL so we can use and old Immediate mode GL
  format.setProfile(QSurfaceFormat::CompatibilityProfile);
  // now set the depth buffer to 24 bits
  format.setDepthBufferSize(24);
  QSurfaceFormat::setDefaultFormat(format);
  // now we are going to create our scene window
  OpenGLWindow window;
  // we can now query the version to see if it worked
  std::cout<<"Profile is "<<format.majorVersion()<<" "<<format.minorVersion()<<"\n";
  // set the window size
  window.resize(1024, 720);
  // and finally show
  window.show();

  return app.exec();
}
コード例 #3
0
ファイル: Main.cpp プロジェクト: Magnussr/JamieKingTutorial
/*Function that runs the program that takes inn 2 arguments. argc(argument count) and argv (argument vector) are how command line arguments are passed to main().
argc is an integer parameter and it is the number of arguments passed to the program.
Program name is always the first argument, so there will be at least one argument to a program and minimum value of argc will be 1.
But if a program has itself 2 arguments the value of argc will be 3.
Parameter argv points to a string array and is called the "argument vector". It is a one dimensional string array of function arguments.*/
int main(int argc, char* argv[]){

	/*Useing QApplication function and calls it app that thakes inn 2 arguments argc, argv*/
	QApplication app(argc, argv);

	/*Useing OpenGLWindow Class and call it window*/
	OpenGLWindow window;

	/*Useing .show to show openGLWindow*/
	window.show();

	/*returns app and .exec funtion execute a new executable*/
	return app.exec();
}