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 / Help making an image with a memblock?

Author
Message
Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 31st Aug 2012 03:35
Hello,

Ok, so I'm using 'SYNCAIDIUS' MEMBLOCK IMAGE MANIPULATION LIBRARY V1.1' (which is really good if you haven't seen it) to make an image then manipulating the image and applying it to an object as a texture.

The problem:
When I make an image with a memblock it has a thin white line down the right and along the bottom sides (Pic. attached).

This is the code:


Which uses this command from Syncaidius' library:


I've looked through it again and againg but I can't see a problem anywhere.

Any help appreciated!
Thanks,
BC
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 31st Aug 2012 11:50
Not sure why the function does this here:



This here should work:



TheComet

"if you don't understand recursion than you probably don't understand recursion." ~Jerico2day
Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 31st Aug 2012 16:31 Edited at: 31st Aug 2012 17:47
Thanks for your code but the image saved is still the same as in the first post. Could there be another problem somewhere?

I made this quick project:

I can't see any problems with this but I still get a white strip down the right side and along the bottom in the saved image. Is there a problem with 'make image from memblock'?

On a side note, I don't understand what
does, can anyone explain it to me?

Edit: Added code.

Thanks,
BC
Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 31st Aug 2012 18:46
OK, I tried this code on another machine, all worked fine the image has no stripes on it, I even ran the same .exe and the image was fine, so now I'm even more confused about that one!

As this is in the same vein and I don't want to start another thread:

When I apply this image to an object as a texture a small part of the image loops and is copied on to the other side of the object at the bottom and left (I'm applying it to a plain made using IanM's 'make object plain' - pic. attached) this happens on both machines. If I fiddle with the UV coords then I still can't get it to go away, it's less than a pixel's offset.

Thanks for the help,
BC
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 31st Aug 2012 18:49
Quote: " can anyone explain it to me? "


That section doesn't actually do anything. << is a bit shift operator. Some people find it easier to understand as bit scrolling operator, same difference. What it does is moves the bits either Left or right (left in this case).

I suspect the problem might be related to SaveImage though, which i vaguely remember some other people having issues with.

Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 31st Aug 2012 18:54 Edited at: 31st Aug 2012 18:56
Thanks for that!

It's not a just save image problem though, as it works on my other machine, maybe it's my machine? The machine it works on is running Win7(32bit) and the one it doesn't work on is running XP(32bit) if that's any help?

Thanks,
BC
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 31st Aug 2012 20:55
To be honest I don't even see the line on your posted image.
And no, there's nothing in the code that should cause it as far as I can see; such issues might arise when texturing a plain or similar though, in that case it's because the UV coordinates goes a bit too far and either restarts from the beginning or clamps at the last pixel. But that's not the issue here anyway since its a one-colour image and you didn't say you were using plains (or sprites) so I guess you aren't.

Quote: " make memblock mem,bytes width = (0<<24) + (0<<16) + (0<<8) + width height = (0<<24) + (0<<16) + (0<<8) + height depth = (0<<24) + (0<<16) + (0<<8) + 32"

That's pretty confusing, especially since it doesn't limit width, height or depth to a single byte anyway.
As Kevin said it builds a (supposedly) 32-bit value having the 24:th, 16:th and 8:th bits set to 0. But then after that adds another value that might very well overwrite said bits. Also the proper way to do that is to use the bitwise OR operator and not +; with a bitwise or, setting for example 2 twice will still just set bit 2 to 1. Adding 2 twice will of course rather set bit 3 (4), and allow bit 2 to remain set as well if it was previously.


"Why do programmers get Halloween and Christmas mixed up?"
Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 1st Sep 2012 02:41
Yes, I've discovered that the line only appears on my XP pc and not on win7 pc I've tried it on wheb it's saved to an image.

But when it's applied to an IanM Matrix utils plane, then it copies a tiny bit of the texture from the top and left to the bottom and right sides as if its a UV problem. However, if I use a standard DBP plane then there is no problem. Is there a known issue with texturing an IanM util plane?

Thanks,
BC
Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 11th Sep 2012 13:08
Just in case anyone else has this problem the answer was mipmapping; if you turn off mipmapping and clamp rather than wrap the image it looks perfect. I found this by applying DarkShader's default shader with mipmapping set to 'none' and texture modes set to 'clamp', here's the .fx file, changes marked:

Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 12th Sep 2012 07:14
Thanks for the follow up.

Login to post a reply

Server time is: 2026-07-07 12:07:07
Your offset time is: 2026-07-07 12:07:07