Hey Mummy,
I try the flags without success. Only half image shows up. The colors seem to be right, but the pixels are in wrong order.
(We do the same thing.)
Gandalf the White
Edited by - Gandalf on June 20, 2000 5:22:07 AM
Loading a bitmap in OpenGL
Just write "source" inside "[]" before the source code. Look at my reply.
Gandalf the White
Edited by - Gandalf on June 20, 2000 5:26:27 AM
Gandalf the White
Edited by - Gandalf on June 20, 2000 5:26:27 AM
Sorry Gandalf,
It was the forum it always/often makes "data" out of "data(i)", it seems that /i is a html command.
I never had to face these problems because I use Raw files. Are you sure that your ICD supports GL_BGR ?
Edited by - TheMummy on June 20, 2000 5:37:23 AM
It was the forum it always/often makes "data" out of "data(i)", it seems that /i is a html command.
I never had to face these problems because I use Raw files. Are you sure that your ICD supports GL_BGR ?
Edited by - TheMummy on June 20, 2000 5:37:23 AM
Yes, my computer support GL_EXT_bgra. I have checked. You seems to have problem with the "[]" think!
Gandalf the White
Gandalf the White
quote:Original post by Gandalf
I´m using 24 bits bitmaps. The texture not just looking ugly, it must be something wrong with the color bytes. But I can recognise my original image. Switch from RGB to BGR? Something like this, or what?unsigned char temp;for(int i=0; i<(256*256*3); i++)if(i%2==0 && i>=2) { temp = data ; data<i> = data[i-2]; data[i-2] = temp;} [/source] My texture still looking bad.Gandalf the White<BR>Edited by - Gandalf on June 20, 2000 3:46:36 AM <hr height=1 noshade></BLOCKQUOTE></font> To switch BGR to RGB:[source] unsigned char *data; // you allocated & filled that bufferunsigned char temp;for( int i=0; i<(256*256*3); i+=3){ temp = data<i>; data[i] = data[i+2]; data[i+2] = temp;}
Regards
quote:Original post by Gandalf
Here is little codeHBITMAP bitmap = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURC(IDB_BITMAP3));unsigned char *data;GetBitmapBits(bitmap, 256*256*3, &data);glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, &data);
I don´t get a error but the bitmap look very ugly!
Gandalf the White
Edited by - Gandalf on June 19, 2000 4:23:18 AM
Seems the formatting did not work as I expected in the previous post .
However...
Gandalf, I checked your first posts and fell on that bit of code. I wonder if you wrote that in your program, because it seems the last glTexImage2D argument is not correct: it expects an ''unsigned char*''. Using &data you give it an ''unsigned char**''.
That was a ugly brain bug! Now that´s changed and the problem still exist!
Gandalf the White, witch codes with the sunglasses on
Edited by - Gandalf on June 21, 2000 6:04:22 AM
Gandalf the White, witch codes with the sunglasses on
Edited by - Gandalf on June 21, 2000 6:04:22 AM
Did you change the &data argument to data in the GetBitmapBits function call ? ''cause it''s the same problem...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement