LoadTexture(ImageID()) ?

Just starting out? Need help? Post your questions and find answers here.
Searhin
User
User
Posts: 41
Joined: Mon May 26, 2003 10:53 am
Location: Germany

LoadTexture(ImageID()) ?

Post by Searhin »

Hi all :D

is it possible to integrate a texture file in the exe?

Images can be integrated via CatchImage(), but the LoadTexture() command requires a string$ parameter and cannot use UseImage().l/ImageID().l as a texture source.

Any idea :?:


PS: i'm sorry if this was discussed before, but i couldn't find a previous thread in this forums.
Fred
Administrator
Administrator
Posts: 18254
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

You can probably use CreateTexture() combined with TextureOutput() and DrawImage() on it (so you can use CatchImage()).
Searhin
User
User
Posts: 41
Joined: Mon May 26, 2003 10:53 am
Location: Germany

Post by Searhin »

Thanks Fred for the quick reply! :D

I have tried the approach you propose without success. However, I got an error message with the Point() command (which I used to read the color value of the CatchImage()'ed image), not with the Texture/Draw related stuff.

I will try again when I'm home. Perhaps I did something wrong...

But I suppose this approach would be quite slow?
Alternatively, I included binaries, wrote these to disk (as jpg files) and reloaded them as textures. Very, very slow... and quite dumb I suppose :oops:

Thanx again,
Searhin
Fred
Administrator
Administrator
Posts: 18254
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Here is a sample, it shouldn't be that slow (not tested):

Code: Select all

CatchImage(0, ?YourImage)
CreateTexture(0, ImageWidth(), ImageHeight())
If StartDrawing(TextureOutput(0))
  DrawImage(ImageID(), 0, 0)
  StopDrawing()
EndIf
Searhin
User
User
Posts: 41
Joined: Mon May 26, 2003 10:53 am
Location: Germany

Post by Searhin »

Wow! Thanx again Fred. I'm flattered :wink:

Now it works w/o problems and it's soo much simpler than I thought possible :oops:
Before, I draw pixel by pixel with the color extracted from the image in memory... Well, at least it worked, too. But then I came across a strange behavior:
Plot(x,y,RGB(R,G,B)) resulted in a compiler error, while FrontColor(R,G,B): Plot(x,y) didn't. Don't know if this was reported before

Cheers,
Searhin
Post Reply