# glDrawTex orientation

**URL:** <https://forums.imgtec.com/t/gldrawtex-orientation/355>\
**Category:** PowerVR Insider\
**Created:** [May 21, 2009, 7:09pm UTC](https://forums.imgtec.com/t/gldrawtex-orientation/355 "2009-05-21T19:09:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnf](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@johnf](https://forums.imgtec.com/u/johnf)\
**Post date:** [May 21, 2009, 7:09pm UTC](https://forums.imgtec.com/t/gldrawtex-orientation/355/1 "2009-05-21T19:09:55Z")

</div>

I’m working on drawing 2D text on an OMAP35x EVM.&nbsp; I tried creating a rectangle and using a texture from a FreeType bitmap which almost worked, but I got repeating texture artifacts even after setting GL\_CLAMP\_TO\_EDGE.&nbsp; Next I tried the glDrawTex extension, which mostly worked except the orientation is portrait (I’d prefer landscape) and the glyph textures are flipped.&nbsp; This would be easy to fix with glRotate(), but glDrawTex ignores that by design.  
  
Is there an easy way to change orientation?  
  
Thanks!  
,  
John

---

<div class="post-metadata">

**Author:** ![prabindh](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@prabindh](https://forums.imgtec.com/u/prabindh)\
**Post date:** [May 22, 2009, 7:00am UTC](https://forums.imgtec.com/t/gldrawtex-orientation/355/2 "2009-05-22T07:00:55Z")

</div>

\>\>&nbsp; but I got repeating texture artifacts even after setting GL\_CLAMP\_TO\_EDGE

  

  

  

&nbsp;
  

What kind of repeats ? Are you drawing the rectangle using triangles in the right order ? Please share the vertex array definition and draw calls.

---

<div class="post-metadata">

**Author:** ![peter-quayle](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@peter-quayle](https://forums.imgtec.com/u/peter-quayle)\
**Post date:** [May 22, 2009, 8:49am UTC](https://forums.imgtec.com/t/gldrawtex-orientation/355/3 "2009-05-22T08:49:22Z")

</div>

The artifacts might be symptomatic of the downsampling in mipmaps causing letters to bleed into each other. Make sure that you’re drawing with a 1 to 1 mapping of texels to pixels. You could possibly solve your problem with glDrawTex by orienting your bitmap and adjusting your drawing routine accordingly.  
  
Pete

---

<div class="post-metadata">

**Author:** ![johnf](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@johnf](https://forums.imgtec.com/u/johnf)\
**Post date:** [May 22, 2009, 5:38pm UTC](https://forums.imgtec.com/t/gldrawtex-orientation/355/4 "2009-05-22T17:38:31Z")

</div>

It turns out the problem with repeating textures was with the glTexImage2D() call.&nbsp; Both texture data format parameters were GL\_RGBA, but had to be GL\_LUMINANCE\_ALPHA.&nbsp; The resulting visuals made it look like a clamping problem.  
  
I was able to transpose bitmap rows and columns and got the desired landscape orientation.  
  
Thanks!  
,  
John

---

<div class="post-metadata">

**Author:** ![xmas](https://avatars.discourse-cdn.com/v4/letter/x/958977/32.png) [@xmas](https://forums.imgtec.com/u/xmas)\
**Post date:** [May 26, 2009, 8:25am UTC](https://forums.imgtec.com/t/gldrawtex-orientation/355/5 "2009-05-26T08:25:01Z")

</div>

You can specify the sub-rectangle of the texture you want to use with glDrawTex by setting the texture parameter GL\_TEXTURE\_CROP\_RECT\_OES. By using negative width or height there you can also flip the texture orientation:  
  
  
  
  
  
GLint crop\_rect[] = { 0, 0, -64, -64 }; // (u, v, width, height), in texels  
  
  
glTexParameteriv(GL\_TEXTURE\_2D, GL\_TEXTURE\_CROP\_RECT\_OES, crop\_rect);

---

<div class="post-metadata">

**Author:** ![johnf](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@johnf](https://forums.imgtec.com/u/johnf)\
**Post date:** [May 27, 2009, 2:36pm UTC](https://forums.imgtec.com/t/gldrawtex-orientation/355/6 "2009-05-27T14:36:48Z")

</div>

That’s good to know.&nbsp; Thanks!  
,  
John
