glDrawTex orientation

This topic contains 5 replies, has 4 voices, and was last updated by  johnf 8 years, 5 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #29802

    johnf
    Member

    I’m working on drawing 2D text on an OMAP35x EVM.  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.  Next I tried the glDrawTex extension, which mostly worked except the orientation is portrait (I’d prefer landscape) and the glyph textures are flipped.  This would be easy to fix with glRotate(), but glDrawTex ignores that by design.

    Is there an easy way to change orientation?

    Thanks!
    ,
    John

    #33068

    prabindh
    Member

    >>  but I got repeating texture artifacts even after setting GL_CLAMP_TO_EDGE

     

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

    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

    #33070

    johnf
    Member

    It turns out the problem with repeating textures was with the glTexImage2D() call.  Both texture data format parameters were GL_RGBA, but had to be GL_LUMINANCE_ALPHA.  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

    #33071

    Xmas
    Member

    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);

    #33072

    johnf
    Member

    That’s good to know.  Thanks!
    ,
    John

Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.