void Game::init(int* argcp, char** argvp) { glutInit(argcp, argvp); glutInitDisplayMode( GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); glutInitWindowSize (480, 480); glutInitContextVersion( 3, 2 ); glutInitContextProfile( GLUT_CORE_PROFILE ); glutCreateWindow ("Ablockalypse"); glutSetWindowTitle("Ablockalypse"); glutSetIconTitle("Ablockalypse"); glewExperimental = GL_TRUE; glewInit (); // do shader stuff here... GLuint program = InitShader( "vshader.glsl", "fshader.glsl" ); glUseProgram( program ); vPosition = glGetAttribLocation( program, "vPosition" ); vColor = glGetAttribLocation( program, "vColor" ); xlate = glGetUniformLocation( program, "xlate" ); initGeometry (paddle); initGeometry (ball); initBricks (); glEnable( GL_DEPTH_TEST ); glClearColor(0, 0, 0, 0); }
INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, INT){ WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"ClassName", NULL }; RegisterClassEx( &wc ); HWND hWnd = CreateWindow( L"ClassName", L"Z Test", WS_OVERLAPPEDWINDOW, 200, 100, 600, 480, GetDesktopWindow(), NULL, wc.hInstance, NULL ); if( SUCCEEDED( init3D( hWnd ) ) ){ //创建场景图形 if( SUCCEEDED( initGeometry() ) ){ //显示窗口 ShowWindow( hWnd, SW_SHOWDEFAULT ); UpdateWindow( hWnd ); //进入消息循环 MSG msg; ZeroMemory( &msg, sizeof(msg) ); while( msg.message!=WM_QUIT ){ if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ){ TranslateMessage( &msg ); DispatchMessage( &msg ); }else{ render(); //渲染场景 } } } } UnregisterClass( L"ClassName", wc.hInstance ); return 0; }
QSysMLAction::QSysMLAction(const QMap<QString, QVariant> &properties, QGraphicsItem *parent) : QAbstractDiagramShape(QSysMLPlugin::staticName(), QSysMLAction::staticItemClass(), properties, parent) { initGeometry(400, 300); textItem()->setTextColorProperty("textColor"); textItem()->setTextProperty("name"); textItem()->setDefaultTextAlignment(Qt::AlignCenter); addProperty("actionType", QDiagramToolkit::String, true, properties.value("actionType")); addProperty("background", QDiagramToolkit::Brush, false, properties.value("background", QColor("wheat"))); addProperty("textColor", QDiagramToolkit::Color, false, properties.value("textColor", QColor("black"))); addProperty("textFont", QDiagramToolkit::Font, false, properties.value("textFont")); addProperty("lineStyle", QDiagramToolkit::Pen, false, properties.value("lineStyle")); addProperty("name", QDiagramToolkit::String, false, "action"); addSizeGripHandle(new QDiagramShapeSizeGripHandle(QDiagramShapeSizeGripHandle::Left, this)); addSizeGripHandle(new QDiagramShapeSizeGripHandle(QDiagramShapeSizeGripHandle::Right, this)); addConnectionPoint(new QSysMLControlConnectionPointIn(this, "controlIn", 0, 1)); addConnectionPoint(new QSysMLControlConnectionPointOut(this, "controlOut", 0, 1)); addConnectionPoint(new QSysMLDataConnectionPointIn(this, "dataIn1", 0, 1)); addConnectionPoint(new QSysMLDataConnectionPointOut(this, "dataOut1", 0, 1)); restoreProperties(properties); }
//------------------------------------------- // Initialisation des resources globales //------------------------------------------- void Renderer::initRessources() { // Initialisation des paramètres OpenGL. { // 1 - Activer le test de profondeur glAssert(glEnable(GL_DEPTH_TEST)); // 2 - Positionner le mode de dessin glAssert(glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)); // Fin du code à écrire } // Viewing parameters initialisation initView(); // Loading or building geometric data. initGeometry(); // Set up lighting initLighting(); // Shaders initialisation initShaders(); }
INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, INT){ WNDCLASSEX wc = {sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L,0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"ClassName", NULL}; RegisterClassEx(&wc); HWND hWnd = CreateWindow(L"ClassName", L"Transform Demo", WS_OVERLAPPEDWINDOW, 200,100,600,500,NULL, NULL, wc.hInstance, NULL); g_hWnd = hWnd; if(SUCCEEDED(initD3D(hWnd))){ if(SUCCEEDED(initGeometry())){ ShowWindow(hWnd, SW_SHOWDEFAULT);//Maximized the window UpdateWindow(hWnd); MSG msg; ZeroMemory(&msg, sizeof(MSG)); while( msg.message!=WM_QUIT ) { if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ){ TranslateMessage( &msg ); DispatchMessage( &msg ); }else{ render(); //Джх╬м╪пн } } } } UnregisterClass(L"ClassName", wc.hInstance); return 0; }
TexturedPlane::TexturedPlane( osg::Vec3 ul, osg::Vec3 ur, osg::Vec3 ll, osg::Vec3 lr, TextureList* tex, int texIndex) : OSGObjectBase() { // Set Corners ul_ = ul; ur_ = ur; ll_ = ll; lr_ = lr; plane_.set(ul_,ur_,ll_); // Init Scale savedScale = this->getScale(); // Link Texture Pointer _textures = tex; _texIndex = texIndex; // Init Geometry initGeometry(_texIndex); this->box.set(ul_,lr_); }
void TextRenderer::init() { initializeOpenGLFunctions(); createFontTexture(); glGenBuffers( 1, vboIds ); initGeometry(); }
Section::Section() { name = " "; init(); initShaders(); initGeometry(); }
void TexturedPlane::createWithTexture(TextureList* tex, int texIndex) { // Link Texture Pointer _textures = tex; _texIndex = texIndex; // Init Geometry initGeometry(_texIndex); }
MapChunk::MapChunk(uint32 ix, uint32 iy) : mIndexX(ix), mIndexY(iy) { mIsAsyncLoaded = false; mIsSyncLoaded = false; mVerticesDirty = false; if (mCubeGeometry == nullptr) { initGeometry(); } }
void MeshViewer::initScene(InitialCameraData &camera_data) { initContext(); initLights(); initMaterial(); initGeometry(); initCamera( camera_data ); preprocess(); }
void Foam::processorCyclicPolyPatch::initMovePoints ( PstreamBuffers& pBufs, const pointField& p ) { // Recalculate geometry initGeometry(pBufs); }
void CascadedShadowMappingRenderer::initRendering() { initCamera( NvCameraXformType::MAIN, nv::vec3f(-15.0f, 5.0f, 15.0f), // position nv::vec3f(0.0f, 0.0f, 0.0f)); // look at point // Setup the light parameters. initLight( nv::vec3f(100.0f, 100.0f, 100.0f), nv::vec3f(0.0f, 0.0f, 0.0f), nv::vec3f(0.0f, 1.0f, 0.0f)); // Load shaders. NvAssetLoaderAddSearchPath("gl4-maxwell/CascadedShadowMapping"); m_cameraProgram = new CameraProgram(); m_cameraProgram->init("shaders/Camera.vert", "shaders/Camera.frag"); m_lightStandardProgram = new LightProgram(); m_lightStandardProgram->init("shaders/Light.vert", "shaders/LightStandard.geom"); m_lightGsCullProgram = new LightProgram(); m_lightGsCullProgram->init("shaders/Light.vert", "shaders/LightGsCull.geom"); m_lightGsMulticastCullProgram = new LightProgram(); m_lightGsMulticastCullProgram->init("shaders/Light.vert", "shaders/LightMulticast.geom"); m_lightFgsMulticastCullProgram = new LightProgram(); m_lightFgsMulticastCullProgram->init("shaders/Light.vert", "shaders/LightFgsMulticast.geom"); m_lightVsOnlyMulticastProgram = new LightVsOnlyProgram(); m_lightVsOnlyMulticastProgram->init("shaders/LightVsOnly.vert"); // Setup geometry. initGeometry(10); // Setup resources for shadow pass. glGenFramebuffers(1, &m_lightFBO); glBindFramebuffer(GL_FRAMEBUFFER, m_lightFBO); glGenTextures(1, &m_lightTex); glBindTexture(GL_TEXTURE_2D_ARRAY, m_lightTex); glTexStorage3D(GL_TEXTURE_2D_ARRAY, LIGHT_TEXUTRE_MIPMAP_LEVELS, GL_DEPTH_COMPONENT32F, LIGHT_TEXTURE_SIZE, LIGHT_TEXTURE_SIZE, MAX_CAMERA_FRUSTUM_SPLIT_COUNT); glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE); glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL); glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, m_lightTex, 0); glBindTexture(GL_TEXTURE_2D, 0); glBindFramebuffer(GL_FRAMEBUFFER, m_app.getMainFBO()); glGetFloatv(GL_MAX_VIEWPORT_DIMS, m_viewportDims._array); }
void SliceRenderer::init() { initializeOpenGLFunctions(); glGenBuffers( 1, &vbo0 ); glGenBuffers( 1, &vbo1 ); glGenBuffers( 1, &vbo2 ); initGeometry(); }
//! [0] GeometryEngine::GeometryEngine() : indexBuf(QOpenGLBuffer::IndexBuffer) { initializeOpenGLFunctions(); // Generate 2 VBOs arrayBuf.create(); indexBuf.create(); // Initializes cube geometry and transfers it to VBOs initGeometry(); }
std::shared_ptr<Tile> TileBuilder::build(TileID _tileID, const TileData& _tileData, const TileSource& _source) { m_selectionFeatures.clear(); auto tile = std::make_shared<Tile>(_tileID, *m_scene->mapProjection(), &_source); tile->initGeometry(m_scene->styles().size()); m_styleContext.setKeywordZoom(_tileID.s); for (auto& builder : m_styleBuilder) { if (builder.second) builder.second->setup(*tile); } for (const auto& datalayer : m_scene->layers()) { if (datalayer.source() != _source.name()) { continue; } for (const auto& collection : _tileData.layers) { if (!collection.name.empty()) { const auto& dlc = datalayer.collections(); bool layerContainsCollection = std::find(dlc.begin(), dlc.end(), collection.name) != dlc.end(); if (!layerContainsCollection) { continue; } } for (const auto& feat : collection.features) { applyStyling(feat, datalayer); } } } for (auto& builder : m_styleBuilder) { builder.second->addLayoutItems(m_labelLayout); } float tileSize = m_scene->mapProjection()->TileSize() * m_scene->pixelScale(); m_labelLayout.process(_tileID, tile->getInverseScale(), tileSize); for (auto& builder : m_styleBuilder) { tile->setMesh(builder.second->style(), builder.second->build()); } tile->setSelectionFeatures(m_selectionFeatures); return tile; }
void GeometryEngine::init() { initializeGLFunctions(); //! [0] // Generate 2 VBOs glGenBuffers(2, vboIds); //! [0] // Initializes geometry and transfers it to VBOs initGeometry(); }
Sphere::Sphere(int n, QOpenGLShaderProgram* program): indexBuf(QOpenGLBuffer::IndexBuffer), vShader(QOpenGLShader::Vertex), fShader(QOpenGLShader::Fragment), material(new DefaultMaterial(program)){ initializeOpenGLFunctions(); this->program = program; // Generate 2 VBOs arrayBuf.create(); indexBuf.create(); initShaders(); tt = 0.0f; delta = 0.01f; int t = n; vertices = 2 * (t + 1) * t; indices = 4 * t * t + 2 * t; vertArray = new VertexData[vertices]; indArray = new GLuint[indices]; double d = (double)M_PI / t; int k = 0; double i = 0.; double j = 0.; srand(time(NULL)); for(int iter = 0; iter <= t; iter++){ double sini = sin(i); double cosi = cos(i); for(int jter = 0; jter < 2 * t; jter++){ QVector3D tmp(sini * cos(j), cosi, sin(j) * sini); vertArray[k++] = {tmp, QVector2D(jter / 2.f / t, (iter + 1.f) / t), tmp}; j += d; } i += d; } k = 0; for(int i = 0; i < t; i++){ for(int j = 0; j < 2 * t; j++){ indArray[k++] = j + (i + 1) * 2 * t; indArray[k++] = j + i * 2 * t; } indArray[k++] = (i + 1) * 2 * t; indArray[k++] = i * 2 * t; } initGeometry(vertArray, indArray, vertices, indices, GL_TRIANGLE_STRIP); }
void PolygonWindow::initialize() { initGeometry(); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearDepthf(1.0f); glDepthFunc(GL_LEQUAL); glEnable(GL_DEPTH_TEST); m_program = new QOpenGLShaderProgram(this); m_program->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/shader/vertshader.glsl"); m_program->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/shader/fragshader.glsl"); m_program->link(); m_posAttr = m_program->attributeLocation("posAttr"); }
void Tile::build(StyleContext& _ctx, const Scene& _scene, const TileData& _data, const DataSource& _source) { // Initialize m_geometry initGeometry(_scene.styles().size()); const auto& layers = _scene.layers(); _ctx.setGlobalZoom(m_id.s); for (auto& style : _scene.styles()) { style->onBeginBuildTile(*this); } DrawRuleMergeSet ruleSet; for (const auto& datalayer : layers) { if (datalayer.source() != _source.name()) { continue; } for (const auto& collection : _data.layers) { if (!collection.name.empty()) { const auto& dlc = datalayer.collections(); bool layerContainsCollection = std::find(dlc.begin(), dlc.end(), collection.name) != dlc.end(); if (!layerContainsCollection) { continue; } } for (const auto& feat : collection.features) { ruleSet.apply(feat, _scene, datalayer, _ctx, *this); } } } for (auto& style : _scene.styles()) { style->onEndBuildTile(*this); } for (auto& geometry : m_geometry) { if (geometry) { geometry->compileVertexBuffer(); } } }
void CombinedNavRenderer::draw() { QColor color = model()->data( model()->index( (int)Fn::Global::BACKGROUND_COLOR_COMBINED, 0 ) ).value<QColor>(); glClearColor( color.redF(), color.greenF(), color.blueF(), 1.0 ); //qDebug() << "combined draw"; glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); setupTextures(); adjustRatios(); GLFunctions::getShader( "slice" )->bind(); // Set modelview-projection matrix GLFunctions::getShader( "slice" )->setUniformValue( "mvp_matrix", m_mvpMatrix ); GLFunctions::getShader( "slice" )->setUniformValue( "u_renderMode", 0 ); initGeometry(); // Tell OpenGL which VBOs to use glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIds[ 0 ] ); glBindBuffer( GL_ARRAY_BUFFER, vboIds[ 1 ] ); setShaderVars(); // Draw cube geometry using indices from VBO 0 glDrawElements( GL_TRIANGLES, 18, GL_UNSIGNED_SHORT, 0 ); bool renderCrosshairs = model()->data( model()->index( (int)Fn::Global::RENDER_CROSSHAIRS, 0 ) ).toBool(); if ( renderCrosshairs ) { GLFunctions::getShader( "crosshair" )->bind(); GLFunctions::getShader( "crosshair" )->setUniformValue( "mvp_matrix", m_mvpMatrix ); QColor ccolor = model()->data( model()->index( (int)Fn::Global::CROSSHAIR_COLOR, 0 ) ).value<QColor>(); GLFunctions::getShader( "crosshair" )->setUniformValue( "u_color", ccolor.redF(), ccolor.greenF(), ccolor.blueF(), 1.0 ); // Tell OpenGL which VBOs to use glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIds[ 2 ] ); glBindBuffer( GL_ARRAY_BUFFER, vboIds[ 3 ] ); // Tell OpenGL programmable pipeline how to locate vertex position data int vertexLocation = GLFunctions::getShader( "crosshair" )->attributeLocation( "a_position" ); GLFunctions::getShader( "crosshair" )->enableAttributeArray( vertexLocation ); glVertexAttribPointer( vertexLocation, 3, GL_FLOAT, GL_FALSE, sizeof( VertexData ), 0 ); glDrawElements( GL_LINES, 12, GL_UNSIGNED_SHORT, 0 ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 ); glBindBuffer( GL_ARRAY_BUFFER, 0 ); } }
bool WaitingForYou::forePlay() { // call parent Buddha::Game::forePlay(); // input handler setInputMessageHandler(new InputMessageHandler); // create modules if (!createModules()) { return false; } Record(Buddha::Logger::getInstancePtr()->getPath()); // if (!setViewport()) { return false; } // // DragAcceptFiles(_hwnd, true); // if (!initGeometry()) { return false; } // if (!createFonts()) { return false; } // // _camera = new Euclid::Camera; _camera->setPosition(Vec3(0.0f, 0.0f, 50.0f)); // _cameraController = new Euclid::CameraControllerThirdPerson(_camera); setProcess(Buddha::eProcess_CreateModules); // return true; }
void TextureMappingWindow::initialize() { initGeometry(); loadShader(); loadGLTexture(); glEnable(GL_TEXTURE_2D); glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glClearDepthf(1.0); glClearColor(0.0f, 0.0f, 0.0f, 0.5f); glDisable(GL_BLEND); glBlendColor(1.0f,1.0f,1.0f,0.5f); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_SRC_ALPHA, GL_ONE); }
CwmMoveFeedback:: CwmMoveFeedback(CwmScreen &screen1) : screen(screen1) { Pixel fg = CwmResourceDataInst->getFeedbackForeground(screen); Pixel bg = CwmResourceDataInst->getFeedbackBackground(screen); CwmColor *color = screen.getColor(fg, bg); CwmFont *font = CwmResourceDataInst->getFeedbackFont(screen); graphics = new CwmGraphics(screen, font, color); //------ feedback_x = 0; feedback_y = 0; initGeometry(); //------ int width, height; std::string max_str = "-8888,-8888"; graphics->getTextSize(max_str, &width, &height); width += 8; height += 8; int x = feedback_x - width /2; int y = feedback_y - height/2; x = std::min(std::max(x, 0), screen.getWidth () - width ); y = std::min(std::max(y, 0), screen.getHeight() - height); xwindow = new CwmWindow(screen, screen.getRoot(), x, y, width, height, 0, CWM_CURSOR_MOVE); xwindow->setBackground(graphics); xwindow->setSaveUnder(true); //------ displayed = FALSE; }
void BinghamRenderer::draw( QMatrix4x4 p_matrix, QMatrix4x4 mv_matrix, int width, int height, int renderMode, PropertyGroup& props ) { if ( renderMode != 1 ) // we are drawing opaque objects { // obviously not opaque return; } setRenderParams( props ); if ( m_orient == 0 ) { return; } m_pMatrix = p_matrix; m_mvMatrix = mv_matrix; initGeometry( props ); QGLShaderProgram* program = GLFunctions::getShader( "qball" ); program->bind(); program->setUniformValue( "u_alpha", 1.0f ); program->setUniformValue( "u_renderMode", renderMode ); program->setUniformValue( "u_canvasSize", width, height ); program->setUniformValue( "D0", 9 ); program->setUniformValue( "D1", 10 ); program->setUniformValue( "D2", 11 ); program->setUniformValue( "P0", 12 ); // Set modelview-projection matrix program->setUniformValue( "mvp_matrix", p_matrix * mv_matrix ); program->setUniformValue( "mv_matrixInvert", mv_matrix.inverted() ); program->setUniformValue( "u_hideNegativeLobes", m_minMaxScaling ); program->setUniformValue( "u_scaling", m_scaling ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIds[ 0 ] ); glBindBuffer( GL_ARRAY_BUFFER, vboIds[ 1 ] ); setShaderVars( props ); glDrawElements( GL_TRIANGLES, m_tris1, GL_UNSIGNED_INT, 0 ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 ); glBindBuffer( GL_ARRAY_BUFFER, 0 ); }
void Game::initBricks () { bricks.clear (); bricks.resize (numBricks); vec3 start (-1.0, 0.75, 0); float xInc = .125; float yInc = .125; for (unsigned i = 0; i < bricks.size (); ++i){ bricks[i] = Brick (start); initGeometry (&bricks[i]); start.x += xInc; if (start.x > (1.0 - bricks[i].size)) { start.x = -1; start.y -= yInc; } } }
QSysMLBlock::QSysMLBlock(const QMap<QString, QVariant> &properties, QGraphicsItem *parent) : QAbstractDiagramShape(QSysMLPlugin::staticName(), QSysMLBlock::staticItemClass(), properties, parent) { initGeometry(400, 300); addProperty("blockType", QDiagramToolkit::String, true, properties.value("blockType")); addProperty("backgroundColor", QDiagramToolkit::Color, false, QColor("white")); addProperty("name", QDiagramToolkit::String, false, "action"); addProperty("textFont", QDiagramToolkit::Font, false, properties.value("textFont")); addSizeGripHandle(new QDiagramShapeSizeGripHandle(QDiagramShapeSizeGripHandle::Left, this)); addSizeGripHandle(new QDiagramShapeSizeGripHandle(QDiagramShapeSizeGripHandle::Right, this)); addConnectionPoint(new QSysMLControlConnectionPointIn(this, "controlIn", 0, 1)); addConnectionPoint(new QSysMLControlConnectionPointOut(this, "controlOut", 0, 1)); addConnectionPoint(new QSysMLDataConnectionPointIn(this, "dataIn1", 0, 1)); addConnectionPoint(new QSysMLDataConnectionPointOut(this, "dataOut1", 0, 1)); restoreProperties(properties); }
bool WaitingForYou::forePlay() { // call parent Buddha::Game::forePlay(); // input handler setInputMessageHandler(new InputMessageHandler); // create modules if (!createModules()) { return false; } Record(Buddha::Logger::getInstancePtr()->getPath()); // if (!setViewport()) { return false; } // DragAcceptFiles(_hwnd, true); // if (!initGeometry()) { return false; } // if (!createFonts()) { return false; } setProcess(Buddha::eProcess_CreateModules); // return true; }
std::shared_ptr<Tile> TileBuilder::build(TileID _tileID, const TileData& _tileData, const DataSource& _source) { auto tile = std::make_shared<Tile>(_tileID, *m_scene->mapProjection(), &_source); tile->initGeometry(m_scene->styles().size()); m_styleContext.setGlobalZoom(_tileID.s); for (auto& builder : m_styleBuilder) { if (builder.second) builder.second->setup(*tile); } for (const auto& datalayer : m_scene->layers()) { if (datalayer.source() != _source.name()) { continue; } for (const auto& collection : _tileData.layers) { if (!collection.name.empty()) { const auto& dlc = datalayer.collections(); bool layerContainsCollection = std::find(dlc.begin(), dlc.end(), collection.name) != dlc.end(); if (!layerContainsCollection) { continue; } } for (const auto& feat : collection.features) { m_ruleSet.apply(feat, datalayer, m_styleContext, *this); } } } for (auto& builder : m_styleBuilder) { tile->getMesh(builder.second->style()) = builder.second->build(); } return tile; }
//Main Method - Entry Point int main(int argc, char * arg[]) { // init everything - SDL, if it is nonzero we have a problem if (SDL_Init(SDL_INIT_EVERYTHING) != 0) { std::cout << "ERROR SDL_Init " << SDL_GetError() << std::endl; return -1; }; InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, false); //Call our InitOpenGL Function initOpenGL(); //Set our viewport setViewport(WINDOW_WIDTH, WINDOW_HEIGHT); //class 2 initGeometry(); SDL_Event event; while (running) { while (SDL_PollEvent(&event)) { //Get event type if (event.type == SDL_QUIT || event.type == SDL_WINDOWEVENT_CLOSE) { //set our boolean which controls the game loop to false running = false; }; }; update(); render(); }; SDL_GL_DeleteContext(glcontext); CleanUp(); return 0; }