Jump to content


Photo

Extending GML's drawing-capabilities?!


  • Please log in to reply
23 replies to this topic

#1 thenoller

thenoller

    GMC Member

  • GMC Member
  • 208 posts

Posted 22 February 2011 - 11:08 PM

I'm planning to make a specific drawing-program, and for reasons I'm not going to explain here, I need it to use DirectX. That (and the reason that I already know GML) is why I wanted to do it in GM - the build-in drawing-functions, however, are too slow.. I wanted to see if anyone knew about an extension/DLL that:

  • Could distort a loaded picture (like Photoshop's "liquify", "smudge" or "displacement map").
  • Doesn't mess up the use of surfaces and blending-modes in the process.

Alternatively: It could also be an extension that just gave me some really fast equivalent for draw_point and get_point_rgb (no, I'm not gonna look up the correct name); then I could use my own algorithms for reading and redrawing the image using some specific modifications.

I've looked a bit around the forums with no luck, but maybe I just have no idea where to start looking.. However - Thank you so much in advance, if you happen to know of just the thing I'm looking for :)
  • 0

#2 Gamer3D

Gamer3D

    Human* me = this;

  • GMC Member
  • 1590 posts
  • Version:GM8.1

Posted 23 February 2011 - 05:16 AM

Look for the pixel shader extension.
  • 0

#3 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 23 February 2011 - 11:27 PM

Why not move on if GM is too slow for your needs?
  • 2

#4 brett14

brett14

    GMC Member

  • GMC Member
  • 1150 posts
  • Version:GM8

Posted 24 February 2011 - 04:16 AM

you're not going to get any faster in gml. The draw_pixel function is not slow, calling it is. You could program it with c++ and dx9 and call a function to redraw the whole screen if you want it run faster, otherwise move on to a different language.
  • 0

#5 slayer 64

slayer 64

    GMC Member

  • GMC Member
  • 3278 posts
  • Version:GM8.1

Posted 24 February 2011 - 04:49 AM

primitives would draw to a surface faster than lots of draw_point calls. maybe make models of pixels and draw the models to a surface. then you only need to create the models once.

instead of using draw_getpixel you could store the colors of an image in a grid data structure. you would be able to look up color information quickly that way.

basically, store the image data in grids, draw the grid data to a surface using models. when you draw something in the game, modify the models.
  • 0

#6 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 24 February 2011 - 12:53 PM

The draw_pixel function is not slow, calling it is.

No, the function is actually slow.
  • 2

#7 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 24 February 2011 - 01:30 PM

basically, store the image data in grids, draw the grid data to a surface using models. when you draw something in the game, modify the models.

Having a grid that large is extremely slow.
  • 0

#8 slayer 64

slayer 64

    GMC Member

  • GMC Member
  • 3278 posts
  • Version:GM8.1

Posted 24 February 2011 - 05:34 PM

basically, store the image data in grids, draw the grid data to a surface using models. when you draw something in the game, modify the models.

Having a grid that large is extremely slow.


no it isn't. you're slow
  • 0

#9 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 24 February 2011 - 06:10 PM


basically, store the image data in grids, draw the grid data to a surface using models. when you draw something in the game, modify the models.

Having a grid that large is extremely slow.


no it isn't. you're slow

Compared to a computer, yes :P
But anyway, I've tried using a grid to draw, and it just doesn't work.
  • 1

#10 Water Chicken

Water Chicken

    Got it memorized?

  • GMC Member
  • 1191 posts
  • Version:GM:Studio

Posted 24 February 2011 - 07:37 PM



basically, store the image data in grids, draw the grid data to a surface using models. when you draw something in the game, modify the models.

Having a grid that large is extremely slow.


no it isn't. you're slow

Compared to a computer, yes :P

Man can run faster than a computer.
Why the heck haven't they put me on moderator preview yet?

Edited by Emanrice, 24 February 2011 - 07:37 PM.

  • 2

#11 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 24 February 2011 - 07:45 PM

Yeah, but we can't do calculations anywhere near as quickly.
  • 2

#12 brett14

brett14

    GMC Member

  • GMC Member
  • 1150 posts
  • Version:GM8

Posted 24 February 2011 - 08:40 PM

Sure we can. Vision for example, how does that work? The light that hits our eyes is not flat. Our brain does a whole bunch of math and calculations to "render" an image that we see. Then there's our other senses. We can do calculations just as fast, but can't return results as fast
  • 0

#13 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 24 February 2011 - 08:42 PM

Our brains don't calculate anything to render the image. Our senses aren't "calculating" - physics does that for us.
  • 0

#14 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 24 February 2011 - 08:49 PM

Our brains don't calculate anything to render the image. Our senses aren't "calculating" - physics does that for us.

Our brain does do a bit of "rendering", the image captured by our eyes is actually upside-down. We also have two eyes.
  • 2

#15 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 24 February 2011 - 09:00 PM


Our brains don't calculate anything to render the image. Our senses aren't "calculating" - physics does that for us.

Our brain does do a bit of "rendering", the image captured by our eyes is actually upside-down. We also have two eyes.

We flip and merge an image. That's not calculating, is it?
  • 0

#16 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 24 February 2011 - 09:02 PM



Our brains don't calculate anything to render the image. Our senses aren't "calculating" - physics does that for us.

Our brain does do a bit of "rendering", the image captured by our eyes is actually upside-down. We also have two eyes.

We flip and merge an image. That's not calculating, is it?

It is calculating.

brett14 wasn't saying that our brains rendered the world as a bunch of 3D models. He said we manage to see the light that hits our eyes. Hopefully you didn't get confused by the words "render" and "calculate".
  • 2

#17 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 24 February 2011 - 09:17 PM




Our brains don't calculate anything to render the image. Our senses aren't "calculating" - physics does that for us.

Our brain does do a bit of "rendering", the image captured by our eyes is actually upside-down. We also have two eyes.

We flip and merge an image. That's not calculating, is it?

It is calculating.

brett14 wasn't saying that our brains rendered the world as a bunch of 3D models. He said we manage to see the light that hits our eyes. Hopefully you didn't get confused by the words "render" and "calculate".

No, I didn't get confused. What do you have to calculate to turn coloured light into an image? It's already there for you...
  • 0

#18 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 24 February 2011 - 09:19 PM





Our brains don't calculate anything to render the image. Our senses aren't "calculating" - physics does that for us.

Our brain does do a bit of "rendering", the image captured by our eyes is actually upside-down. We also have two eyes.

We flip and merge an image. That's not calculating, is it?

It is calculating.

brett14 wasn't saying that our brains rendered the world as a bunch of 3D models. He said we manage to see the light that hits our eyes. Hopefully you didn't get confused by the words "render" and "calculate".

No, I didn't get confused. What do you have to calculate to turn coloured light into an image? It's already there for you...

I didn't realize it was a direct process (eye -> vision). Sorry. [/sarcasm]
  • 2

#19 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 24 February 2011 - 09:45 PM






Our brains don't calculate anything to render the image. Our senses aren't "calculating" - physics does that for us.

Our brain does do a bit of "rendering", the image captured by our eyes is actually upside-down. We also have two eyes.

We flip and merge an image. That's not calculating, is it?

It is calculating.

brett14 wasn't saying that our brains rendered the world as a bunch of 3D models. He said we manage to see the light that hits our eyes. Hopefully you didn't get confused by the words "render" and "calculate".

No, I didn't get confused. What do you have to calculate to turn coloured light into an image? It's already there for you...

I didn't realize it was a direct process (eye -> vision). Sorry. [/sarcasm]

Don't worry about it. We can't all know everything :P
Anyway, you're probably right, I don't know what process our brain goes through when you see things.
  • 0

#20 thenoller

thenoller

    GMC Member

  • GMC Member
  • 208 posts

Posted 24 February 2011 - 10:19 PM

Thanks for the few useful inputs, and for the numerous useless but highly entertaining ones :)
I'll try that shader-extension, even though it looks overkill, functionality-wise.

BTW, that discussion above... <_<
Please get away from your computer-screens more often.

Okay, I'm kidding, cause I tend to perceive the real-world as subcategory of computer-graphics sometimes too :P

..However, I hardly think you can say that your brain "renders" anything. It has evolved to perceive the world in a certain way, because we need a certain kind of information to interact with the world around us. We perceive solid matter as solid, because our hands can't penetrate it (though matter is technically like 99% nothing and 1% electromagnetic charge). We don't perceive infra-red light as a form of visible light, because we don't need to find flowers and make honey. And the list goes on and on. Furthermore, we perceive time as floating in one irreversible direction at one unchangeable speed, because.. you know, we don't even know the answer for that one yet. A bit freaky, huh?

Point: There's no correct version of the world that has to be converted by our brains, because there's no correct way to perceive it. It depends on your needs as a species.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users