int ParticleWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QGLWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: _glInit(); break; case 1: _mouseDrag((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break; case 2: mouseDragEvent((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break; case 3: redraw(); break; default: ; } _id -= 4; } return _id; }
/** * You need to fill this in. * * Called when this object is first created, to set the initial OpenGL state * required by this lab. Specify your render settings here. */ void ParticleWidget::initializeGL() { glClearColor(0.0f,0.0f,0.0f,0.0f); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); m_emitter = new ParticleEmitter(loadTexture(":/textures/particle3.bmp")); glDisable(GL_DITHER); glDisable(GL_LIGHTING); glClear(GL_ACCUM_BUFFER_BIT); updateCamera(); emit _glInit(); //leave this }
void GLContext::initContext(){ if(!_glfwInit()){ LOG_ERROR("Failed to setup GLFW\n" ); } if(!_glInit()){ LOG_ERROR("Failed to initialize OpenGL\n" ); } core::World::I().cam.setPerspective( GLContext::I().SceneParam.FOV, GLContext::I().SceneParam.AspectRatio, GLContext::I().SceneParam.zNear, GLContext::I().SceneParam.zFar); //TODO: Remove it to coll source load procedure Program = RenderProgram("Lesson"); Program.createShader(GL_VERTEX_SHADER ,"data/lesson.vs"); Program.createShader(GL_FRAGMENT_SHADER ,"data/lesson.fs"); Program.compile(); OPENGL_CHECK_FOR_ERRORS(); }