c++ - Full screen in openGL -
i trying render opengl window in fullscreen , using nehe tutorials learn how this. have reached point using exact same code in both example code given , own code, when reaches line:
if (changedisplaysettings(&dmscreensettings,cds_fullscreen)!=disp_change_successful)
this doesn't evaluate true in code, though in example code given. more confusing while de-bugging same point.
is there simple i'm missing such in project properties, or if not, advise me on other ways of creating full screen window.
nehe tutorial using: http://nehe.gamedev.net/tutorial/creating_an_opengl_window_%28win32%29/13001/
if you're learning, try using glut. can create window in few lines, , can mess opengl code, until you're comfortable enough try out platform specific apis doing such winapi.
you'll need install freeglut (implementation of outdated glut), , glew (for ease of using opengl 1.1+ functions because microsoft's gl.h
hasn't been updated since then)
bare minimum code:
#define freeglut_static // defined can link freeglut_static.lib when compiling #define glew_static // defined can link glew's static .lib when compiling #include <gl/glew.h> // has included before gl.h, or header includes gl.h #include <gl/freeglut.h> void draw() { // code rendering here glutswapbuffers(); // swapping image buffer double buffering glutpostredisplay(); // redrawing. omit line if don't want constant redraw } int main(int argc, char** argv) { glutinit(&argc, argv); glutinitdisplaymode(glut_double | glut_rgba); // enabling double buffering , rgba glutinitwindowsize(600, 600); glutcreatewindow("opengl"); // creating window glutfullscreen(); // making window full screen glutdisplayfunc(draw); // draw function redrawing screen glutmainloop(); return 0; }
Comments
Post a Comment