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.

AppGameKit Classic Chat / Image MemBlock

Author
Message
MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 8th Nov 2018 17:55
Hello Community,

I am new to the MemBlock part of AGK. Never used these commands before. I want to create just a simple image in order for me to understand how the system works. Can please and kindly anyone provide me with a code on how a simple image is created? But if it's possible, not as a function. I saw that some calculations are done or a formula is applied and I don't really understand how it works.

Huge thank you!
www.alexmatei.com
puzzler2018
User Banned
Posted: 8th Nov 2018 18:07 Edited at: 8th Nov 2018 18:09
Hello

Here is a small snip i grabbed from my perlin noise map creator and tweaked it a bit to just produce white noise



Hope this helps
MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 8th Nov 2018 23:15
Hi puzzler,

Thank you very much for the code! It gave me an error that is attached to this message. Before that, the compiler didn't recognized width and height, so I declared them as integers.
www.alexmatei.com

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 8th Nov 2018 23:20
give width and height values before head into it

eg
width=100
height=100

sorry i forgot that bit for you
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 8th Nov 2018 23:23 Edited at: 8th Nov 2018 23:24
I believe width and height may have to be powers of 2
and they must be greater that zero

ie the width of the image you want and the height

oh lol Puzzler beat me to it

maybe they don't have to be powers of two
fubar
MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 8th Nov 2018 23:46
No problem!
Pasted in the values but no image is showing

www.alexmatei.com
puzzler2018
User Banned
Posted: 8th Nov 2018 23:55
Give me a sec
puzzler2018
User Banned
Posted: 8th Nov 2018 23:58 Edited at: 9th Nov 2018 00:00
We fogot to create the sprite with a do loop


Awesome hey

But you say not in a function, i think it should be cause you app iniasation will be awefully messy
MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 9th Nov 2018 11:10 Edited at: 9th Nov 2018 11:17
Hehe! It worked!

2 questions: Is it possible to create flat images (just one color) and is it possible to create shapes from memblocks?

Thanks a lot!

EDIT: Changed the RGB and made a white image. That one at least, I discovered )
www.alexmatei.com
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 9th Nov 2018 20:46
The Skys really the limit
Its really up to you as to how you create them etc for example they could be used to create trees etc
puzzler has a great algorithm that creates a texture suitable for 3D land

a simple tree algorthym that doesn't take advantage of memblocks but theres no reason why such an algorithm
couldn't be converted to use memblocks instead and there are many other fractal algorithms etc online to guide
you


fubar
MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 9th Nov 2018 20:52
That's a really good code!
But, my aim is to create such shapes through memblocks especially because I need to take advantage from images and sprites
www.alexmatei.com
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 9th Nov 2018 21:36 Edited at: 9th Nov 2018 21:53
not sure why you need to use a memblock as it would be so much easier to make a triangle or square function
that you pass parameters to. And there are great get image commands that work quite fast

Here is an example I used they could be perfected to have parameters passed and a minor calculation to make the image
for any sized image just for my purposes they were fine as they were


memblocks are better suited for modifying things when there is no suitable command
ie modify a wav file but to do so you have to understand how the sound file is set up
ie create your own object commands like puzzler is doing on his thread
or perhaps blending two images or adding a multiplier etc but that is best done with a shader
fubar
MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 9th Nov 2018 22:08
yes, you seem to be right. One question: My vision is to manipulate a shape as such as I can drag some points with the mouse and after that to finalize it as an image. Similar to vertex manipulation but only on 2D items.
www.alexmatei.com
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 9th Nov 2018 22:16
should be easy enough done, I'm thinking the best way would be to use 2*2 pixel sprites at each of the corners
then using the mouse hit command you could move with the mouse pointer and the background would draw
from sprite a to b to c to d so grabbing hold of b you could move that point accordingly and then render/draw
to a back ground image. If you just want to scale the objects grabbing one point an algorithm could be used to
proportionally move the others
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 9th Nov 2018 22:18
Using sprites at the corners you could easily make your program add/remove points etc
fubar
puzzler2018
User Banned
Posted: 9th Nov 2018 22:55 Edited at: 9th Nov 2018 22:56
I can see what your trying to achieve here, a possible oblong shape with potentially many vertex points that can be moved about to create different shapes, here goes the fill command requirement again - unless you dont need to fill inside the oblong shape

I dont think we ever got the fill working not properly after many attempts in the past.

But certainly is acheivable if put mind to it.

Login to post a reply

Server time is: 2024-03-28 20:17:48
Your offset time is: 2024-03-28 20:17:48