int Renderer::initialize(){ windowWidth = 1024; windowHeight = 768; //TODO: Get this from settings file sdl_surface = SDL_SetVideoMode(windowWidth, windowHeight, 32, SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER | SDL_OPENGL); if(sdl_surface == NULL) { return 0; } //Initialize GLEW (support for OpenGL 2.0 and higher) if(glewInit() != GLEW_OK || !GLEW_VERSION_2_0 ){ std::cout << "ERROR: OpenGL 2.0 is not supported.\n"; return 0; } //Initalize OpenGL settings glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClearDepth(1.0); //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); //glEnable(GL_BLEND); //glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA); //glAlphaFunc(GL_ONE, GL_SRC_ALPHA); glViewport(0, 0, (GLsizei)windowWidth, (GLsizei)windowHeight); GenerateProjectionMatrix(); //TODO: Initialize shaders return 1; }
bool LightLx::Initialize(ID3D11Device* device) { HRESULT hr; hr = GenerateViewMatrix(); if (FAILED(hr)) { return false; } hr = GenerateProjectionMatrix(); if (FAILED(hr)) { return false; } return true; }