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.

PureGDK / dbCreateImage ?? Where is it?

Author
Message
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 11th Jul 2012 02:04
I've looked through the files and I can't find a function to make an image. In GDK 1.0 it was dbCreateImage......

The fastest code is the code never written.
Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 11th Jul 2012 13:40
Quote: "I've looked through the files and I can't find a function to make an image. In GDK 1.0 it was dbCreateImage......"


I suppose you're using DarkGDK 2.0 and not PureGDK 2.0 which is deprecated btw.

There's no such command indeed and it was never a part of official DBPro command set.

You're better off creating an image from memblock.

Quote: "dbCreateImageFromMemblock

Syntax
int dbCreateImageFromMemblock ( int memblockID [, int imageID] )
Description
If 'imageID' is not specified for this function, the new ID will be returned as the result. Otherwise, the value of the result will be the same value passed as 'imageID'.

This command will create an image from a memblock.

The image format is laid out in the following configuration:

4 bytes (uint32) : Width
4 bytes (uint32) : Height
4 bytes (uint32) : Depth
.. : The image data (width * height * depth bytes)

For 32-bit images the data section is a sequence of 32-bits (4 sets of 8 bytes) in BGRA format.
"


Basically you create a memblock, fill in the data and then call create image from memblock. Thats it.


Intel Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP2, PureBasic 4.61 + DarkGDK 2.0
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 11th Jul 2012 15:59
So if I want an image 256x256 I would have to make a memblock like this:
int MB=dbCreateMemblock(256*256*4+12);
the size of the image would be 256*256*4
and the HWD info is 12 bytes (or 4bytes * 3)

Correct?

The fastest code is the code never written.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 11th Jul 2012 16:25
I can't even get this to work:

image is a valid image that I loaded. I can paste it, so I know it's there. HeightMap shows nothing..... What's going on? What am I doing wrong?

The fastest code is the code never written.
Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 11th Jul 2012 18:03
Confirmed! Thats an issue with GDK 2.0. Just tested it on both PureBasic and DBPro and the latter one worked just fine. Hopefully this will get a fix asap.

As for your calculations re image memblocks, they are correct.


Intel Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP2, PureBasic 4.61 + DarkGDK 2.0
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 11th Jul 2012 18:20
I'm trying to write games. I had a small issue with GDK1.0 and Mistrel said GDK2.0 (then it was PureGDK) had that issue fixed and had fixed many others. So I gritted my teeth and bought 2.0rc4. Now, that I've invested money and time converting/rewriting code, I find out that there are some MAJOR issues with 2.0!!!

The fastest code is the code never written.
Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 11th Jul 2012 23:12 Edited at: 11th Jul 2012 23:14
I understand your frustration but this is how software works. Fix one problem and introduce 10 new.

I think it should be an easy fix (most probably a typo in the memblock template file) but unfortunately I could not find the problem. I had a quick look at the memblocks.gdt and it seems ok to me.

Oh and by the way is there a reason why you post this in the PureGDK section? The product is now called DarkGDK and personally I would suggest them to merge the two sections together.


Intel Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP2, PureBasic 4.61 + DarkGDK 2.0
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 11th Jul 2012 23:34
PureGDK has been re-branded as DarkGDK 2.0

The fastest code is the code never written.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 10th Aug 2012 03:06
Just pointing out that dbMakeImage probably does what was requested here (that is creates a new Image of the given dimensions).


"Why do programmers get Halloween and Christmas mixed up?"
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 14th Aug 2012 10:28
The goal is to make an image, make a memblock from that image, modify the memblock, and then make an image from the memblock I modified. In 1.0 it worked fine, but in 2.0 the command set isn't there. I don't want to have to write to a bitmap and then "getimage" throughout the game-- that would slow things down considerably.

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-11-17 22:44:50
Your offset time is: 2024-11-17 22:44:50