Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/dispmap/dispmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,13 @@ class dispmap_app : public sb7::application
{
switch (key)
{
case GLFW_KEY_KP_ADD: dmap_depth += 0.1f;
case GLFW_KEY_KP_ADD:
case GLFW_KEY_EQUAL:
dmap_depth += 0.1f;
break;
case GLFW_KEY_KP_SUBTRACT: dmap_depth -= 0.1f;
case GLFW_KEY_KP_SUBTRACT:
case GLFW_KEY_MINUS:
dmap_depth -= 0.1f;
break;
case 'F': enable_fog = !enable_fog;
break;
Expand Down
2 changes: 2 additions & 0 deletions src/gsquads/gsquads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,11 @@ class gsquads_app : public sb7::application
mode = key - '1';
break;
case GLFW_KEY_KP_ADD:
case GLFW_KEY_EQUAL:
vid_offset++;
break;
case GLFW_KEY_KP_SUBTRACT:
case GLFW_KEY_MINUS:
vid_offset--;
break;
case 'P': paused = !paused;
Expand Down
2 changes: 2 additions & 0 deletions src/hdrbloom/hdrbloom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,11 @@ class hdrbloom_app : public sb7::application
paused = !paused;
break;
case GLFW_KEY_KP_ADD:
case GLFW_KEY_EQUAL:
exposure *= 1.1f;
break;
case GLFW_KEY_KP_SUBTRACT:
case GLFW_KEY_MINUS:
exposure /= 1.1f;
break;
}
Expand Down
6 changes: 5 additions & 1 deletion src/hdrexposure/hdrexposure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class hdrexposure_app : public sb7::application
glAttachShader(program, fs);

glLinkProgram(program);
exposure_location = glGetUniformLocation(program, "exposure");

glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
Expand All @@ -142,7 +143,7 @@ class hdrexposure_app : public sb7::application
glBindTexture(GL_TEXTURE_2D, texture);
glUseProgram(program);
glViewport(0, 0, info.windowWidth, info.windowHeight);
glUniform1f(0, exposure);
glUniform1f(exposure_location, exposure);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

char buffer[1024];
Expand All @@ -161,9 +162,11 @@ class hdrexposure_app : public sb7::application
switch (key)
{
case GLFW_KEY_KP_ADD:
case GLFW_KEY_EQUAL:
exposure *= 1.1f;
break;
case GLFW_KEY_KP_SUBTRACT:
case GLFW_KEY_MINUS:
exposure /= 1.1f;
break;
}
Expand All @@ -174,6 +177,7 @@ class hdrexposure_app : public sb7::application
GLuint program;
GLuint vao;
float exposure;
GLint exposure_location;
sb7::text_overlay overlay;
};

Expand Down
2 changes: 2 additions & 0 deletions src/hdrtonemap/hdrtonemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ class hdrtonemap_app : public sb7::application
mode = (mode + 1) % 3;
break;
case GLFW_KEY_KP_ADD:
case GLFW_KEY_EQUAL:
exposure *= 1.1f;
break;
case GLFW_KEY_KP_SUBTRACT:
case GLFW_KEY_MINUS:
exposure /= 1.1f;
break;
}
Expand Down
4 changes: 3 additions & 1 deletion src/ktxview/ktxview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class simpletexture_app : public sb7::application
glAttachShader(program, fs);

glLinkProgram(program);
exposure_location = glGetUniformLocation(program, "exposure");

glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
Expand All @@ -130,14 +131,15 @@ class simpletexture_app : public sb7::application

glUseProgram(program);
glViewport(0, 0, info.windowWidth, info.windowHeight);
glUniform1f(0, (float)(sin(t) * 16.0 + 16.0));
glUniform1f(exposure_location, (float)(sin(t) * 16.0 + 16.0));
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

private:
GLuint texture;
GLuint program;
GLuint vao;
GLint exposure_location;
};

DECLARE_MAIN(simpletexture_app);
2 changes: 2 additions & 0 deletions src/raytracer/raytracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,13 @@ void raytracer_app::onKey(int key, int action)
switch (key)
{
case GLFW_KEY_KP_ADD:
case GLFW_KEY_EQUAL:
max_depth++;
if (max_depth > MAX_RECURSION_DEPTH)
max_depth = MAX_RECURSION_DEPTH;
break;
case GLFW_KEY_KP_SUBTRACT:
case GLFW_KEY_MINUS:
max_depth--;
if (max_depth < 1)
max_depth = 1;
Expand Down
8 changes: 6 additions & 2 deletions src/springmass/springmass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,13 @@ class springmass_app : public sb7::application
break;
case 'P': draw_points = !draw_points;
break;
case GLFW_KEY_KP_ADD: iterations_per_frame++;
case GLFW_KEY_KP_ADD:
case GLFW_KEY_EQUAL:
iterations_per_frame++;
break;
case GLFW_KEY_KP_SUBTRACT: iterations_per_frame--;
case GLFW_KEY_KP_SUBTRACT:
case GLFW_KEY_MINUS:
iterations_per_frame--;
break;
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/tesssubdivmodes/tesssubdivmodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ class tesssubdivmodes_app : public sb7::application
glAttachShader(program[i], tes);
glAttachShader(program[i], fs);
glLinkProgram(program[i]);
tess_level_location[i] = glGetUniformLocation(program[i], "tess_level");

glDeleteShader(vs);
glDeleteShader(tcs);
Expand All @@ -200,8 +201,8 @@ class tesssubdivmodes_app : public sb7::application
glClearBufferfv(GL_COLOR, 0, black);

glUseProgram(program[program_index]);
// glUniform1f(0, sinf((float)currentTime) * 5.0f + 6.0f);
glUniform1f(0, 5.3f);
// glUniform1f(tess_level_location[program_index], sinf((float)currentTime) * 5.0f + 6.0f);
glUniform1f(tess_level_location[program_index], 5.3f);
glDrawArrays(GL_PATCHES, 0, 4);
}

Expand Down Expand Up @@ -232,6 +233,7 @@ class tesssubdivmodes_app : public sb7::application
GLuint program[3];
int program_index;
GLuint vao;
GLint tess_level_location[3];
};

DECLARE_MAIN(tesssubdivmodes_app)
4 changes: 3 additions & 1 deletion src/wrapmodes/wrapmodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class wrapmodes_app : public sb7::application
glAttachShader(program, fs);

glLinkProgram(program);
offset_location = glGetUniformLocation(program, "offset");

glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
Expand Down Expand Up @@ -127,7 +128,7 @@ class wrapmodes_app : public sb7::application

for (int i = 0; i < 4; i++)
{
glUniform2fv(0, 1, &offsets[i * 2]);
glUniform2fv(offset_location, 1, &offsets[i * 2]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapmodes[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapmodes[i]);

Expand All @@ -139,6 +140,7 @@ class wrapmodes_app : public sb7::application
GLuint texture;
GLuint program;
GLuint vao;
GLint offset_location;
};

DECLARE_MAIN(wrapmodes_app);