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.

DarkBASIC Professional Discussion / Mipmaps with 'make image from memblock'

Author
Message
Thebeely
21
Years of Service
User Offline
Joined: 4th May 2005
Location: Croatia
Posted: 18th Feb 2011 12:32
This had already been discussed, but with no results.

Is there a way of creating mipmaps for an image created from memblock (DBPro creates mipmaps while loading images from files, but it's not really a good idea to save the image to hard disk after creating it, and then load it). If anybody has any ideas, please help me

Thanks!
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 18th Feb 2011 16:22
I'm sure that mipmaps are created when needed on an object by object basis. So if you have a non-mipmap image made from a memblcok, you might be able to texture that onto an object then tell the object to use mipmaps, to enforce them if you know what I mean.

SET OBJECT TEXTURE Obj,Repeatmode,Mipmap

The repeat mode decides what to do with texture wrapping, and Mipmap would hopefully create a mipmapped version of the textured image.

If that fails, then you could always create a bitmap, paste your image, then grab it again without the ,1 flag - which might allow the mipmap generation. It is annoying, especially when you see how many different options there are for mipmapping in supported art packages - alpha fading for instance. I wish we had more control over mipmap creation in DBPro.

Health, Ammo, and bacon and eggs!
Thebeely
21
Years of Service
User Offline
Joined: 4th May 2005
Location: Croatia
Posted: 18th Feb 2011 17:30 Edited at: 18th Feb 2011 18:11
No luck with 'set object texture'.
I don't want to paste anything on screen, but I'm afraid it's either that or saving and than loading image. Or I can leave without mipmapping, but then it just looks bad.

Thanks anyway, Van B

Any other ideas?

[edit]
Did this for now:


It's quite retarded, as you can see.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Feb 2011 20:01 Edited at: 18th Feb 2011 20:40
You could always calculate the mipmaps yourself in code. It's quite easy in principle - and you could tailor them for your specific purpose as well. For example, you might want the border to be always black or some other specific colour, or you might want to adjust the mipmapping on the alpha component (to stop tree leaves disappearing too quickly).

But your "retarded" method would probably be faster as well as being much easier to code.

Edit Er, yes. Making the mipmaps IS easy, but combining them into a single mipmapped image isn't. Sorry.
Thebeely
21
Years of Service
User Offline
Joined: 4th May 2005
Location: Croatia
Posted: 19th Feb 2011 14:19
Exactly... And I have no idea how it could be done in DBPro.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Feb 2011 14:42
I'm pretty sure that it can't be done directly.

A less 'retarded' method would be to create the image, paste it to a bitmap, then use GET IMAGE to recreate the image again (although you may have to delete the image before re-grabbing it too).

Thebeely
21
Years of Service
User Offline
Joined: 4th May 2005
Location: Croatia
Posted: 19th Feb 2011 15:14
I really don't want anything pasting on screen, but I will look into it. Thanks
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 19th Feb 2011 19:23
Quote: "I really don't want anything pasting on screen"

He said to paste it to a bitmap, not the screen. If you use the Set Current Bitmap command it re-directs drawing operations (Paste Image,Get Image, etc..) to that bitmap. Set it back to bitmap 0 to return drawing to the screen.
Thebeely
21
Years of Service
User Offline
Joined: 4th May 2005
Location: Croatia
Posted: 19th Feb 2011 19:26
Quote: "He said to paste it to a bitmap, not the screen. If you use the Set Current Bitmap command it re-directs drawing operations (Paste Image,Get Image, etc..) to that bitmap. Set it back to bitmap 0 to return drawing to the screen. "


Oh Sorry then
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Feb 2011 20:25
It'd go something like this (with my plug-ins assisting):


Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Feb 2011 18:07
That's interesting.

I guess the mipmap generation is really fast. Is it possible to extract the mipmaps directly? For example I have an application where it would be very useful to have access to the 4th or 5th mipmap.
Thebeely
21
Years of Service
User Offline
Joined: 4th May 2005
Location: Croatia
Posted: 22nd Feb 2011 18:31
Thanks a lot, guys

Is there a way to keep alpha channel while using bitmaps and 'paste image' / 'get image'? Help files say something about 'alpha bitmap'.

@GG
I really doubt it.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Feb 2011 18:40
Quote: "@GG
I really doubt it. "


So do I - but if anyone knows then IanM certainly will.

Login to post a reply

Server time is: 2026-07-17 13:59:26
Your offset time is: 2026-07-17 13:59:26