flickering fixed !
This commit is contained in:
parent
b7eae98d0d
commit
222b68c0a3
@ -77,8 +77,8 @@ static void ingame_tick(struct state *state) {
|
||||
|
||||
set_camera(&cam);
|
||||
|
||||
for (int y = 64; --y;)
|
||||
for (int x = 64; --x;) {
|
||||
for (int y = 64; y--;)
|
||||
for (int x = 64; x--;) {
|
||||
float d0 = sample_perlin_2d((t_fvec2){x, y}, 0.2, 5) * 8 - 6;
|
||||
float d1 = sample_perlin_2d((t_fvec2){x + 1, y}, 0.2, 5) * 8 - 6;
|
||||
float d2 = sample_perlin_2d((t_fvec2){x + 1, y - 1}, 0.2, 5) * 8 - 6;
|
||||
|
@ -162,11 +162,11 @@ static void main_loop(void) {
|
||||
|
||||
ctx.frame_accumulator -= ctx.desired_frametime;
|
||||
ctx.tick_count = (ctx.tick_count % ULLONG_MAX) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool initialize(void) {
|
||||
|
@ -121,7 +121,7 @@ static void render_space(void) {
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
/* solid white, no modulation */
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
glColor4ub(255, 255, 255, 255);
|
||||
|
||||
for (size_t i = 0; i < hmlenu(ctx.uncolored_mesh_batches); ++i) {
|
||||
draw_uncolored_space_traingle_batch(&ctx.uncolored_mesh_batches[i].value,
|
||||
|
@ -57,6 +57,7 @@ union uncolored_space_triangle {
|
||||
t_fvec2 uv2; /* in pixels */
|
||||
} primitive;
|
||||
|
||||
/* TODO: have it packed? */
|
||||
/* structure that is passed in opengl vertex array */
|
||||
struct uncolored_space_triangle_payload {
|
||||
t_fvec3 v0;
|
||||
|
@ -67,8 +67,6 @@ static void draw_uncolored_space_traingle_batch(struct mesh_batch *batch,
|
||||
const t_frect srcrect = textures_get_srcrect(&ctx.texture_cache, texture_key);
|
||||
const t_frect dims = textures_get_dims(&ctx.texture_cache, texture_key);
|
||||
|
||||
/* TODO: fast path for uvs mapped directly on srcrect corners? */
|
||||
|
||||
const float wr = srcrect.w / dims.w;
|
||||
const float hr = srcrect.h / dims.h;
|
||||
const float xr = srcrect.x / dims.w;
|
||||
@ -107,7 +105,7 @@ static void draw_uncolored_space_traingle_batch(struct mesh_batch *batch,
|
||||
(void *)offsetof(struct uncolored_space_triangle_payload, uv0));
|
||||
|
||||
/* commit for drawing */
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3 * (int)primitives_len);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3 * (GLint)primitives_len);
|
||||
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
|
Loading…
Reference in New Issue
Block a user