Solved

Loading a 32 bit bitmap

Posted on 2004-04-19
2
206 Views
Last Modified: 2013-12-26
Translation to 32 bit instead of 24 please:

Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, 3,
NWidth, NHeight,
Gl.GL_BGR_EXT, Gl.GL_UNSIGNED_BYTE,
pViewOfFile1);
0
Comment
Question by:rossryan
  • 2
2 Comments
 
LVL 4

Accepted Solution

by:
void_main earned 500 total points
ID: 10897398
typedef struct pixel_32bit_s
{
   unsigned char r, g, b, alpha;
} pixel_32bit_t;

typedef struct pixel_24bit_s
{
   unsigned char r, g, b;
} pixel_24bit_t;

to convert it do the following:

for each pixel
{
   pixel32.r = pixel24.r;
   pixel32.g = pixel24.g;
   pixel32.b = pixel24.g;
   pixel32.alpha = 0;
}

thats it.
(to use 16 bit [obsolete] each r, g and b has 5 bits and there is a padding bit)

regards
void_main
0
 
LVL 4

Expert Comment

by:void_main
ID: 10915645
Small mistake:
it should be this

pixel32.b = pixel24.b;
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Doesn't seem logical 8 233
Compile GLUT with Visual Studio 2015 1 174
Game Asset Design and Performance. 7 167
What are tutor.com most needed tutors? 3 66
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question