Skip to content

Instantly share code, notes, and snippets.

@hikiko
Created July 22, 2020 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hikiko/7f1a621aa879ffbf1f600c280ab83557 to your computer and use it in GitHub Desktop.
Save hikiko/7f1a621aa879ffbf1f600c280ab83557 to your computer and use it in GitHub Desktop.
note to myself
struct {
float z;
uint32_t zs;
} *pixels;
int i;
pixels = calloc(w * h, 8);
glGetTextureImage(vkgl_depth_tex, 0,
GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
w * h * 8,
pixels);
FILE *fp;
fp = fopen("foobar.txt", "wb");
for (i = 0; i < w * h; i++) {
fprintf(fp, "%f %u\n", pixels[i].z, (unsigned int)pixels[i].zs);
}
fclose(fp);
└─ $ ▶ cat foobar.txt | awk '{print $2}' | sort | uniq
└─ $ ▶ cat foobar.txt | awk '{print $1}' | sort | uniq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment