Commits

Jason McKesson committed 0b2980a

Tut16: SRGB framebuffer rendering active.

Comments (0)

Files changed (1)

Tut 16 Gamma and Textures/Gamma Landscape.cpp

 bool g_drawGammaProgram = false;
 bool g_bDrawCameraPos = false;
 
+bool g_useGammaDisplay = false;
+
 //Called to update the display.
 //You should call glutSwapBuffers after all of your rendering to display what you rendered.
 //If you need continuous updates of the screen, call glutPostRedisplay() at the end of the function.
 	glClearColor(0.75f, 0.75f, 1.0f, 1.0f);
 	glClearDepth(1.0f);
 	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+	if(g_useGammaDisplay)
+		glEnable(GL_FRAMEBUFFER_SRGB);
+	else
+		glDisable(GL_FRAMEBUFFER_SRGB);
 
 	if(g_pSphere && g_pTerrain)
 	{
 		g_drawGammaProgram = !g_drawGammaProgram;
 		break;
 	case 32:
-		g_drawGammaProgram = !g_drawGammaProgram;
+		g_useGammaDisplay = !g_useGammaDisplay;
 		break;
 	case 't': g_bDrawCameraPos = !g_bDrawCameraPos; break;
 	}
 	g_viewPole.CharPress(key);
 }
 
-unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode | GLUT_SRGB;}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.