ramymabrouk Posted May 15, 2016 Share Posted May 15, 2016 hi, i am exporting a mesh array from blender and applying texture on the meshes, it works fine if i dont group the mesh array into a single mesh, which is required to implement drag and drop, it generates this error "(index):1 [.CommandBufferContext]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 2" when i merge textured meshes or add texture to merged meshes, any ideas ? (the imported .babylon file is attached) sofa.babylon Quote Link to comment Share on other sites More sharing options...
gryff Posted May 15, 2016 Share Posted May 15, 2016 Hi Ramy, welcome to the forum. I'm no scripter so I will leave them to explain the error and how to get around it in code. However, there are some workarounds: 1. Merge the meshes in Blender - probably have to rework the UVs though. 2. A solution that I suggested on this thread A variation on 2 would be to make a simple LOD mesh for the whole sofa, make it transparent, pickable and the parent to all the other messages. cheers, gryff Quote Link to comment Share on other sites More sharing options...
ramymabrouk Posted May 16, 2016 Author Share Posted May 16, 2016 Hi gryff, Thank you for your answer, actually I used Tags instead of merging because there is no unmerge utility and it has to use one texture and in some cases the same mesh groups may have more than one texture. thank you Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted May 16, 2016 Share Posted May 16, 2016 you can have a more texture with shader builder but need to know where you want to use can you make playground or any example? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 16, 2016 Share Posted May 16, 2016 Could you share your code on the playground? Seeing the error live could help a lot Quote Link to comment Share on other sites More sharing options...
ramymabrouk Posted May 19, 2016 Author Share Posted May 19, 2016 Hi, unfortantly I do not know how to upload files to the playground, please find my code and the attached files function addsofa(filename) { // The first parameter can be used to specify which mesh to import. Here we import all meshes BABYLON.SceneLoader.ImportMesh("", "assets/scenes/", filename + ".babylon", scene, function (newMeshes) { // Set the target of the camera to the first imported mesh // camera.target = newMeshes; tagname = randString(10); for (i=0;i<newMeshes.length;i++){ newMeshes[i].material = new BABYLON.StandardMaterial(tagname + i, scene); newMeshes[i].material.emissiveTexture = new BABYLON.Texture("assets/textures/tex5.jpg",scene,true,false,2) newMeshes[i].material.diffuseColor = new BABYLON.Color3(0,0,0); newMeshes[i].material.specularColor = new BABYLON.Color3(0,0,0); BABYLON.Tags.EnableFor(newMeshes[i]); newMeshes[i].addTags(tagname); } var newMesh = new BABYLON.Mesh.MergeMeshes(newMeshes); }); } the last files is the one generating the error sofa.babylon Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 19, 2016 Share Posted May 19, 2016 You can just save your .babylon to dropbox or onedrive and reference it Does your code works without tags stuff? Quote Link to comment Share on other sites More sharing options...
ramymabrouk Posted May 19, 2016 Author Share Posted May 19, 2016 the tags stuff is added later, i have used it to identify the meshes, it is working great Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 19, 2016 Share Posted May 19, 2016 So sorry, I'm not sure to understand what is your problem then Quote Link to comment Share on other sites More sharing options...
ramymabrouk Posted May 19, 2016 Author Share Posted May 19, 2016 so far I have solved my problem, in fact the merging approach was not the best one, but I thought the error I have found may be something important, and I am very thankful for your interest. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.