19. OpenGL Fullscreen Mode
In this opengl tutorial I will be teaching you how to set your games form ta reda pรฅ mer hรคr into fullscreen mode using glut. This is often used to increase the amount of frames per second in a game, along with setting the quality of the picture. A lower resolution in fullscreen mode means a worse looking picture. Fullscreen mode in GLUT is probably one of the easiest things you can do
just before you call the line to enter glut fullscreen mode you choose
which settings to use when in glut fullscreen mode.
Such as the resolution,
color depth and the refresh rate.
we do this with:
glutGameModeString( “990×768:32@75” );
this is setting the resolution to 990×768, you can also use 800×600, 640×480, etc
next it is saying to use a color depth of 32 bits, you can also use 24, 16, 8, etc
then it is telling the program to run the screen refresh rate at 75hertz, others are 65, 70, 80, 85, etc
after that when then tell GLUT to enter the fullscreen mode which it callse Game Mode.
we do this with:
glutEnterGameMode();
then when we want to exit the program we say:
glutLeaveGameMode(); to set the screen back to how it was
and that was it. simple wasn’t it?
If you have any questions, just email me at swiftless@gmail.com ๐
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. |
#include <GL/gl.h> #include <GL/glut.h> #include <stdlib.h> #include <math.h> //angle of rotation //draw the cubes, they make a fancy shape from above ๐ { glTranslated(1, 0, 1); glPushMatrix(); glutSolidCube(2); //draw the cube glPopMatrix(); } } void init (void) { void camera (void) { void display (void) { void reshape (int w, int h) { void keyboard (unsigned char key, int x, int y) { if (key==‘z’) if (key==‘w’) if (key==‘s’) if (key==‘d’) if (key==‘a’) int main (int argc, char **argv) {
|