fix
This commit is contained in:
parent
57685ed075
commit
472e21e389
2 changed files with 4 additions and 23 deletions
|
|
@ -5,25 +5,6 @@
|
||||||
#include <stb_image.h>
|
#include <stb_image.h>
|
||||||
|
|
||||||
void GBGLTexturePrepare(GBGL gl, GLuint* texture, unsigned char* rgba, int width, int height) {
|
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);
|
glGenTextures(1, texture);
|
||||||
glBindTexture(GL_TEXTURE_2D, *texture);
|
glBindTexture(GL_TEXTURE_2D, *texture);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgba);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgba);
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,13 @@ void GBSkyBoxDraw(GBSkyBox skybox) {
|
||||||
GBVector2 t[4];
|
GBVector2 t[4];
|
||||||
GBNumber s = 0.0001;
|
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);
|
GBGLIgnoreDepth(gl);
|
||||||
GBGLShadowDisable(gl);
|
GBGLShadowDisable(gl);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue