This commit is contained in:
Nishi 2026-01-12 01:22:25 +09:00
commit 472e21e389
Signed by: nishi
GPG key ID: 27EF69B208EB9343
2 changed files with 4 additions and 23 deletions

View file

@ -5,25 +5,6 @@
#include <stb_image.h>
void GBGLTexturePrepare(GBGL gl, GLuint* texture, unsigned char* rgba, int width, int height) {
int y;
/* image gets flipped here... because opengl coord system is quite confusing */
for(y = 0; y < height / 2; y++) {
int x;
for(x = 0; x < width; x++) {
int p;
for(p = 0; p < 4; p++) {
unsigned char* s1 = &rgba[(y * width + x) * 4 + p];
unsigned char* s2 = &rgba[((height - 1 - y) * width + x) * 4 + p];
unsigned char p1 = *s1;
unsigned char p2 = *s2;
*s2 = p1;
*s1 = p2;
}
}
}
glGenTextures(1, texture);
glBindTexture(GL_TEXTURE_2D, *texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgba);

View file

@ -46,13 +46,13 @@ void GBSkyBoxDraw(GBSkyBox skybox) {
GBVector2 t[4];
GBNumber s = 0.0001;
t[0][0] = 0, t[0][1] = 1;
t[0][0] = 0, t[0][1] = 0;
t[1][0] = 0, t[1][1] = 0;
t[1][0] = 0, t[1][1] = 1;
t[2][0] = 1, t[2][1] = 0;
t[2][0] = 1, t[2][1] = 1;
t[3][0] = 1, t[3][1] = 1;
t[3][0] = 1, t[3][1] = 0;
GBGLIgnoreDepth(gl);
GBGLShadowDisable(gl);