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.

Program Announcements / D3DFunc V3.0

Author
Message
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 28th Mar 2006 09:36
It's impossible to get Text Width/Height from a multiline text box. You specify the width and height by the size of the box.

Cheers,

Cloggy
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 28th Mar 2006 15:58
This plugin is fantastic!
I have been playing with it all day and I am very impressed. One thing that does strike me as odd though is that alpha only uses a range of 0 -100. Is it possible to change it so that it uses a range of 0-255? As it is, it doesn't match the values that a PNG file has and 0-255 would certainly make things easier.

Thanks for listening and THANKS for the plugin


Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 28th Mar 2006 17:29
Scraggle,

Thanks for the praise

SilentS has been working on v3.5 which should be available very shortly. This uses alpha ranges from 0-255 and also has all the new batch commands.

Cheers,

Cloggy
qwerty823
18
Years of Service
User Offline
Joined: 17th Jan 2006
Location:
Posted: 28th Mar 2006 18:13
Quote: "It's impossible to get Text Width/Height from a multiline text box. You specify the width and height by the size of the box."


It's not impossible.

If you use DT_CALCRECT with the return value from DrawText (which will be the height needed to contain the text) the width will be the width of the box supplied to wrap the text too.

On another note, have you considered "caching" the CALCRECT calls? If you call GetWidth followed by GetHeight on the same string, it forces two calls to DrawText(), when only one is really needed. Since i dont know how DBPro handles the string pointer passed in, you could cache the calls, and the pointer, and if the pointer is the same, just return the cached widht/height. Just a suggestion. If not, there could be explicit calls to do this, so the caller has to be aware that they are getting the cached data (ala, make one call to "size" the string, and one call each to get the height and width).
Scilynt
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: .-#-.
Posted: 28th Mar 2006 19:45
I've sent off the latest version to Cloggy to be posted to the site, when he let's me know that everythings sorted I'll make an official announcement for v3.5
Scilynt
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: .-#-.
Posted: 28th Mar 2006 21:30
I am proud to present D3DFunc V3.5.

Sorry it's a bit late, but it's here now.

The biggest addition to this version is the introduction of batching for basic 2D operations, and updating of 3D batching to bring them inline.

Unfortunately with this version there are a few changes that you should be aware of that will break existing code. These includes changes to alpha and some command parameters. All changes are documented, along with additions in the Moving to V3.5 help file, which can be found in the download named D3D_BREAKINGCHANGES.htm or linked from the D3DFunc index after installation.

I intended to write some new examples to go along with this release, but since I haven't done so yet, I didn't want to keep the release any longer. I have attached a small sample I put together to try out 3D dots, it contains the source and a compiled version. In it's current state, it's rendering 75,200 3D dots in about 80 FPS using the new batching functionality.

For this release I added a lot of the new functionality, while porting over the code previously written by Cloggy and myself. Due to this, any problems you come across are my fault, so let me know and I'll see what I can do to fix them.

I'm pretty sure I had other things to mention, but I can't remember, so I'll leave you with the downloads available from the site by Cloggy here.

Attachments

Login to view attachments
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 28th Mar 2006 22:14 Edited at: 28th Mar 2006 22:15
FANTASTIC!

On the day I discover this plugin, I ask for one thing to be implented and here it is less than 6 hours later fully functional!

I'd like to think it was my influence and kind words that made you rush into action and get this sorted but (reality check) I know you have been working on this for a while and my request was very coincidetnally timed.

I am very impressed with this plugin. Not only by the functionality of it but the professional feel it has to it. It is very rare that a plugin comes with fully integrated help files that make you feel like this is a complete inclusion into the DarkBASIC product.

As for the MAKE TEAPOT command, it is hard to believe that DBP has managed to survive so long without such a command.

My hat goes off to you ... both off you.

Thank you VERY much


Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 28th Mar 2006 22:22
@ Scilynt & Cloggy,

Just repeating what Scraggle said - excellent and thanks... to assist the imagination-challenged, could you perhaps some of the potential uses of the 2d and 3d batch commands in games?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Scilynt
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: .-#-.
Posted: 28th Mar 2006 23:07 Edited at: 28th Mar 2006 23:07
As one of those imagination-challenged I can't really help but say, any time you're using multiple dots, lines, 3D dots or 3D lines, then you're probably better off using the batch commands. It's only an addition two commands, or three in the case of 3D dots, but the improvement in performance greatly overpowers the cons of having to implement two extra commands . Obviously you're not going to get much improvement for 10, 20 or 30 lines, but once you get over 100 the benefits become obvious.

And to Scraggle, 255 alpha was in the last release, but you had to enable it with an extra parameter on D3D_Init, this release just made it standard. Also regarding the teapot command, I know, every test I do now uses teapots rather than cubes. It's like to move from Yahoo! to Google all over again .
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 28th Mar 2006 23:46 Edited at: 28th Mar 2006 23:47
Duffer,

I believe morcilla uses this plugin on his excellent Solar System Simulation here http://forum.thegamecreators.com/?m=forum_view&t=68745&b=8

Also, philip has created a black hole code snippet here http://forum.thegamecreators.com/?m=forum_view&t=74036&b=6

EDIT - BTW I intend to compile a version for 5.9 tomorrow on my work PC.

Cheers,

Cloggy
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 29th Mar 2006 09:44 Edited at: 29th Mar 2006 09:46
I have compiled a version that should work with DBP 5.8-9. Download it from Here http://www.cloggj.f2s.com/DBPro/downloads/D3DFunc%20V3.5.zip

Cheers,

Cloggy
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 29th Mar 2006 09:47 Edited at: 29th Mar 2006 09:49
Sorry,

Link didn't work properly. Will try again

Download it from Here [href]http://www.cloggj.f2s.com/DBPro/downloads/D3DFunc V3.5.zip[/href]

I give up as I can't seem to add the link. Either cut'n'paste or I've also now attached the file

Cheers,

Cloggy

Attachments

Login to view attachments
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 29th Mar 2006 09:50
@Cloggy Just for info ... there is a space in the filename of the rar file you are linking to. That's why the link wont work.


Oneka
19
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 30th Mar 2006 00:31
:/ I installed the DLL to the right places and it wont compile now....it just says cannot understand statement at line ####


Making better games everday!
Oh yeah and just so you know its Oh-nek-a not One-ka!
Scilynt
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: .-#-.
Posted: 30th Mar 2006 00:35
Have you checked the breaking changes document to make sure you're not using any commands that have changed? From memory the ones with command name changes are the 3D text, teapot, and torus object commands. Aswell as the 3D batching functions.

If this is not the problem, could you provide some example code so we can try to identify the problem?
Oneka
19
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 30th Mar 2006 00:42
Yeah I converted all the commands to the new one...I was using like the first or second release...



Thats all iam trying to do and it says



Making better games everday!
Oh yeah and just so you know its Oh-nek-a not One-ka!
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 30th Mar 2006 01:13
Oneka,

Can you try the following very simple code to see if you still get the problem


That works fine here.

Also what version of DBP have you got and what version of the dll?

There is a U6+ version and a U5.9 version.

Cheers,

Cloggy
Scilynt
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: .-#-.
Posted: 30th Mar 2006 01:36
I'd just like to mention that the 5.9 version, isn't only for 5.9, it should work for any release after, and removes the need to D3DX9_25.dll, this means that the intended user of your app/game doesn't require the April '05 SDK, or to have installed the DLL seperately.
Oneka
19
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 30th Mar 2006 01:51
@Cloggy that code doesnt work...

And iam using the 5.9 version of DBP....


Making better games everday!
Oh yeah and just so you know its Oh-nek-a not One-ka!
Scilynt
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: .-#-.
Posted: 30th Mar 2006 02:04
Do the other commands work? If so, try re-downloading and extracting it again.

If not, make sure you have a file named D3DFunc.dll in your DBP-Root\Compiler\plugins-user\ folder. I know you said it was extracted correctly, but perhaps that file wasn't.
Oneka
19
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 30th Mar 2006 02:41
Ok I did it and still no luck x_x;


Making better games everday!
Oh yeah and just so you know its Oh-nek-a not One-ka!
Scilynt
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: .-#-.
Posted: 30th Mar 2006 03:11
Not sure what the problem could be, the file version should be 3.5.0.0. Though even older versions shouldn't cause a problem.

Do you have two or more directories for Pro? Perhaps one for testing betas, if so then make sure you've got it in the correct directory for the version you want to use.

I'm going to have to head off, it's 02:11 so I'll be needing some sleep. If the problem has been sorted, then I'll resume this tomorrow (technically today).
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 30th Mar 2006 09:43
This is extremely strange. The only way I can get close to the same error is by removing the dll from the plugins-user folder.

With the earlier sample I provided I get this error.



Can you post the error report you get with the source I provided please.

Cheers,

Cloggy
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Mar 2006 10:55 Edited at: 30th Mar 2006 10:58
OK...D3D text just got better with U6.

One problem with anti-aliased text was making a text image with a transparent background. You had to make a bitmap with a color key (black, for example). Using one colour for transparency doesn't work for anti-aliased edges, it looks horrendous.

In U6 we can now have transparent bitmaps - SET BITMAP FORMAT 21. Below is a before and after image of the results...



Attachments

Login to view attachments
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 30th Mar 2006 13:15
@ Batvink - they look the same - could you expand on that a little for us - ta

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 30th Mar 2006 13:19
Duffer,

If you look at the words 'Main Menu', in the first image ther is a slight black border which isn't present in the second which makes it look alot better.

Cheers,

Cloggy
Oneka
19
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 30th Mar 2006 23:17 Edited at: 30th Mar 2006 23:27
Okie now that was just wierd...
What i did was just cut and then repaste the same file and it compile that time....well anyway thanks for the help and thanks for a great DLL!


EDIT:
Just to let you know...when you try to use a font that wasnt specified it will cause a silent crash....


Making better games everday!
Oh yeah and just so you know its Oh-nek-a not One-ka!
Scilynt
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: .-#-.
Posted: 31st Mar 2006 00:16 Edited at: 31st Mar 2006 00:21
Okay thanks for the report, that's because only one font is initialised, and we make no checks to make sure that the font specified has been.

Glad it's now working for you.

[EDIT]
Problem fixed.
qwerty823
18
Years of Service
User Offline
Joined: 17th Jan 2006
Location:
Posted: 1st Apr 2006 00:52
qwerty823 writes:
Quote: "Could we get d3d commands to calculate the text width/height when using the boxtext command? This way if we want to do multiline text with different colors, we could see what size each line takes up when it wraps inside the box. Thanks!"


cloggy writes:
Quote: "It's impossible to get Text Width/Height from a multiline text box. You specify the width and height by the size of the box."


Since im not sure if you understood what I meant or not, I figured it would be easier to just implement the function myself. Here it is if you wish to include it in your dll.

Scilynt
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: .-#-.
Posted: 1st Apr 2006 04:24 Edited at: 3rd Apr 2006 10:40
After re-reading your message, I can see what you want so I'll add it in, though it will be slightly different than your function.



There's no need to include the height parameter since the calculations don't care about it.
Oneka
19
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 3rd Apr 2006 04:41
Hey I have a request...its not really that big of a deal but I was wondering if you could set it up so that when using commands like
D3D_COLOR would it be possible if you could set it up so that its just two parameters that are needed?

example D3D_COLOR DWORD,APLHA

so I can do things like D3D_COLOR RGB(255,255,255),255
only so that I can keep some code small....its not a biggie so if you dont I understand just trying to make some things easier xD


Making better games everday!
Oh yeah and just so you know its Oh-nek-a not One-ka!
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 3rd Apr 2006 14:23 Edited at: 3rd Apr 2006 15:16
Ok, my original post was silly, but I have a question now...

Why is it that when I use D3D_Color to change the colour ( specifically the alpha ), that it doesn't take effect on the 3D lines?

To clarify, the colour changes, but the alpha does not.

[EDIT]
Gleh, never mind, there was an error between the chair and keyboard...
[/EDIT]

Cheers,
Jess.

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 4th Apr 2006 07:08
Alrighty...

Now, if I have a ghosted and faded object on top of a 3D line/Dot, etc, it will not show through the object.

I understand that the 3D drawing is probably done after the object rendering, so it should be possible to see what's semi-transparent, no?

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 4th Apr 2006 10:18
Jess,

I have done alot of testing on this and have found no way of making the line appear behind ghosted objects. I think that the DBpro objects are being rendered by the sync command whereas the d3d stuff is all done before the sync. I'll have another look but don't hold out much hope.

Cheers,

Cloggy
Philip
20
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 4th Apr 2006 15:00
You could try emailing Lee to ask him for any input. He's good at things like that.

Cheer if you like bears! Cheer if you like jam sandwiches!
Quote of the week: "I highly recommend Philip's Vector Tutorials" (RiiDii)
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 4th Apr 2006 17:11
No worries, I'm happy to put up with it

TBH, I'm only using DBP in this case to prototype a game I want to make on the DS in C++ So, it's not terribly important, I can revert back to old methods

Cheers all the same,
Jess.

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 4th Apr 2006 20:05
And, here's another one...

If there are ANY objects on-screen that have the 'Set Alpha Mapping On' command applied to them, then the value of the Alpha Map will also effect 3D lines and Dots...

'tis weird

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 5th Apr 2006 10:22
Thanks to the promptings of philip I decided to send copies of the d3dfunc source to Lee along with and example of the 3d line rendering problem. He kindly spent some time last night looking at the problem and concluded that due to the fact that DBP clears the zbuffer before rendering it's objects, this problem will always occur.

He has however suggested that we touch bases after U6 has been finalised and his schedule eases, so we could discuss possible enhancements to DBP to help resolv this problem.

Not sure when this will be, but hopefully we can get it resolved.

Cheers,

Cloggy
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 5th Apr 2006 13:46
(!!)

Sweet! Good work, Cloggy!

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 5th Apr 2006 19:59
Excellent plugin Cloggy I may even use it in one of my FANTASTIC programs.

Come to the convention this year and im sure some people will bring you beer in gratitude.

WE SHALL BECOME ALL POWERFUL! CRUSH THE LESSER RACES! CONQUER THE GALAXY! UNIMAGINABLE POWER! UNLIMITED RICE PUDDING ! ! ! ETC. ! ! ! ETC.! ! !
EsteemDE
18
Years of Service
User Offline
Joined: 5th Aug 2005
Location:
Posted: 6th Apr 2006 05:56
My exe crash's when trying the example program you gave...



I am using the 5.9 version and this happens with the 3D text example and the pyramid example.
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 6th Apr 2006 10:29 Edited at: 6th Apr 2006 11:18
EsteemDE,

I have managed to reproduce the problem on my 5.9 machine. I would suggest downloading the version 3.2 at the moment, I will try to resolve the problems and upload a new version later.

EDIT - I've now had a look and I can't even get the 3dtext command to work with a much earlier version of d3dfunc (V2.1) . The only thing I can think of is that I tried upgrading the version of DBPro on this machine from 5.9 to U6B2 but has some problems and reverted back to 5.9. If anyone has 5.9 that hasn't tried upgrading DBPro yet can they give this a try. Otherwise I think I'll have to get round to doing a complete uninstall/Reinstall and try it again.

Cheers,

Cloggy
Scilynt
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: .-#-.
Posted: 6th Apr 2006 15:39
EsteemDE, could you email me a compiled example that's crashing?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th May 2006 18:42
I still have the text crashing problem. It's when I create a fourth D3D Text, part-way through the program. It doesn't crash for me ever on 2 machines, but it does every time for Rick Vanner.

One of my machines has a Geforce 5200 FX 128 MB card, the other is an ATI mobility Radeon. I don't know what Rick is using.

The code that causes it is quite simple:

d3D_font 4,"Arial",24,0,0,1
d3d_color 50,50,50,255




Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 5th Jun 2006 01:52
Batvink,

So I keep missing you on MSN. What version of DBP are you using?

I had some problems with v3.0 with U5.9 but seems ok with 6+

Cheers,

Cloggy
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 6th Jun 2006 00:42
I'm running 6.1. I removed the D3D Font 4, and used a font that already existed in the program elsewhere. This fixed the problem. So Rick's hardware must have an aversion to 3 D3D Fonts (the 4 is misleading, there's only actually 3).



The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 18th Jun 2006 06:25
I think I found a bug when I change the display resolution ingame the text doesnt work anymore.

The admiral
Cloggy
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 18th Jun 2006 11:15
Admiral,

Ir's not a bug, When you change the resolution all the fonts you created with the DirectX dll are lost. You need to call D3D_init and all the font creation routines everytime you change resolutions. It's the same as DBP and Images. They are lost when resoultion changes as well.

Cheers,

Cloggy
The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 18th Jun 2006 12:18
Well as far as I know my code does re initialise them but ill try again and see what happens.

The admiral
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 28th Jun 2006 17:03
Cloggy - Have you thought about including 3D sprites in your DLL? Such a feature would be pretty damned handy for drawing fast particle and billboarding effects, and wouldn't be very hard at all considering the amount of stuff your dll already does.


Join the BlackOut Forum Today

Login to post a reply

Server time is: 2024-04-19 02:27:56
Your offset time is: 2024-04-19 02:27:56