void MyGLWidget::initializeGL() { // Start Of User Initialization m_angle = 0.0f; // Set Starting Angle To Zero m_blurTexture = emptyTexture();// Create Our Empty Texture glViewport(0 , 0, this->size().width() , this->size().height());// Set Up A Viewport glMatrixMode(GL_PROJECTION);// Select The Projection Matrix glLoadIdentity();// Reset The Projection Matrix gluPerspective(50, (float)this->size().width()/(float)this->size().height(), 5, 2000);// Set Our Perspective glMatrixMode(GL_MODELVIEW);// Select The Modelview Matrix glLoadIdentity();// Reset The Modelview Matrix glEnable(GL_DEPTH_TEST);// Enable Depth Testing GLfloat global_ambient[4]={0.2f, 0.2f, 0.2f, 1.0f};// Set Ambient Lighting To Fairly Dark Light (No Color) GLfloat light0pos[4]={0.0f, 5.0f, 10.0f, 1.0f};// Set The Light Position GLfloat light0ambient[4]= {0.2f, 0.2f, 0.2f, 1.0f};// More Ambient Light GLfloat light0diffuse[4]= {0.3f, 0.3f, 0.3f, 1.0f};// Set The Diffuse Light A Bit Brighter GLfloat light0specular[4]={0.8f, 0.8f, 0.8f, 1.0f};// Fairly Bright Specular Lighting GLfloat lmodel_ambient[]= {0.2f,0.2f,0.2f,1.0f};// And More Ambient Light glLightModelfv(GL_LIGHT_MODEL_AMBIENT,lmodel_ambient);// Set The Ambient Light Model glLightModelfv(GL_LIGHT_MODEL_AMBIENT, global_ambient);// Set The Global Ambient Light Model glLightfv(GL_LIGHT0, GL_POSITION, light0pos);// Set The Lights Position glLightfv(GL_LIGHT0, GL_AMBIENT, light0ambient);// Set The Ambient Light glLightfv(GL_LIGHT0, GL_DIFFUSE, light0diffuse);// Set The Diffuse Light glLightfv(GL_LIGHT0, GL_SPECULAR, light0specular);// Set Up Specular Lighting glEnable(GL_LIGHTING);// Enable Lighting glEnable(GL_LIGHT0);// Enable Light0 glShadeModel(GL_SMOOTH);// Select Smooth Shading glMateriali(GL_FRONT, GL_SHININESS, 128); glClearColor(0.0f, 0.0f, 0.0f, 0.5);// Set The Clear Color To Black }
Button::Button(vec2 pos, vec2 size, string name) : GameObject(pos, "green", size.x, size.y) { this->name = name; if (name != "Invisible") loadBMP(name); else emptyTexture(); }
void PostProcessingFX::init(FXTypes type) { enabled[(int)type] = true; if (type == FXT_RADIALBLUR) blurTexture = emptyTexture(); }