(Bug) Canvas-related?

About Monkey 2 Forums Monkey 2 Development (Bug) Canvas-related?

This topic contains 3 replies, has 2 voices, and was last updated by  impixi 2 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1277

    impixi
    Participant

    The 16th call to a method or function that creates a Canvas object will generate an array index error.

    Example:

    [/crayon]

    Console output:

    Array index out of range
    {{!DEBUG!}}
    >Bind:Void(env:mojo.graphics.ShaderEnv);C:/monkey2/modules/mojo/graphics/shader.monkey2;290;21321307
    Self:mojo.graphics.Shader=@00c12a3c
    env:mojo.graphics.ShaderEnv=@03ee29ac
    >Validate:Void();C:/monkey2/modules/mojo/graphics/device.monkey2;317;21321306
    Self:mojo.graphics.GraphicsDevice=@03ee3e84
    >Render:Void(vertices:mojo.graphics.Vertex2f Ptr,order:Int,count:Int);C:/monkey2/modules/mojo/graphics/device.monkey2;168;21321305
    Self:mojo.graphics.GraphicsDevice=@03ee3e84
    vertices:mojo.graphics.Vertex2f Ptr=?????
    order:Int=32
    count:Int=1
    >RenderDrawOps:Void();C:/monkey2/modules/mojo/graphics/canvas.monkey2;900;21321276
    Self:mojo.graphics.Canvas=@09a1b284
    p:mojo.graphics.Vertex2f Ptr=?????
    0:std.collections.Stack<mojo.graphics.DrawOp>.Iterator=@00b5f9e8:0045ef94
    op:mojo.graphics.DrawOp=@03ee4144
    >Flush:Void();C:/monkey2/modules/mojo/graphics/canvas.monkey2;251;21321273
    Self:mojo.graphics.Canvas=@09a1b284
    >GenerateImage:mojo.graphics.Image();C:/Shane2016g/SimpleFW2016/bi/bugtest.monkey2;47;20198698
    Self:default.MyWindow=@00c91c4c
    img:mojo.graphics.Image=@03ee266c
    imgCanvas:mojo.graphics.Canvas=@09a1b284
    >Init:Void(canvas:mojo.graphics.Canvas);C:/Shane2016g/SimpleFW2016/bi/bugtest.monkey2;36;3357663
    Self:default.MyWindow=@00c91c4c
    canvas:mojo.graphics.Canvas=@00c4e73c
    i:Int=15
    >OnRender:Void(canvas:mojo.graphics.Canvas);C:/Shane2016g/SimpleFW2016/bi/bugtest.monkey2;54;3357662
    Self:default.MyWindow=@00c91c4c
    canvas:mojo.graphics.Canvas=@00c4e73c
    >Render:Void(canvas:mojo.graphics.Canvas);C:/monkey2/modules/mojo/app/view.monkey2;648;3356823
    Self:mojo.app.View=@00c91c4c
    canvas:mojo.graphics.Canvas=@00c4e73c
    >Render:Void();C:/monkey2/modules/mojo/app/window.monkey2;152;3355860
    Self:mojo.app.Window=@00c91c4c
    bounds:std.geom.Rect<Int>=@00b5fcec:004c1360
    >MainLoop:Void();C:/monkey2/modules/mojo/app/app.monkey2;307;3355375
    Self:mojo.app.AppInstance=@00c106fc
    0:Void[]=@00c1705c
    1:Int=0
    2:Int=1
    window:mojo.app.Window=@00c91c4c
    >Run:Void();C:/monkey2/modules/mojo/app/app.monkey2;334;3355372
    Self:mojo.app.AppInstance=@00c106fc
    >Main:Void();C:/Shane2016g/SimpleFW2016/bi/bugtest.monkey2;10;89

    It’s apprently related to the _programs:=New ShaderProgram[16] field in the Shader class not being reset when creating a new Canvas object (because the Canvas shader fields are declared Global).

    I’ve tried hacking the relevent mojo files to fix/work around it but my efforts have failed thus far…

    #1278

    Mark Sibly
    Keymaster

    16 canvases should be enough for anyone!

    Actually, I think this is fixed in my version…it works at 10000 anyway.

    New stuff coming soon!

    #1280

    impixi
    Participant

    16 canvases should be enough for anyone!

    Haha, not if, for performance reasons, you want to pre-generate variably-sized images of blocks of text/labels/buttons/lists/etc. 🙂

    EDIT: I should clarify, I’m only using 1 canvas at a time, local to a function/ method while rendering to an image.

    Actually, I think this is fixed in my version…it works at 10000 anyway.

    New stuff coming soon!

    Great. Can’t wait to test it out… Might even be time soon for another donation. 😉

    #1453

    impixi
    Participant

    Yes, this is fixed in V1.0.0. Thanks.

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

You must be logged in to reply to this topic.