Non-power of 2 textures no longer working?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Non-power of 2 textures no longer working?

nick.collier
We'd like to update to the 2.1.0 release and are doing some tests. It looks like non-power 2 textures don't work, although in a previous build (981) they seemed to have done. Here's the code:

texture = AWTTextureIO.newTexture(gl.getGLProfile(), img, true);
  
// this returns true in 2.1.0
    System.out.println(gl.isNPOTTextureAvailable());
    
    float width = texture.getWidth() / 2f;
    float height = texture.getHeight() / 2f;
    
    listIndex = gl.glGenLists(1);
    gl.glNewList(listIndex, GL2.GL_COMPILE);
    gl.glBegin(GL2.GL_QUADS);

    TextureCoords tc = texture.getImageTexCoords();
    gl.glTexCoord2f(tc.left(), tc.bottom());
    gl.glVertex2f(-width, -height);

    gl.glTexCoord2f(tc.right(), tc.bottom());
    gl.glVertex2f(width, -height);

    gl.glTexCoord2f(tc.right(), tc.top());
    gl.glVertex2f(width, height);

    gl.glTexCoord2f(tc.left(), tc.top());
    gl.glVertex2f(-width, height);
    
    gl.glEnd();
    gl.glEndList();

I realize display lists should no longer be used but this code is old and has been part of our application for a while. Regardless, when I use a 30x30 image in build 981 of jogl the texture renders as expected. If I use the same image in 2.1.0 it doesn't render and there are no error messages. If I resize the image to 32x32 it renders as expected. This occurs on both OSX and Linux, but I haven't tested on windows. Anyway, I can try to make a proper bug report if the above should actually work with a 30x30 image.

Nick
Reply | Threaded
Open this post in threaded view
|

Re: Non-power of 2 textures no longer working?

Sven Gothel
Administrator
On 10/17/2013 09:44 PM, nick.collier [via jogamp] wrote:

> We'd like to update to the 2.1.0 release and are doing some tests. It looks
> like non-power 2 textures don't work, although in a previous build (981) they
> seemed to have done. Here's the code:
>
> texture = AWTTextureIO.newTexture(gl.getGLProfile(), img, true);
>  
> // this returns true in 2.1.0
>     System.out.println(gl.isNPOTTextureAvailable());
>    
>     float width = texture.getWidth() / 2f;
>     float height = texture.getHeight() / 2f;
>    
>     listIndex = gl.glGenLists(1);
>     gl.glNewList(listIndex, GL2.GL_COMPILE);
>     gl.glBegin(GL2.GL_QUADS);
>
>     TextureCoords tc = texture.getImageTexCoords();
>     gl.glTexCoord2f(tc.left(), tc.bottom());
>     gl.glVertex2f(-width, -height);
>
>     gl.glTexCoord2f(tc.right(), tc.bottom());
>     gl.glVertex2f(width, -height);
>
>     gl.glTexCoord2f(tc.right(), tc.top());
>     gl.glVertex2f(width, height);
>
>     gl.glTexCoord2f(tc.left(), tc.top());
>     gl.glVertex2f(-width, height);
>    
>     gl.glEnd();
>     gl.glEndList();
>
>
> I realize display lists should no longer be used but this code is old and has
> been part of our application for a while. Regardless, when I use a 30x30 image
> in build 981 of jogl the texture renders as expected. If I use the same image
> in 2.1.0 it doesn't render and there are no error messages. If I resize the
> image to 32x32 it renders as expected. This occurs on both OSX and Linux, but
> I haven't tested on windows. Anyway, I can try to make a proper bug report if
> the above should actually work with a 30x30 image.
Pls file a bug report, I will tackle this issue ASAP.

No test case needed .. assuming you used a GLProfile >= GL3[bc]
which always supports NPOT.

Or are you using some OpenGL [1.1..1.4] context ?

Thank you.

~Sven



signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Non-power of 2 textures no longer working?

Sven Gothel
Administrator
In reply to this post by nick.collier
On 10/17/2013 11:12 PM, Sven Gothel wrote:

> On 10/17/2013 09:44 PM, nick.collier [via jogamp] wrote:
>> We'd like to update to the 2.1.0 release and are doing some tests. It looks
>> like non-power 2 textures don't work, although in a previous build (981) they
>> seemed to have done. Here's the code:
>>
>> texture = AWTTextureIO.newTexture(gl.getGLProfile(), img, true);
>>  
>> // this returns true in 2.1.0
>>     System.out.println(gl.isNPOTTextureAvailable());
>>    
>>     float width = texture.getWidth() / 2f;
>>     float height = texture.getHeight() / 2f;
>>    
>>     listIndex = gl.glGenLists(1);
>>     gl.glNewList(listIndex, GL2.GL_COMPILE);
>>     gl.glBegin(GL2.GL_QUADS);
>>
>>     TextureCoords tc = texture.getImageTexCoords();
>>     gl.glTexCoord2f(tc.left(), tc.bottom());
>>     gl.glVertex2f(-width, -height);
>>
>>     gl.glTexCoord2f(tc.right(), tc.bottom());
>>     gl.glVertex2f(width, -height);
>>
>>     gl.glTexCoord2f(tc.right(), tc.top());
>>     gl.glVertex2f(width, height);
>>
>>     gl.glTexCoord2f(tc.left(), tc.top());
>>     gl.glVertex2f(-width, height);
>>    
>>     gl.glEnd();
>>     gl.glEndList();
>>
>>
>> I realize display lists should no longer be used but this code is old and has
>> been part of our application for a while. Regardless, when I use a 30x30 image
>> in build 981 of jogl the texture renders as expected. If I use the same image
>> in 2.1.0 it doesn't render and there are no error messages. If I resize the
>> image to 32x32 it renders as expected. This occurs on both OSX and Linux, but
>> I haven't tested on windows. Anyway, I can try to make a proper bug report if
>> the above should actually work with a 30x30 image.
>
> Pls file a bug report, I will tackle this issue ASAP.
>
> No test case needed .. assuming you used a GLProfile >= GL3[bc]
> which always supports NPOT.
Apologies ... I read your text carefully and
you say 'gl.isNPOTTextureAvailable()' returns true (which should be the case).

You also mention build 981 'seemed to have worked' ?

We test many NPOT textures in our unit tests, all show up correctly.

Maybe it is a different problem/regression,
hence I do need:
  - a small unit test
    You may use one of the following test classes as a boilerplate:
     - TestJPEGJoglAWTCompareNewtAWT
     - TestPNGTextureFromFileNEWT
    (within jogl repo)

  - Wiki/FAQ/Bugreport (of the failing Linux machine if possible)
    - which will gives me details about driver etc.

  - is the problem across all drivers / gpu-vendors ?

Thank you.

~Sven



signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Non-power of 2 textures no longer working?

nick.collier
Just to clarify. Yes, it worked in build 981, but does not work in 2.1.0. I'll try to make the unit test as soon as I can.

Nick