Results 1 to 9 of 9

Thread: Problem Texturing with GL_TEXTURE_RECTANGLE

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2002
    Posts
    19

    Problem Texturing with GL_TEXTURE_RECTANGLE

    I'm drawing a quad to the screen made up of a triangle strip and have a texture on this using GL_TEXTURE_RECTANGLE, everything looks fine until I move a point on the quad(say to stretch from the corner) the texture on the quad doesn't stretch 'properly', it looks as if it is stretching only 1 triangle of the triangle-stripped quad(the other side remains normal) and this effect happens even if i'm using a quad instead of a triangle strip. Is there limitations to using GL_TEXTURE_RECTANGLE in this way? obviously its not noticeable when the quad remains rectangular but is there some solution to this? I'm not using any normals for the quad but should this effect the texture anyways?

    Thanks in advance

  2. #2
    Member Contributor
    Join Date
    May 2006
    Posts
    55

    Re: Problem Texturing with GL_TEXTURE_RECTANGLE

    Someone else may jump right in and tell me I'm wrong but the word on the street is to avoid the GL_TEXTURE_RECTANGLE extension as its performance is ropey or the implementations out there are variable.

    You would be fine using the usual GL_TEXTURE_2D even for none-square textures.

    Can someone verify the veracity of that opinion?

    Personally I use GL_TEXTURE_2D for all my rectangle needs except for OpenGL 1.0 hardware where a none-square texture comes out as a white rectangle.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2002
    Posts
    19

    Re: Problem Texturing with GL_TEXTURE_RECTANGLE

    My hardware doesn't support non-power of 2 textures so its either this or blit my non power of 2 into a p-o-t texture with wasted space? but regarding my initial problem i guess its caused by the fact that even if you're rendering a quad that its broken down to 2 triangles when rendering so this kind of explains why i'm not getting the behavior i expect when i stretch a point out and see that only half of it is actually being stretched(texture-wise).

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    990

    Re: Problem Texturing with GL_TEXTURE_RECTANGLE

    I believe you will experience the same problem whether you use texture rectangles or power-of-2 textures. The problem is that when you're moving the point, the area of the rectangle doesn't align with the texture area anymore, meaning that splitting the quad in to two triangles causes the texture coordinate derivatives to be non-continuous in screen space.

  5. #5
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,966

    Re: Problem Texturing with GL_TEXTURE_RECTANGLE

    As nico says the issue is the linear interpolation within the triangles. It is similar to the issue of perspective correction (or rather the problems you see when you don't perspective correct).

    When you grab a vertex what interpolation do you expect accross the quad? This does not have a known solution like a perspective warp, you're applying an arbirtary 2D warp to the coordinates.

    You could try fudging the homogeneous vertices based on edge length but I don't think it will work for you. Subdiviaion of the mesh will probably give you the warp you're looking for.

  6. #6
    Junior Member Newbie
    Join Date
    Jul 2002
    Posts
    19

    Re: Problem Texturing with GL_TEXTURE_RECTANGLE

    Thanks for the responses, I get whats happening now and will probably give the subdividing technique a try...another thing, is the performance and implementation of GL_TEXTURE_RECTANGLE really that sketchy that I should avoid using it as the second poster has suggested? If my hardware doesn't support non-power-of-two textures what are my other possible options?

  7. #7
    Junior Member Newbie
    Join Date
    Jul 2002
    Posts
    19

    Re: Problem Texturing with GL_TEXTURE_RECTANGLE

    kingc8, actually I just tested out loading up and rendering a non-power-of-2 tex with GL_TEXTURE_2D and although it worked(my hardware supports 2.0 gl) it was horrendously slow, made my system crawl(ati firegl laptop) but when i used GL_TEXTURE_RECTANGLE everything's fine, what gives?

  8. #8
    Senior Member Regular Contributor
    Join Date
    Aug 2007
    Location
    USA
    Posts
    243

    Re: Problem Texturing with GL_TEXTURE_RECTANGLE

    This is just a sign that your hardware doesn't support NPOT textures and dropped back to software, so you should just stick with a texture rectangle instead.

  9. #9
    V-man
    Guest

    Re: Problem Texturing with GL_TEXTURE_RECTANGLE

    If you want to know if it is hw accelerated, check the GL version, which should be 2.0 and above.
    Then check to see if GL_ARB_texture_non_power_of_two exists.
    If it exists : hw accelerated
    If not : the driver emulates

    Gf 6 and up support it.

Similar Threads

  1. GL_TEXTURE_RECTANGLE not recognized
    By smiller192 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-14-2012, 06:20 AM
  2. Moving to GL_TEXTURE_RECTANGLE
    By Rennie Johnson in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 11-08-2011, 09:18 PM
  3. GL_TEXTURE_RECTANGLE with GLuint data?
    By PrestoChung in forum OpenGL: Basic Coding
    Replies: 24
    Last Post: 01-28-2011, 05:34 AM
  4. glCopyTexImage2D + GL_TEXTURE_RECTANGLE on Ati board bug
    By imported_muratmat in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 12-27-2005, 08:09 AM
  5. glsl + GL_TEXTURE_RECTANGLE on ATI 9700 / (win32)
    By henniman in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 12-11-2005, 02:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean