Advertisement

Terrain by Bitmap

Started by November 06, 2000 06:43 AM
3 comments, last by Quaternion 24 years, 2 months ago
I want to create a terrain by reading a gray scale bitmap. But how can I access the color of each pixel in the bitmap? I am using MFC, so I tried CBitmap::GetBitmapBits(DWORD dwCount, LPVOID lpBits), but it doesn''t seem to work... _______________________________________________________ "In C we had to code our own bugs. In C++ we can inherit them."
_______________________________________________________"In C we had to code our own bugs. In C++ we can inherit them."
I know that with the LoadBitmap() funcition or something like that, to set it up with DX you need to create an image buffer. Can you access this buffer with MFC? It can''t be that dissimilar from DX. Then you could access the pixel like this: Buffer[x * y]. You have probably already tried something like this...

--------------------


You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming


You are unique. Just like everybody else.

Yanroy@usa.com

Visit the ROAD Programming Website for more programming help.

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

Advertisement
Isn''t there a GetPixel(x,y); method or something?
We are here just like this,It really doesn't matter why.The world is here like it is,'We could laugh we could cry.Is it good or is it bad,Wright or maybe wrong?There's no use of being sad,Without a purpose within a song.
Not that I know...


_______________________________________________________
"In C we had to code our own bugs. In C++ we can inherit them."
_______________________________________________________"In C we had to code our own bugs. In C++ we can inherit them."
The LoadBitmap API call works with a buffer, so you can access the buffer after with something like:

Buffer[ y * Width + x ];

I don''t remember exactly the call to the function, but I think it returns a pointer to a buffer containing the image.
Not sure though (long time not used LoadBitmap).

<table Height=100 Width=550 CELLPADDING=0 CELLSPACING=10 BACKGROUND="http://tougs.citeweb.net/images/fond-gdn.gif"><tr VALIGN=TOP><td>Programming is: <table CELLPADDING=0 CELLSPACING=0><tr VALIGN=TOP><td>A.<td Width=10><td>The art of debugging a blank sheet of paper (or an empty file).<tr VALIGN=TOP><td>B.<td><td>A pastime similar to banging one''s head against a wall, but with fewer opportunities for reward.<tr VALIGN=TOP><td>C.<td><td>The most fun you can have with your clothes on (although clothes are not mandatory).</table></table>
Now I know what I'm made of, and I'm afraid of it...

This topic is closed to new replies.

Advertisement