Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
setTextureCoordinate() crashes after so many items in array — Gideros Forum

setTextureCoordinate() crashes after so many items in array

JohnJohn Member
edited January 16 in Bugs and issues
I'm writing one of those circular progress bars using mesh and it works fine until adding around 47th item. Each loop I call clearTextureCoordinateArray() before calling a series of setTextureCoordinate() which eventually crashes.

If I add resizeTextureCoordinateArray() after the clear then it all works fine.

self.m_timerMesh:clearTextureCoordinateArray()
self.m_timerMesh:resizeTextureCoordinateArray(200)


According to this page:https://wiki.giderosmobile.com/index.php/Mesh:setTextureCoordinate

Indices start from 1. If the texture coordinate array is not large enough, it is automatically expanded.

That does not seem to be the case here.

Comments

  • https://wiki.gideros.rocks/index.php/Mesh
    the Mesh class doesn't do bounds check: if an element at index array points to an non-existent vertex, the application may crash


    That may be the issue here?
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • JohnJohn Member
    If it was then I doubt self.m_timerMesh:resizeTextureCoordinateArray(200) would fix that particular problem. Also, if I don't use texture at all that too work fine and so the vertex and index are correct and it visually looks correct too without any crashes.
  • JohnJohn Member
    I'll post some code if it not reproducible - I am a little too busy at the moment and I need to extract it from full project with minimum amount of code / images.

    Likes: MoKaLux, hgy29

    +1 -1 (+2 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    I reviewed current Gideros code and it could crash if:
    - you attempt to set texture coordinate at an index below 1 (I will add a check for this in the code, but I doubt this is your issue)
    - your indices array contains an index pointing outside your texture (or vertex, or color) array while rendering the frame. This is the case @MoKaLux mentionned.

    So since your clear your texture coordinates and fill them up afterwise, do you also clear your index array at the same time ?
Sign In or Register to comment.