⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 光滑质点无网格法SPH并行计算程序
💻 CPP
字号:
//      ___                       ___           ___           ___       ___     //     /\__\          ___        /\__\         /\  \         /\__\     /\  \.   //    /::|  |        /\  \      /::|  |       /::\  \       /:/  /    /::\  \.  //   /:|:|  |        \:\  \    /:|:|  |      /:/\:\  \     /:/  /    /:/\:\  \. //  /:/|:|__|__      /::\__\  /:/|:|  |__   /:/  \:\  \   /:/  /    /::\~\:\  \.// /:/ |::::\__\  __/:/\/__/ /:/ |:| /\__\ /:/__/_\:\__\ /:/__/    /:/\:\ \:\__\.// \/__/~~/:/  / /\/:/  /    \/__|:|/:/  / \:\  /\ \/__/ \:\  \    \:\~\:\ \/__///       /:/  /  \::/__/         |:/:/  /   \:\ \:\__\    \:\  \    \:\ \:\__\. //      /:/  /    \:\__\         |::/  /     \:\/:/  /     \:\  \    \:\ \/__/  //     /:/  /      \/__/         /:/  /       \::/  /       \:\__\    \:\__\.   //     \/__/                     \/__/         \/__/         \/__/     \/__/    // // =============================================================================//                       Minimalist OpenGL Environment// =============================================================================//// Copyright 2007 Balazs Domonkos// // This program is free software; you can redistribute it and/or// modify it under the terms of the GNU General Public License// as published by the Free Software Foundation; either version 2// of the License, or (at your option) any later version.// // This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.// // You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.//// A simple 'Hello World! application using MinGLE// mingle.h should be included before all other// OpenGL headers#include <mingle.h>using namespace MinGLE;//#include <GL/glut.h> TODO#include <iostream>// Custom window listener that does the renderingclass MyListener : public WindowListener {    protected:		// This method is called when to render		virtual bool onRender() {			// Render a teapot using GLUT			GLUtils::drawGears(0.0);			// True return value means that the event 			// has been fully handled, no further onRender			// methods of other window listeners are called.	    	return true;		}};int main(int argc, char **argv) {	try {    	// Initialize Rendering system    	System::initialize(&argc, argv);    	// Create window    	Window *win = System::createWindow();		// Add navigator		Navigator *navigator = new ExaminerNavigator();		win->registerNavigator(navigator);		// Add keyhandler		ApplicationKeyHandler *keyHandler = new ApplicationKeyHandler();		win->registerWindowListener(keyHandler);    	// Register the window listener    	win->registerWindowListener(new MyListener());    	//win->setFullScreen(true);		    	// Setup OpenGL    	glEnable(GL_DEPTH_TEST);    	glShadeModel(GL_SMOOTH);        	GLfloat position[] = { 3.0f, 3.0f, 3.0f, 1.0f };    	GLfloat diffuse[] = { 0.8f, 0.8f, 0.8f, 1.0f };    	GLfloat specular[] = {1.0f, 1.0f, 1.0f , 1.0f};    	glEnable(GL_LIGHTING);    	glEnable(GL_LIGHT0);    	glLightfv(GL_LIGHT0, GL_POSITION, position);    	glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);    	glLightfv(GL_LIGHT0, GL_SPECULAR, specular);    	// Enter the event handing loop    	System::enterMainLoop();    		} catch(const Exception& e) {		std::cerr << "Error: " << e.mDescription << " (Thrown in " << e.mFile << ':'			<< e.mMethod << " line " << e.mLine << ')' << std::endl;	}    return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -