With this release I've renamed all Mesh:*Buffer functions with Mesh:*Array because the old function names can confuse people who know about Vertex Buffer Objects (VBO) and Index Buffer Objects (IBO).
Here I choose not to preserve backward compatibility because Meshes have been introduced very recently and I hope currently it's not widely used If you prefer old function names, you can put this code to your init.lua:
I'm testing the mesh api, it makes my drawing engine at least 2 times faster, so i'm quite happy with it. Yet now i found a bug, namely that although mesh is inherited from sprite according to the manual, the line " mymesh:setAlpha(0.1) " does not change the transparency value. could you look into this please.
@keszegh If you're using color vertices, then it's a limitation of meshes: If you look at reference manual, you see: If color array is set, then setAlpha and setColorTransform functions doesn’t effect the Mesh sprite.
If you're not using color vertices, then it's a bug
Thanks for the answer, thus it is not a bug but a missing feature (i use color vertices). It is very inconvenient. When i try to fade out a scene with meshes, it just does not fade the meshes part, which looks quite ugly currently. So do i understand right that either all triangles in a mesh have the same color or you cannot apply setAlpha? or is there other way besides colorarray to change colors of individual triangles? If there is no other way to color, would you please consider getting rid of this limitation in a future release? i would want to use meshes, currently if nothing else i suggested above is possible then i have to set the whole color-array if i want to fade out, which is not a nice solution (especially that i have a complex hierarchy of meshes, so doing the fading in all of them is quite tedious - compared to setting the alpha of their parent).
@keszegh If you're using color vertices, then it's a limitation of meshes: If you look at reference manual, you see: If color array is set, then setAlpha and setColorTransform functions doesn’t effect the Mesh sprite.
If you're not using color vertices, then it's a bug
Currently to only way to get rid of this limitation is moving to OpenGL ES 2.0 and using shaders. With OpenGL ES 1.1, it's not possible to combine setAlpha/setColorTransform with color vertices efficiently.
@louis, you need to add launch image Default-568h@2x.png to your project to enable iPhone 5 display. If you search for "Default-568h@2x.png", you can reach plenty of information.
I think that is an Apple issue, it can be resolved with placing an image called Default-568h@2x.png that is 1136x640. That will make the app use all of the screen available and not show the black borders. it is strange and funny how this is, but that is how it is.
@Atilim, you beat me to it by 4 minutes, while I was testing another one of my apps.... I had that info typed up 5 minutes ago, but wanted to test before posting
@keszegh If you're using color vertices, then it's a limitation of meshes: If you look at reference manual, you see: If color array is set, then setAlpha and setColorTransform functions doesn’t effect the Mesh sprite.
If you're not using color vertices, then it's a bug
So now i wanted to make a function that sets alpha for all the indices to emulate setAlpha, yet i don't find any function to GET (and not SET) the info from the mesh, namely i need now to get info from the colorarray. is there any way? if not, then there is almost no way to modify the alpha of a mesh, which is quite a limitation (i can imagine having an additional colorarray_dummy table where i keep track of the actual colorarray, and in each call i reset the whole colorarray using info from the dummy, but this seems to be a tedious and probably more importantly slow solution for the problem). please make alpha settable in one way or another (even if this need opengl2).
After your suggestion, I've already decided to add some Mesh:get* functions to get vertex, index, color, etc information stored internally.
Note : Those informations were shared in a private discussion (that I started myself) and I thought several times about whether those informations were totally private or not, and I believe those ones specifically were not, and it would be in the benefit of Gideros if it was shared to reassure devs that all the functions will be available to have better control of the Mesh objects. I am not the kind of person to make private conversations public. I am convinced it's just that Atilim didn't get the opportunity to share it on the forum, and if I'm mistaking please correct me and I'll listen to Justin Bieber all day as punishment.
I hope you are right about forthcoming get functions. Actually what i would find even more useful is to have a function to set only the alpha of a vertex, then i don't need to care about getting all the color values, to fade i could just set the whole alpha array to some given value (as i just want to fade the whole mesh, so for this i don't need to get the alphas of each vertex, i can store it in one variable).
@keszegh In the meantime, if your goal is to set the whole alpha array to some given value, you could add your mesh to a container (Sprite) and change its alpha instead. I know that it adds another level to your hierarchy, but I found it easier to use meshes and keep easy control over it that way.
@keszegh In the meantime, if your goal is to set the whole alpha array to some given value, you could add your mesh to a container (Sprite) and change its alpha instead. I know that it adds another level to your hierarchy, but I found it easier to use meshes and keep easy control over it that way.
Thanks, but this is exactly the problem, that this cannot be done after you use colorarray in your mesh (i.e. when not all your triangles are the same color). In this case even if you set the container sprite alpha to e.g. 0.5, the mesh inside remains non-transparent.
Comments
With this release I've renamed all Mesh:*Buffer functions with Mesh:*Array because the old function names can confuse people who know about Vertex Buffer Objects (VBO) and Index Buffer Objects (IBO).
Here I choose not to preserve backward compatibility because Meshes have been introduced very recently and I hope currently it's not widely used If you prefer old function names, you can put this code to your init.lua:
thank you,
Likes: OZApps
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
I'm testing the mesh api, it makes my drawing engine at least 2 times faster, so i'm quite happy with it. Yet now i found a bug, namely that although mesh is inherited from sprite according to the manual, the line " mymesh:setAlpha(0.1) " does not change the transparency value. could you look into this please.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
If you're not using color vertices, then it's a bug
So do i understand right that either all triangles in a mesh have the same color or you cannot apply setAlpha? or is there other way besides colorarray to change colors of individual triangles?
If there is no other way to color, would you please consider getting rid of this limitation in a future release? i would want to use meshes, currently if nothing else i suggested above is possible then i have to set the whole color-array if i want to fade out, which is not a nice solution (especially that i have a complex hierarchy of meshes, so doing the fading in all of them is quite tedious - compared to setting the alpha of their parent).
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Why added Default-568h@2x.png to project ,it display correctly? This is apple's bug?
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Fragmenter - animated loop machine and IKONOMIKON - the memory game
After I started this discussion [How does the new Mesh API work?] I contacted @atilim and he said the following : Note : Those informations were shared in a private discussion (that I started myself) and I thought several times about whether those informations were totally private or not, and I believe those ones specifically were not, and it would be in the benefit of Gideros if it was shared to reassure devs that all the functions will be available to have better control of the Mesh objects.
I am not the kind of person to make private conversations public.
I am convinced it's just that Atilim didn't get the opportunity to share it on the forum, and if I'm mistaking please correct me and I'll listen to Justin Bieber all day as punishment.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
In the meantime, if your goal is to set the whole alpha array to some given value, you could add your mesh to a container (Sprite) and change its alpha instead.
I know that it adds another level to your hierarchy, but I found it easier to use meshes and keep easy control over it that way.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
What was I thinking, please consider my previous comment totally useless #-o
Cheers
Gary
can you tell me if mesh:get... functions will be in the very next version? (2012.09.11 i think)
Fragmenter - animated loop machine and IKONOMIKON - the memory game