Jump to content
  • Advertisement


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


2d Lighting

This topic is 6245 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know a good method or even a good article on how do do lighting effects in an tile basic directdraw engine?

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
code for 640x480x32bit
first,lock surface, get pointer(pb)
(the surface shall be in system memory!!!)
then BYTE *pl=(BYTE *)&LightTable[0];
(u can init the LightTable like this:

LightTable=new unsigned char [307200];
for (int i=0;i<640;i++)
for (int j=0;j<480;j++)

and u can use the code below now.
(ur cpu should support MMX!!!)
mov ecx,153600;
mov edi,pb;
mov esi,pl;
movq mm0,[edi];
movq mm1,[esi];
punpckhbw mm1,mm1;
punpckhbw mm1,mm1;
psubusb mm0,mm1;
movq [edi],mm0;
add edi,8;
add esi,2;
dec ecx;
jnz _loop;
haha, enjoy it!!!

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!