Bug 1218

Summary: NPOT textures don't work
Product: [JogAmp] Jogl Reporter: paolofuse <paolo>
Component: macosxAssignee: Sven Gothel <sgothel>
Status: VERIFIED INVALID    
Severity: major CC: gouessej
Priority: ---    
Version: 2.3.2   
Hardware: All   
OS: macosx   
Type: DEFECT SCM Refs:
Workaround: ---
Attachments: test image
NPOT screenshot
POT screenshot
gluegen test results

Description paolofuse 2015-09-15 10:12:22 CEST
Created attachment 733 [details]
test image

I cannot display simple NPOT texture.
You can repeat the issue with this demo:
https://github.com/sgothel/jogl-demos/blob/master/src/demos/texture/TestTexture.java
I attach an image to test it.

My configuration is:
Mac Book Pro
Video card AMD Radeon HD 6490M
OSX 10.10.5
Java version 1.8.0.51
JOGL version 27/03/2015
Comment 1 Sven Gothel 2015-09-17 02:04:08 CEST
no problem here on GNU/Linux w/ 'modern GPU/GL'.

Also note that most of our test textures have NPOT dimensions.

You have to query whether your GL context supports NPOT, 
see: https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GLContext.html#isNPOTTextureAvailable%28%29
Comment 2 paolofuse 2015-09-17 10:37:31 CEST
I query my GL with isNPOTTextureAvailable() and it returns TRUE. And still my NPOT textures are not display. I attach 2 screenshot, with NPOT and POT texture, made with https://github.com/sgothel/jogl-demos/blob/master/src/demos/texture/TestTexture.java
Comment 3 paolofuse 2015-09-17 10:37:56 CEST
Created attachment 735 [details]
NPOT screenshot
Comment 4 paolofuse 2015-09-17 10:38:25 CEST
Created attachment 736 [details]
POT screenshot
Comment 5 Julien Gouesse 2015-09-18 23:53:06 CEST
Please can you run all tests and post the logs? I wonder whether there is a problem with your driver.
Comment 6 paolofuse 2015-10-01 15:33:37 CEST
Sorry for late replay. I post all jogl and gluegen test results.
I run the tests on other machine (my old Mac was busy), where the problem with NPOT textures still remains.

This is my new configuration:
Mac Book Pro
Video Card AMD Radeon R9 M370X
OSX 10.10.5
Java Version 1.8.0.60
JOGL version 27/03/2015
Comment 7 paolofuse 2015-10-01 15:36:53 CEST
Created attachment 752 [details]
gluegen test results

All gluegen test results.
Comment 8 paolofuse 2015-10-01 15:50:49 CEST
Well I've tried on others Mac with another video cards.
On GeForce video card and on Iris Pro the NPOT texture is displayed well.
So I think the problem is with ATI video cards, because both of my video cards are ATI:
AMD Radeon HD 6490M
AMD Radeon R9 M370X

Is this a bug? Is it possible to fix it? I'm also unable to play movie with GLMediaPlayer and FFMPEG, because the method TextureFrame.getTexture() gives me a not displayable NPOT texture.

Thanks.
Comment 9 paolofuse 2015-10-01 16:28:41 CEST
More information: loading my NPOT texture with TextureIO.newTexture I get GL_TEXTURE_RECTANGLE as texture's target. And this is coherent with the docs:
"Further more, GL_ARB_texture_rectangle (RECT) will be attempted on OSX w/ ATI drivers"

But the texture is not display well, there's a colored rectangle instead.
Comment 10 paolofuse 2015-10-01 16:59:28 CEST
I figured out the problem.
My texture has a GL_TEXTURE_RECTANGLE target and the range of texture coordinates corresponding to the entire texture image is [0.0, width] x [0.0, height], on the contrary the range of texture coordinates for GL_TEXTURE_2D is [0.0, 1.0] x [0.0, 1.0].

The bug is on texture.getImageTexCoords(). It gives [h: 0.0 - 1.0, v: 0.0 - 1.0] also with GL_TEXTURE_RECTANGLE, for this the texture is not displayed correctly.

If you update tex coords by manually calling for example setMustFlipVertically() the returned coords are correct.
Comment 11 Sven Gothel 2015-10-02 14:48:49 CEST
(In reply to paolofuse from comment #10)
> I figured out the problem.
> My texture has a GL_TEXTURE_RECTANGLE target and the range of texture
> coordinates corresponding to the entire texture image is [0.0, width] x
> [0.0, height], on the contrary the range of texture coordinates for
> GL_TEXTURE_2D is [0.0, 1.0] x [0.0, 1.0].
> 
> The bug is on texture.getImageTexCoords(). It gives [h: 0.0 - 1.0, v: 0.0 -
> 1.0] also with GL_TEXTURE_RECTANGLE, for this the texture is not displayed
> correctly.
> 
> If you update tex coords by manually calling for example
> setMustFlipVertically() the returned coords are correct.

Thank you, confirmed and created Bug 1241 for this issue!