Original Post
pretty simple question, how do i toggle full screen with glfw? i tried calling glfwOpenWindow with GLFW_FULLSCREEN passed to it but it doesn't seem to be working. cant find anything that specifys how to toggle fullscreen so im asking here.
here is the code im working with
here is the code im working with
#include <GL/gl.h>#include <GL/glu.h>#include <GL/glfw.h>#include <IL/il.h>#include <IL/ilu.h>#include <IL/ilut.h>#include <irrKlang/irrKlang.h>#include <iostream>#include <fstream>#include <string>#include <deque>#include <boost/timer.hpp>using namespace irrklang;using boost::timer;int main() { glfwInit(); if( !glfwOpenWindow( 512, 512, 8, 8, 8, 8, 8, 8, GLFW_WINDOW ) ) { glfwTerminate(); return 0; } glfwSetWindowTitle("GLFW Application"); ilInit(); iluInit(); ilutInit(); ilutRenderer(ILUT_OPENGL); ISoundEngine* engine = createIrrKlangDevice(); engine->play2D("prondisk.xm", true); glEnable( GL_TEXTURE_2D ); glEnable(GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); int width, height; int frame = 0; bool running = true; ILuint texid; GLuint tex; glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); ilGenImages(1, &texid); ilBindImage(texid); ilLoadImage("Zombie.png"); ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, ilGetInteger(IL_IMAGE_BPP), ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT), 0, ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE, ilGetData()); ilDeleteImages(1, &texid); while(running) { glfwGetWindowSize( &width, &height ); height = height > 0 ? height : 1; glViewport( 0, 0, width, height ); glClearColor( 1.0f, 0.0f, 0.0f, 0.0f ); glClear( GL_COLOR_BUFFER_BIT ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); gluOrtho2D(0,width,height,0); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glBegin(GL_QUADS); glTexCoord2i(0, 0); glVertex2i(0, 0); glTexCoord2i(0, 1); glVertex2i(0, 64); glTexCoord2i(1, 1); glVertex2i(64, 64); glTexCoord2i(1, 0); glVertex2i(64, 0); glTexCoord2i(0, 0); glVertex2i(0, 32); glTexCoord2i(0, 1); glVertex2i(0, 96); glTexCoord2i(1, 1); glVertex2i(64, 96); glTexCoord2i(1, 0); glVertex2i(64, 32); glEnd(); glfwSwapBuffers(); if(glfwGetKey(GLFW_KEY_SPACE)) glfwOpenWindow( width, height, 8, 8, 8, 8, 8, 8, GLFW_FULLSCREEN); running = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam(GLFW_OPENED); } glDeleteTextures(1,&tex); glfwTerminate(); return 0;}