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

📄 glutsystem.cpp

📁 光滑质点无网格法SPH并行计算程序
💻 CPP
字号:
//      ___                       ___           ___           ___       ___     //     /\__\          ___        /\__\         /\  \         /\__\     /\  \.    //    /::|  |        /\  \      /::|  |       /::\  \       /:/  /    /::\  \.   //   /:|:|  |        \:\  \    /:|:|  |      /:/\:\  \     /:/  /    /:/\:\  \.  //  /:/|:|__|__      /::\__\  /:/|:|  |__   /:/  \:\  \   /:/  /    /::\~\:\  \. // /:/ |::::\__\  __/:/\/__/ /:/ |:| /\__\ /:/__/_\:\__\ /:/__/    /:/\:\ \:\__\.// \/__/~~/:/  / /\/:/  /    \/__|:|/:/  / \:\  /\ \/__/ \:\  \    \:\~\:\ \/__///       /:/  /  \::/__/         |:/:/  /   \:\ \:\__\    \:\  \    \:\ \:\__\.  //      /:/  /    \:\__\         |::/  /     \:\/:/  /     \:\  \    \:\ \/__/  //     /:/  /      \/__/         /:/  /       \::/  /       \:\__\    \:\__\.    //     \/__/                     \/__/         \/__/         \/__/     \/__/    // // =============================================================================//                       Minimalist OpenGL Environment// =============================================================================//// This file is part of Minimalist OpenGL Environment (MinGLE)//// Version: 0.2.0// Author: Balazs Domonkos// Filename: src/GLUT/src/GLUTSystem.cpp// Creation Date: December 12th 2007// Revision Date: December 12th 2007////// The Minimalist OpenGL Environment 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 3 of the License, or (at your// option) any later version.//// The Minimalist OpenGL Environment 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 Minimalist OpenGL Environment.  If not, see // <http://www.gnu.org/licenses/>. See the COPYING file included // with this distribution file for license details.///// @file GLUTSystem.cpp/// GLUT system manager class// Header that contains the declaration#include <GLUTSystem.h>// MinGLE headers#include <Exception.h>// System headers#include <GL/glut.h>// Optional X Windowing system header#include <config_wrapper.h>#ifdef HAVE_X11_XLIB_H#include <X11/Xlib.h>#endifnamespace MinGLE {// Dynamic library loader functionextern "C" void loadDynLib(void) {	// Create GLUT rendering system implementation	System::registerSystemImplementation("glut", new GLUTSystem());}// Dynamic library unloader functionextern "C" void unloadDynLib(void) {	// Nothing to do}GLUTSystem::GLUTSystem() : mWindow(0){}GLUTSystem::~GLUTSystem() {}bool GLUTSystem::_initialize(int *argc, char **argv) {	glutInit(argc, argv);	// Try to get screen resolution from GLUT	mScreenWidth = glutGet(GLUT_SCREEN_WIDTH) ? glutGet(GLUT_SCREEN_WIDTH) : UNKNOWN_RESOLUTION;	mScreenHeight = glutGet(GLUT_SCREEN_HEIGHT) ? glutGet(GLUT_SCREEN_HEIGHT) : UNKNOWN_RESOLUTION;	// Get screen resolution from X#ifdef HAVE_X11_XLIB_H	if(mScreenWidth == UNKNOWN_RESOLUTION || mScreenHeight == UNKNOWN_RESOLUTION)	{		Display *display = XOpenDisplay(0);		int screen = DefaultScreen(display);		mScreenWidth = DisplayWidth(display, screen);		mScreenHeight = DisplayHeight(display, screen);		XCloseDisplay(display);	}#endif	// Successful initialization	return true;}Window* GLUTSystem::_createWindow(		unsigned width, unsigned height,		WindowAttributes::ColorMode colorMode, bool doubleBuffer,		bool fullScreen, unsigned videoRate,		unsigned char *colorBits, unsigned char depthBits,		unsigned char stencilBits, unsigned char *accumColorBits,		unsigned auxBuffers, bool stereo) {	if(!mWindow) {		mWindow = new GLUTWindow(width, height, colorMode, doubleBuffer, fullScreen,				videoRate, colorBits, depthBits, stencilBits, accumColorBits,				auxBuffers, stereo);		// If we have screen sizes position the window 		// to the center of the screen		if(mScreenWidth != UNKNOWN_RESOLUTION && mScreenHeight != UNKNOWN_RESOLUTION)		mWindow->setPosition((mScreenWidth-mWindow->getWidth())>>1,				(mScreenHeight-mWindow->getHeight())>>1);		return mWindow;	}	Except("GLUTSystem::GLUTSystem", "Only one window is allowed in GLUT rendering system. Please use different rendering system. ");	return 0;}void GLUTSystem::_enterMainLoop() {	// At this point of the code no other setting can be performed before	// this window is shown	mWindow->_windowIsReadyToBeShown();	glutMainLoop();}void GLUTSystem::_quit() {	// Delete GLUT rendering system	delete this;}double GLUTSystem::_getTime() {	return 0.001 * glutGet(GLUT_ELAPSED_TIME);}} // namespace MinGLE

⌨️ 快捷键说明

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