Skip to content
Snippets Groups Projects
Commit 23968592 authored by slevy's avatar slevy
Browse files

Oops, make sure image values are treated as *unsigned*, for TXF_INTENSITY.

parent 44416af3
No related branches found
No related tags found
No related merge requests found
......@@ -118,16 +118,18 @@ int txbind( Texture *tx, int *enabled )
if(wanted) {
static float black[4] = {0,0,0,0};
char *txdata = tx->data;
unsigned char *txdata = (unsigned char *)tx->data;
int channels = tx->channels;
if((tx->flags&TXF_INTENSITY) && (channels == 1 || channels == 3)) {
int npix = tx->xsize * tx->ysize;
int k;
char *ip, *op;
unsigned char *ip, *op;
channels++;
txdata = (char *)malloc( npix * channels );
k = npix, ip = tx->data, op = txdata;
txdata = (unsigned char *)malloc( npix * channels );
k = npix;
ip = (unsigned char *)tx->data;
op = txdata;
switch(channels) {
case 2:
do {
......@@ -156,7 +158,7 @@ int txbind( Texture *tx, int *enabled )
GL_UNSIGNED_BYTE,
txdata);
if(txdata != tx->data)
if(txdata != (unsigned char *)tx->data)
free(txdata);
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment