View Single Post
Posts: 3 | Thanked: 1 time | Joined on Feb 2010
#9
try his one: (comment out the function call glTexImage2D(...), uncomment the free(...)
Code:
int i, j;
GLubyte* pixels8888 = surfaceRGBA->pixels;
GLushort * pixels4444 = 
    malloc(sizeof(GLushort) * surfaceRGBA -> w * surfaceRGBA -> h);

for (i = 0; i < surfaceRGBA -> w * surfaceRGBA -> h; i++) {
    j = i << 2;
    pixels4444[i] = (pixels8888[j+3] >> 4) 
                    + ((pixels8888[j+2] >> 4) << 4) 
                    + ((pixels8888[j+1] >> 4) << 8) 
                    + ((pixels8888[j] >> 4) << 12);
}

// glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surfaceRGBA->w, surfaceRGBA->h, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, pixels4444);

free(pixels4444);
if it works, you know where to search....
 

The Following User Says Thank You to manu_dibango For This Useful Post: