Archived

This topic is now archived and is closed to further replies.

MatuX

How do I use 16-bpp surfaces?

Recommended Posts

Yep, the classic question.. I don''t need to make it clearer than original''s Fredrik Andersson post, so.. : I got a problem with 16-bits-per-pixel DirectDraw surfaces. : When I try to use the Lock() function to put individual : pixels in my 16bpp surface, they all go to the left half : of the surface. Also, they get strange, random-looking colors. : I tried to use the RGB macro, but it dosen''t help. : As far as I see, the Lock() function returns an : 8-bit pointer (char*). Can that be used in 16bpp surfaces? : Can I use RGB values to specify pixels in a 16bpp : surface as well? Which mode would you recommend? : I will be very happy for any help I get! Thanks! I already readed both responses from Dennis Muller and Nick Caldwell the first example is absolutely incomplete (or maybe explorer screwed up things?!) and the second one doesn''t makes sense to me at all Please, I need help!!!!! I can''t understand this stuff at all, and it would take me forever to do the shifting (actually, I''ll die without having solved the problem...). Where is that damn function that converts RGB values to the chars you need to add in the locked array?? Thanks!!!

Share this post


Link to post
Share on other sites
Just shift the X position of the of the pixel you want to plot left (effectively multiplying it by 2). This accounds for the fact that you are using a word value for each pixel and not a char. To make sure that I''m not offbase, can you show me your code?

Share this post


Link to post
Share on other sites
16bits surfaces returns a char *, not a word. That is where the problem is...

What code do you want me to show? There is no code at all!

Specifically, locking a 16bit surface returns something like a pointer to an array of pixels where the color information is stored. And since I don''t know more than that, and my problem is very specifical, I can''t explain further...

The question is damn simple! How do I manipulate *16bit locked surfaces*????

Share this post


Link to post
Share on other sites