Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Problem with AdvancedSprites and Image Kit V2

Author
Message
j e s t a m a r l
17
Years of Service
User Offline
Joined: 16th Jul 2007
Location:
Posted: 6th Jan 2014 00:52
Hello,

I don't know if anyone else has ran into this problem, but a search of the forums brought up nothing.

For my 2D game, I'm using ImageKit V2 to paste detail textures blended together with a texture mask by using an effect. However it seems that whenever an image is pasted using ImageKit, sprites rendered using AdvancedSprites don't render in the correct order of depth values. They are rendered simply in the order the draw function is called. I was planning on using ImageKit V2 to render the terrain, and AdvancedSprites to render the characters above it, as it's very fast.

I'd like to be able to use AdvancedSprites' depth capabilities as I plan on using a lot of sprites.

Also, I have what I believe to be the latest versions of AdvancedSprites and Image Kit V2.

Can anyone help me?

Thank you for your time, jestamarl
j e s t a m a r l
17
Years of Service
User Offline
Joined: 16th Jul 2007
Location:
Posted: 6th Jan 2014 03:56
Sorry for the double post, but I did some more investigations
It seems that even the vanilla DBPro Paste Image causes this problem.

Here's some example code. There are two sprites, a red and green box, and when the W button is held down, a blue box is drawn using Paste Image. When the image is being pasted, the sprites are drawn in the incorrect order.

j e s t a m a r l
17
Years of Service
User Offline
Joined: 16th Jul 2007
Location:
Posted: 10th Jan 2014 05:42 Edited at: 10th Jan 2014 08:25
Hello all, sorry for the triple post, but I found a solution for those who are interested.

I created a DLL with a single function which does the following.

LPDIRECT3DDEVICE9 pD3D = dbGetD3DDevice();
if (pD3D) pD3D->SetRenderState( D3DRS_ZENABLE, TRUE );

I call this function in DBPro right before I render any sprites using AdvancedSPRITES and that seemed to work. The sprites appear in the right order based on their depths.

I'm not really experienced with DLLs, so if something's wrong with this solution, please let me know.

Thank you!

EDIT:
I had to modify the above code a bit:

LPDIRECT3DDEVICE9 pD3D = dbGetD3DDevice();
if (pD3D) {
pD3D->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
pD3D->SetRenderState( D3DRS_ZENABLE, TRUE );
}
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 13th Jan 2014 20:55
@ j e s t a m a r l,

I gave up with AdvancedSprites dll yonks ago because of this very same problem.

Any chance you could please post the dll perhaps with a rudimentary .ini as well?

(* many thanks in advance!)

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 19th Jan 2014 19:39
@ j e s t a m a r l,

... or just even the .dll would be v helpful?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
j e s t a m a r l
17
Years of Service
User Offline
Joined: 16th Jul 2007
Location:
Posted: 20th Jan 2014 09:56
Here you go.

There's actually two commands, CLEAR ZBUFFER and ENABLE ZBUFFER.

CLEAR ZBUFFER just clears the zbuffer. There were some weird cases were the zbuffer wasn't clearing with AdvancedSPRITES so I would have to use it.

ENABLE ZBUFFER is the command you want to call before you render any AdvancedSPRITES.

Some example code to test it:

Attachments

Login to view attachments
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 21st Jan 2014 19:27
@ j e s t a m a r l,

Excellent! really appreciated!

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 22nd Feb 2014 15:01
@ j e s t a m a r l,

OK - here is the whole thing tied together with AdvancedSprites.

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-17 22:27:37
Your offset time is: 2024-11-17 22:27:37