I'm trying to put texture on the quads of a quadbatch, but setting the TextureState to the QuadBatch doesnt work, or just partially. The color of the Quads are of one color and doesnt show the texture correctly. What should I do?
QuadBatch[] qbStrips = new QuadBatch[10*10];
Texture qtexture = TextureManager.loadTexture("./data/textures/low/"+"grass21.jpg",Texture.MM_LINEAR,
Texture.FM_LINEAR);
int c = 0;
for (int x=-5; x<5; x++) {
for (int y=-5; y<5; y++) {
QuadBatch qbQuads = new QuadBatch();
qbQuads.setMode(QuadBatch.QUADS);
qbQuads.setModelBound(new BoundingBox());
bmesh = new BatchMesh("batches", (GeomBatch[])qbStrips);
bmesh.updateRenderState();
cRootNode.attachChild(bmesh);
Any ideas? Anyone who did this successfully?
I've tried to mess with Texture's functions (rotation, scale, wrap), but couldnt find a working solution. Always single coloured Quads, instead of the texture...
Thanks for giving attention to it. It would be very nice to have a working example, to see, if my code is wrong, or is it really some kind of bug or an unimplemented feature?
Than let me ask a question if I can workaround the whole thing. So the thing is, I want batched (not dynamic, but static, unmoving in the first round) Grass in my JME project. I've found that QuadBatches are very fast rendered in big quantity too, so I tried to texturize it with my texture (maybe later I want to use transparent textured bigger quads, not thin grass like quads) but that didnt work. So what do you advice, how to create grass in a JME app without great performance loss? (I've tried with blender plane meshes with transparent texture, but it was very slow in big quantity.)
Thanks! I've already stumbled into that thread... I will read it again with more focus on my project's need... I think it won't be easy to tune, but not impossible.
QuadBatch would be more easy to tune, so looking forward to any news on any example or success with texturizing it!
FYI: MrCoder just informed me that he was able to get texturing to work on all mesh batch types in the mentioned Test by simply assigning proper tex coords and a texture. I'll let him describe any steps or update the test though.
Updated the test(TestBatchMesh) and added texturing, so have a look at that. Nothing special, cause every batch type is textured exactly the same way, so there's nothing special with QuadBatches(only the indexing is different).