title: Repeating Textures in OpenGL
body: <p>Hi i am quite new to OpenGL.</p>
  
  <p>My task is to implement the GDI brushes in OpenGL for drawing on MAC OS X.  Thus I turned to textures in OpenGL to first draw the pattern and then this needs to be mapped to drawing primitives such as a polygon (rectangle a case in point).  I am creating a 8x8 texels texture and then mapping it on a polygon with co ordinates below on a 500x500 pixels window.</p>
  
  <p>glVertex3f(0.35, 0.35, 0.0);</p>
  
  <p>glVertex3f(0.35, 0.65, 0.0);</p>
  
  <p>glVertex3f(0.65, 0.65, 0.0);</p>
  
  <p>glVertex3f(0.65, 0.35, 0.0); </p>
  
  <p>I since I need a brush effect the pattern must be repeated along the rectangle.  The rectangle/square is 0.3 x 0.3 and the whole window is 500 x 500 then in terms of pixels the polygon is 150 x 150.</p>
  
  <p>therefore repetitions required are 150/8 </p>
  
  <p>I therefore set the texture coordinates as follows:</p>
  
  <pre><code>glTexCoord2f(0.0,       0.0);   glVertex3f(0.35, 0.35, 0.0);
  glTexCoord2f(0.0,       150/8); glVertex3f(0.35, 0.65, 0.0);
  glTexCoord2f(150/8,     150/8); glVertex3f(0.65, 0.65, 0.0);
  glTexCoord2f(150/8,     0.0);   glVertex3f(0.65, 0.35, 0.0);
  </code></pre>
  
  <p>I am having a problem that the vertical hatching (one texel transparent the other coloured) pattern I have created as a texture is  not being appropriately mapped in the sense that  some vertical lines are getting wider than others ( a sort of aliasing problem).  Is it like this that I have to set the texture coordinates while mapping?</p>
  
  <p>Thanks for any replies</p>
  
  <p>al</p>