Skip to content

Commit b972eec

Browse files
committed
Fix issues with missing preview pictures in webpage generator
1 parent 27316bd commit b972eec

File tree

8 files changed

+31
-17
lines changed

8 files changed

+31
-17
lines changed

fips-files/verbs/webpage.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
]],
1919
[ 'Hello Triangle', 'https://learnopengl.com/Getting-started/Hello-Triangle', '1-4-hello-triangle', [
2020
[ 'triangle', '1-4-1-triangle', '1-triangle.c', '1-triangle.glsl'],
21-
[ 'quad', '1-4-2-quad', '2-quad.c', '1-quad.glsl'],
21+
[ 'quad', '1-4-2-quad', '2-quad.c', '2-quad.glsl'],
2222
[ 'quad-wireframe', '1-4-3-quad-wireframe', '3-quad-wireframe.c', '3-quad-wireframe.glsl']
2323
]],
2424
[ 'Shaders', 'https://learnopengl.com/Getting-started/Shaders', '1-5-shaders', [
@@ -85,7 +85,7 @@
8585
[ 'depth-always', '4-1-1-depth-always', '1-depth-always.c', '1-depth-always.glsl'],
8686
[ 'depth-less', '4-1-2-depth-less', '2-depth-less.c', '2-depth-less.glsl'],
8787
[ 'depth-buffer', '4-1-3-depth-buffer', '3-depth-buffer.c', '3-depth-buffer.glsl'],
88-
[ 'linear-depth-buffer', '4-1-4-linear-depth-buffer', '2-linear-depth-buffer.c', '2-linear-depth-buffer.glsl']
88+
[ 'linear-depth-buffer', '4-1-4-linear-depth-buffer', '4-linear-depth-buffer.c', '4-linear-depth-buffer.glsl']
8989
]],
9090
[ 'Stencil Testing', 'https://learnopengl.com/Advanced-OpenGL/Stencil-testing', '4-2-stencil-testing', [
9191
[ 'object-outlining', '4-2-1-object-outlining', '1-object-outlining.c', '1-object-outlining.glsl'],
@@ -150,7 +150,7 @@
150150
]],
151151
[ 'Point Shadows', 'https://learnopengl.com/Advanced-Lighting/Shadows/Point-Shadows', '5-4-point-shadows', [
152152
[ 'omnidirectional-depth', '5-4-1-omnidirectional-depth', '1-omnidirectional-depth.c', '1-omnidirectional-depth.glsl'],
153-
[ 'omnidirectional-shadows', '5-4-2-omnidirectional-shadows', '2-omnidirectional-shadows.c', '2-omnidirectional-shadows.glsl'],
153+
[ 'omnidir-shadows', '5-4-2-omnidirectional-shadows', '2-omnidirectional-shadows.c', '2-omnidirectional-shadows.glsl'],
154154
[ 'omnidirectional-PCF', '5-4-3-omnidirectional-PCF', '3-omnidirectional-PCF.c', '3-omnidirectional-PCF.glsl'],
155155
]],
156156
[ 'Normal Mapping', 'https://learnopengl.com/Advanced-Lighting/Normal-Mapping', '5-5-normal-mapping', [

src/4-10-instancing/1-instancing.c

+14-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#include "sokol_app.h"
55
#include "sokol_gfx.h"
66
#include "sokol_glue.h"
7-
#define HANDMADE_MATH_IMPLEMENTATION
8-
#define HANDMADE_MATH_NO_SSE
97
#include "../libs/hmm/HandmadeMath.h"
108
#include "1-instancing.glsl.h"
9+
#define LOPGL_APP_IMPL
10+
#include "../lopgl_app.h"
1111
#include "string.h"
1212

1313
/* application state */
@@ -19,10 +19,12 @@ static struct {
1919
} state;
2020

2121
static void init(void) {
22-
// TODO: use lopgl_app ?
23-
sg_setup(&(sg_desc){
24-
.context = sapp_sgcontext()
25-
});
22+
lopgl_setup();
23+
24+
if (sapp_gles2()) {
25+
/* this demo needs GLES3/WebGL because we are using gl_InstanceID in the shader */
26+
return;
27+
}
2628

2729
/* create shader from code-generated sg_shader_desc */
2830
sg_shader shd = sg_make_shader(simple_shader_desc());
@@ -72,6 +74,12 @@ static void init(void) {
7274
}
7375

7476
void frame(void) {
77+
/* can't do anything useful on GLES2/WebGL */
78+
if (sapp_gles2()) {
79+
lopgl_render_gles2_fallback();
80+
return;
81+
}
82+
7583
sg_begin_default_pass(&state.pass_action, sapp_width(), sapp_height());
7684
sg_apply_pipeline(state.pip);
7785
sg_apply_bindings(&state.bind);
@@ -106,7 +114,6 @@ sapp_desc sokol_main(int argc, char* argv[]) {
106114
.event_cb = event,
107115
.width = 800,
108116
.height = 600,
109-
.gl_force_gles2 = true,
110117
.window_title = "Instancing (LearnOpenGL)",
111118
};
112119
}

src/4-10-instancing/2-instanced-arrays.c

+14-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#include "sokol_app.h"
55
#include "sokol_gfx.h"
66
#include "sokol_glue.h"
7-
#define HANDMADE_MATH_IMPLEMENTATION
8-
#define HANDMADE_MATH_NO_SSE
97
#include "../libs/hmm/HandmadeMath.h"
108
#include "2-instanced-arrays.glsl.h"
9+
#define LOPGL_APP_IMPL
10+
#include "../lopgl_app.h"
1111
#include "string.h"
1212

1313
/* application state */
@@ -18,10 +18,12 @@ static struct {
1818
} state;
1919

2020
static void init(void) {
21-
// TODO: use lopgl_app ?
22-
sg_setup(&(sg_desc){
23-
.context = sapp_sgcontext()
24-
});
21+
lopgl_setup();
22+
23+
if (sapp_gles2()) {
24+
/* this demo needs GLES3/WebGL because we are using gl_InstanceID in the shader */
25+
return;
26+
}
2527

2628
/* create shader from code-generated sg_shader_desc */
2729
sg_shader shd = sg_make_shader(simple_shader_desc());
@@ -82,6 +84,12 @@ static void init(void) {
8284
}
8385

8486
void frame(void) {
87+
/* can't do anything useful on GLES2/WebGL */
88+
if (sapp_gles2()) {
89+
lopgl_render_gles2_fallback();
90+
return;
91+
}
92+
8593
sg_begin_default_pass(&state.pass_action, sapp_width(), sapp_height());
8694
sg_apply_pipeline(state.pip);
8795
sg_apply_bindings(&state.bind);
@@ -110,7 +118,6 @@ sapp_desc sokol_main(int argc, char* argv[]) {
110118
.event_cb = event,
111119
.width = 800,
112120
.height = 600,
113-
.gl_force_gles2 = true,
114121
.window_title = "Instanced Arrays (LearnOpenGL)",
115122
};
116123
}
File renamed without changes.

webpage/4-8-1.png

-3 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)