Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / DirectDraw help needed! Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
charly

September 02, 1999, 12:16 PM

This isn't any 3d question, but I think this fit's here quite well(at least I hope so).
Well I've started to use Ddraw(and I'll use d3d in the future). I can set fullscreen and
create surfaces and flip them and blit and all that stuff, but one thing I can't do is a simple
demo effect. Well my problem is that where should I write what and how when I want to do a
pixel in the middle of the screen for example? And how can I read pixels(probably truecolor)
from a texture surface if I wan't to make a precalced tunne for example?
I've searched and searched the net and every possible place and all I have found is a example
how to load and show a palette mode bitmap. And all those stuff are taken from the DX SDK
wich I have.. I haven't found anything usefull from there either =(

Please help me!!!!!!

 
Ake

September 02, 1999, 01:13 PM


You can get a pointer to a DirectDrawSurface by locking it. Then when you have that
pointer you can plot pixels just like in the old dos days...
buffer[y * 320 + x] = 255;
You probably don't use 8bpp mode, cause it sucks, but plotting 16/24/32bit pixels aren't that
very hard.
So how do I lock a surface?
Well, like this:

DDSURFACEDESC ddsd;
WORD *buffer;
memset(&ddsd,0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
lightsurf->Lock(&rect, &ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT, NULL);
buffer = (WORD *)ddsd.lpSurface;

You can lock your texture surfaces like this also, and read pixels from it. But if you
create your texture in videomemory, reads are very slooow.

Greetings Tobias

 
charly

September 02, 1999, 06:04 PM



Ake wrote:
>>
>>You can get a pointer to a DirectDrawSurface by locking it. Then when you have that
>>pointer you can plot pixels just like in the old dos days...
>> buffer[y * 320 + x] = 255;
>>You probably don't use 8bpp mode, cause it sucks, but plotting 16/24/32bit pixels aren't that
>>very hard.
>>So how do I lock a surface?

Thank you VERY much! This is the information I've been seeking.. I think =)
I might have figured out that I can find the pointer from the ddsd struct.. in a few years
or so =) Thank you for the code.. I think I get pretty far with this info.

charly

>>Greetings Tobias

 
This thread contains 3 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.