Rendering Gradients?

Home Forums Monkey 2 Programming Help Rendering Gradients?

Tagged: 

This topic contains 7 replies, has 4 voices, and was last updated by  scurty 5 days, 8 hours ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #12119

    scurty
    Participant

    Hate to be “that guy” my knowledge of rendering of no0b level.
    How does one draw this kind of primitive using mojo? Or does it have to be done in GL?
    To be clear without an Image if possible.
    I see DrawPrimitives() though not sure how to utilize the arguments.

    #12129

    Ethernaut
    Participant

    I’m not passing texture coordinates or an image, just the vertex coordinates and the colors for each vertex.
    You could turn this into a function that draws the primitive using rotation, etc.

    Notice that you can have each vertex a different color to get a 4 color gradient!

    #12130

    nerobot
    Participant

    Nice!

    One note about converting Color into UInt:

    There is an ABGR format! I suppose, it’s a native opengl format.

    That’s why if you write color as $FF0000FF you’ll get Red color but you can expect Blue here.

    #12143

    scurty
    Participant

    Fantastic! So much better than what I was gonna do. Thanks. 😛

    #12153

    Ethernaut
    Participant

    There is an ABGR format

    Thanks, I was wondering about that.
    When I tried actual RGBA order I was getting the wrong colors and didn’t know why!

    #12163

    Mark Sibly
    Keymaster

    Hmmm, I could possibly add a ‘GradientColors’ array or similar to canvas for this?

    #12166

    nerobot
    Participant

    Something like:

    Don’t know how to implement Circle gradient, but maybe you know.

    Or to make centerColor an usual part with percentage of 0% and to remove this parameter.

    And a custom case for circle is using 2 colors – center and outer:

    #12190

    scurty
    Participant

    That would be cute, lovely and waay easier than accessing the raw pointer from an Array.
    I picture:

     

    ColorContext would be new of course. Or just use .Color and have GradientColor extend Color

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.