Paladin_VB
asked on
Loading Bitmap into GLubyte Array
Please could someone show me or provide me with the source code to load a bitmap into a GLubyte Array
So the actual bitmap image is in GLubyte[] , so I can edited it .
I am trying to make a game with destructable terrain which can be loaded from bitmaps :) . Any other hints on how to edit it in realtime , would be useful .
Ps. as you obviously have worked out I am using OpenGL .
Lots of thanks in advance,
Paladin
So the actual bitmap image is in GLubyte[] , so I can edited it .
I am trying to make a game with destructable terrain which can be loaded from bitmaps :) . Any other hints on how to edit it in realtime , would be useful .
Ps. as you obviously have worked out I am using OpenGL .
Lots of thanks in advance,
Paladin
ASKER
So how do i find the size of the bitmap ?
point boost 25 :P
point boost 25 :P
Oh, that's easy, e.g.
#include <sys/types.h>
#include <sys/stat.h>
struct _stat st;
_stat("c:\\tmp\\myfile.bmp ",&st);
DWORD dwSize = st.st_size;
#include <sys/types.h>
#include <sys/stat.h>
struct _stat st;
_stat("c:\\tmp\\myfile.bmp
DWORD dwSize = st.st_size;
ASKER
Wowh that was fast !!!! Thanks :)
ASKER
How do i find the value which should be put in MAX_SIZE ? and how do i find the dimensions of the bitmap ??
+20 :P
+20 :P
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
// Use LoadImage() to get the image loaded into a DIBSection
HBITMAP hBitmap = (HBITMAP)LoadImage( NULL, szFileName, IMAGE_BITMAP, 0, 0,
LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE );
GLubyte ab [MAX_SIZE]; // size should be the size of the .bmp file
GetBitmapBits(hBitmap,MAX_