Setting Texture coordiantes Manually

Well currently I only try to set the texture of every single vertex to the half of my loaded texture. the texture is .

However where ever I use the method shown below the object is just plain black.


   private static void GenerateSingleLightmap(TriMesh togenerate){
      TextureState texstate = (TextureState) togenerate.getRenderState(StateType.Texture);
      if(texstate == null){
         texstate = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
      }
      int nextunit = texstate.getNumberOfSetTextures();
      texstate.setTexture(shadtex,nextunit);
      
      Triangle[] triangles = togenerate.getMeshAsTriangles(new Triangle[togenerate.getTriangleCount()]);
      ByteBuffer bytebuffer = ByteBuffer.allocateDirect(6*triangles.length*4);
      TexCoords texcords = new TexCoords(bytebuffer.asFloatBuffer(),2);
      int index = 0;
      int triangleindex = 0;
      
      texcords.coords.rewind();
      while(index < texcords.coords.limit()){
         Triangle triangle = triangles[triangleindex];
         
          texcords.coords.put(1f);
          texcords.coords.put(0f);
         
         
          texcords.coords.put(1f);
          texcords.coords.put(0f);
         

          texcords.coords.put(1f);
          texcords.coords.put(0f);
         
          triangleindex++;
          index += 6;
      }
      togenerate.setRenderState(texstate);
      togenerate.setTextureCoords(texcords,nextunit);
      togenerate.updateRenderState();
      DisplaySystem.getDisplaySystem().getRenderer().checkCardError();
   }

Hello,



it seems to me that the texture coordinates  you are assigning to your vertexes are not right… As you are using (1,0) for every vertex, you get all your triangles colored with the same color, inj this case,  white.



Try other combination of texture coordinates, for example: (1,0) (0,1) and (0,5, 0.5). This way you should see the texture and probably some extrange artifacs in it dependingt on the shape of your triangle



hope this helps