Jason McKesson avatar Jason McKesson committed f314aea

Tutorials can now override GLUT display mode params.

Comments (0)

Files changed (43)

Tut 01 Hello Triangle/tut1.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 02 Playing with Colors/FragPosition.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 02 Playing with Colors/VertexColors.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 03 OpenGLs Moving Triangle/cpuPositionOffset.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 03 OpenGLs Moving Triangle/fragChangeColor.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 03 OpenGLs Moving Triangle/vertCalcOffset.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 03 OpenGLs Moving Triangle/vertPositionOffset.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 04 Objects at Rest/AspectRatio.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 04 Objects at Rest/MatrixPerspective.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 04 Objects at Rest/OrthoCube.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 04 Objects at Rest/ShaderPerspective.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 05 Objects in Depth/BaseVertexOverlap.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 05 Objects in Depth/DepthBuffer.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 05 Objects in Depth/DepthClamping.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 05 Objects in Depth/DepthFighting.cpp

 	glutPostRedisplay();
 }
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 05 Objects in Depth/OverlapNoDepth.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 05 Objects in Depth/VertexClipping.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 06 Objects in Motion/Hierarchy.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 06 Objects in Motion/Rotations.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 06 Objects in Motion/Scale.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 06 Objects in Motion/Translation.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 07 World in Motion/World Scene.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 07 World in Motion/World With UBO.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 08 Getting Oriented/CameraRelative.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 08 Getting Oriented/GimbalLock.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 08 Getting Oriented/Interpolation.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 08 Getting Oriented/QuaternionYPR.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 09 Lights on/Ambient Lighting.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 09 Lights on/Basic Lighting.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 09 Lights on/Scale and Lighting.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 10 Plane Lights/Fragment Attenuation.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 10 Plane Lights/Fragment Point Lighting.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 10 Plane Lights/Vertex Point Lighting.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 11 Shinies/Blinn vs Phong Lighting.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 11 Shinies/Gaussian Specular Lighting.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 11 Shinies/Phong Lighting.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 12 Dynamic Range/Gamma Correction.cpp

 {
 	std::vector<GLuint> shaderList;
 
-    printf("A!\n");
 	shaderList.push_back(Framework::LoadShader(GL_VERTEX_SHADER, strVertexShader));
-    printf("A2!\n");
 	shaderList.push_back(Framework::LoadShader(GL_FRAGMENT_SHADER, strFragmentShader));
 
-    printf("B!\n");
 	ProgramData data;
 	data.theProgram = Framework::CreateProgram(shaderList);
 	data.modelToCameraMatrixUnif = glGetUniformLocation(data.theProgram, "modelToCameraMatrix");
 
 	data.normalModelToCameraMatrixUnif = glGetUniformLocation(data.theProgram, "normalModelToCameraMatrix");
 
-    printf("C!\n");
 	GLuint materialBlock = glGetUniformBlockIndex(data.theProgram, "Material");
 	GLuint lightBlock = glGetUniformBlockIndex(data.theProgram, "Light");
 	GLuint projectionBlock = glGetUniformBlockIndex(data.theProgram, "Projection");
 //Called after the window and OpenGL are initialized. Called exactly once, before the main loop.
 void init()
 {
-    printf("Top;\n");
 	InitializePrograms();
 
-    printf("Scene\n");
 	try
 	{
 		g_pScene = new Scene();
 		throw;
 	}
 
-    printf("Setup\n");
 	SetupHDRLighting();
 
 	g_lights.CreateTimer("tetra", Framework::Timer::TT_LOOP, 2.5f);
 
-    printf("Glutfuncs\n");
 	glutMouseFunc(MouseButton);
  	glutMotionFunc(MouseMotion);
 	glutMouseWheelFunc(MouseWheel);
 
-    printf("Simple\n");
 	glEnable(GL_CULL_FACE);
 	glCullFace(GL_BACK);
 	glFrontFace(GL_CW);
 	glDepthRange(depthZNear, depthZFar);
 	glEnable(GL_DEPTH_CLAMP);
 
-    printf("UBO setup\n");
 	//Setup our Uniform Buffers
 	glGenBuffers(1, &g_lightUniformBuffer);
 	glBindBuffer(GL_UNIFORM_BUFFER, g_lightUniformBuffer);
 	glBindBuffer(GL_UNIFORM_BUFFER, g_projectionUniformBuffer);
 	glBufferData(GL_UNIFORM_BUFFER, sizeof(ProjectionBlock), NULL, GL_DYNAMIC_DRAW);
 
-    printf("Bind static\n");
 	//Bind the static buffers.
 	glBindBufferRange(GL_UNIFORM_BUFFER, g_lightBlockIndex, g_lightUniformBuffer,
 		0, sizeof(LightBlock));
 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 12 Dynamic Range/HDR Lighting.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 12 Dynamic Range/Scene Lighting.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 13 Impostors/BasicImpostor.cpp

 	g_mousePole.GLUTKeyOffset(key, 5.0f, 1.0f);
 }
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 13 Impostors/GeomImpostor.cpp

 	g_mousePole.GLUTKeyOffset(key, 5.0f, 1.0f);
 }
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

Tut 14 Textures Are Not Pictures/Perspective Interpolation.cpp

 }
 
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height) {return displayMode;}

framework/framework.cpp

 void reshape(int w, int h);
 void keyboard(unsigned char key, int x, int y);
 
+unsigned int defaults(unsigned int displayMode, int &width, int &height);
 
 int main(int argc, char** argv)
 {
 	glutInit(&argc, argv);
-	glutInitDisplayMode (GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH | GLUT_STENCIL/* | GLUT_MULTISAMPLE | GLUT_SRGB*/);
+
+	int width = 500;
+	int height = 500;
+	unsigned int displayMode = GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH | GLUT_STENCIL;
+	displayMode = defaults(displayMode, width, height);
+
+	glutInitDisplayMode (displayMode);
 	glutInitContextVersion (3, 3);
 	glutInitContextProfile(GLUT_CORE_PROFILE);
 #ifdef DEBUG
 	glutInitContextFlags(GLUT_DEBUG);
 #endif
-	glutInitWindowSize (500, 500); 
+	glutInitWindowSize (width, height); 
 	glutInitWindowPosition (300, 200);
 	glutCreateWindow (argv[0]);
 
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.