B3D Texture Format?

Blitz3D Forums/Blitz3D Userlibs/B3D Texture Format?

Doktor Zeus(Posted 2010) [#1]
I'm having a crack at DLL writing. Can anyone point me to a resource that outlines the format for Blitz's textures? I basically want to write DLLs that can be passed or return Blitz textures, but I can't find any information on how to structure and decode the data.


Yasha(Posted 2010) [#2]
http://translate.google.co.uk/translate?prev=hp&hl=en&js=n&u=http%3A%2F%2Fblitz.pp.ru%2Fforum%2Fshowthread.php%3Fs%3Dbf60b1c29ecce245be45aa7d33b183f3%26threadid%3D203&sl=ru&tl=en

MikhailV is a very useful chap.


Doktor Zeus(Posted 2010) [#3]
Awesome. Actually, I think I own some of his DLLs...
Thanks for the link!

[EDIT] Heh, and now I have to work out how to use these diagrams... curse my inability to read Russian!


Doktor Zeus(Posted 2010) [#4]
Oh would you credit it! There's a note at the end of that thread to the effect that the tables were compiled for Blitz 1.96, and have since changed. I have Blitz 1.98.

Now, I'll admit that this is the first time I've had to work with pointers and I'm still shaky on how to use them, but I can't seem to extract even the simplest information. So I reckon I need a new reference.


Yasha(Posted 2010) [#5]
....depends what you want the DLL to do (did you check the other thread?).

The "Buffer" table is still up-to-date - I know this much because I have used all those pieces of info recently. Couldn't say for the "texture" one, but bear in mind the texture object doesn't contain the image data - the buffer does.

A pointer is an address within a process' local memory. Within B3D there is no distinction between pointers and integers, which is why handles for entities, images, etc. are all stored in integer variables. There is no built-in way to use pointers for anything in B3D, but you can pass the integer to a C function expecting a pointer and it will work correctly.


Doktor Zeus(Posted 2010) [#6]
Yeah, don't think I'm going to get very much further with this project. I could stick to just editing the buffer I guess, it'd just mean that I had to setup most of the data within Blitz and then edit it externally, since objects and buffers can't be passed from DLLs. It's all a heck of a lot of work and a steep learning curve, and I've no guarantee that the end result will be any faster than the Blitz coded version.

If the app I'm programming didn't require access to a LOT of very large textures, I'd do it another way. Unless I can figure a way of packing and maybe encrypting user-provided image files though, there is pretty much no point continuing.


Yasha(Posted 2010) [#7]


Hmmm... looks like the bottleneck is in the ReadBytes. OK, I have no further suggestions at this point.


Doktor Zeus(Posted 2010) [#8]
Thanks for trying anyway, man. I think I'm stumped on this one, which is a damn shame because it's an application I just know a lot of other programmers would have found useful. I may have to switch to another codebase altogether. Wonder if the Blitz SDK works with Borland Delphi...


Serpent(Posted 2010) [#9]
Although it may sound like a stupid idea, depending on what you need to do, you could try passing and receiving strings to communicate with your DLLs. Testing on my computer, it takes Blitz3D <2ms to send a 1.3 million character string and print a received string from a PowerBASIC DLL I wrote.

As far as I know, strings would be stored simply in memory, making it easy to use RTLMoveMemory to get the data in them, they support very large sizes, and, as my test shows, are extremely fast as a data transfer method.