title: OpenGL Lines with textures
body: <p>I want to create a electric lightning in OpenGl. For that I wrote this function:</p>
  
  <pre><code>public Blitz()
  {
      points = new float[STEPS * 3];
  
      for(int i = 0; i &lt; STEPS; i += 3)
      {
          points[i]     = (float) (startX + i * (endX - startX) / STEPS);
          points[i + 1] = (float) (startY + i * (endY - startY) / STEPS);
          points[i + 2] = 0;
      }
  
      // ...
      vertexBuffer.put(points);
      vertexBuffer.position(0);
  
  }
  
  public void update()
  {
      for(int i = 0; i &lt; STEPS; i += 3)
      {
          float rnd = random(); // creates rnd float
  
          if(points[i] + rnd &lt; startX + 5 &amp;&amp; points[i] + rnd &gt; startX - 5)
          {
              points[i] += rnd;
          }
      }
  
      vertexBuffer.clear();
      vertexBuffer.put(points);
      vertexBuffer.position(0);
  }
  
  public void render()
  {
      texture.bind();
  
      gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
      gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
  
      gl.glLineWidth(10);
      gl.glDrawArrays(GL10.GL_LINE_STRIP, 0, STEPS);
  }
  </code></pre>
  
  <p>Here is my Texture Class that I use for my textures:</p>
  
  <pre><code>public class Texture 
  {
      private GL10 gl;
  
      FloatBuffer texCoords;
      private int textureID;
  
      public Texture(GL10 gl, Bitmap bmp)
      {   
          this.gl = gl;
  
          int[] TextureIDs = new int[1];
          gl.glGenTextures(1, TextureIDs, 0);     
          textureID = TextureIDs[0];
  
          gl.glBindTexture(GL10.GL_TEXTURE_2D, textureID);
          GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, bmp, 0);
  
          gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
          gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
          gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
          gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
  
          ByteBuffer buffer = ByteBuffer.allocateDirect( 4 * 2 * 4 );
          buffer.order(ByteOrder.nativeOrder());
          texCoords = buffer.asFloatBuffer(); 
          texCoords.put(0);
          texCoords.put(0);
  
          texCoords.put(0);
          texCoords.put(1);
  
          texCoords.put(1);
          texCoords.put(1);
  
          texCoords.put(1);
          texCoords.put(0);       
          texCoords.rewind();
      }
  
      public void bind()
      {   
          gl.glEnable(GL10.GL_BLEND);
          gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_SRC_ALPHA);
  
          gl.glEnable(GL10.GL_TEXTURE_2D);
          gl.glBindTexture(GL10.GL_TEXTURE_2D, textureID);
          gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
          gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, texCoords);
      }
  
      public void dispose()
      {
          int[] textures = {textureID};
          gl.glDeleteTextures(1, textures, 0);
          textureID = 0;              
      }
  }
  </code></pre>
  
  <p>With a normal color all works great but if I want to put this texture on the lines it comes to this result:</p>
  
  <p><img src="https://i.stack.imgur.com/VQDKv.png" alt="Electric Texture">
  <img src="https://i.stack.imgur.com/aJhdV.png" alt="Result"></p>
  
  <p>Do you have any ideas why? What is my mistake?</p>