JDK-8124444 : MeshView textures are not repeated
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-04-06
  • Updated: 2015-06-17
  • Resolved: 2013-11-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Relates :  
Description
It would be great if by setting texture coordinates outside of range [0..1] it resulted in texture image to be repeated.

Run attached app and observe the result. Currently the texture is clamped. See the screenshot.
Comments
Fixed. Test case is included in rt/apps/toys/FX8-3DFeatures/src/fx83dfeatures/RepeatTextureTest.java or in this JIRA as attachment.
21-11-2013

+1 ship it.
21-11-2013

Thanks to Kevin for asking about the texture filter. It turns up that these code were added to fix another state bug. The current 3D texture states management in the d3d pipe isn't robust. I have filed a new JIRA, RT-34415, to address it in post FX 8. I have uploaded an improved fix at http://cr.openjdk.java.net/~ckyang/RT-29527/webrev.01/ The only change is in the native code as followed: SUCCEEDED(res = pd3dDevice->SetRenderState(D3DRS_LIGHTING, TRUE)) && + // TODO: 3D - RT-34415: [D3D 3D] Need a robust 3D states management for texture // Set texture unit 0 to its default texture addressing mode for Prism - SUCCEEDED(res = pd3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP)) && - SUCCEEDED(res = pd3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP)) && + SUCCEEDED(res = pd3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP)) && + SUCCEEDED(res = pd3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP)) && // Set texture filter to bilinear for 3D rendering SUCCEEDED(res = pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR)) && SUCCEEDED(res = pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR)); I have tested most of the 3D programs and those known "regression" found earlier were gone.
21-11-2013

Actually, Chien noticed a problem in testing that turns out to be related to removing the 4 lines from D3DContext.cc (the two I highlighted above for setting the min/mag filter and the two for setting wrapping mode). He will fix this, but it suggests a larger issue with the state tracking when switching from 2D to 3D that he will file a new JIRA for this and target for post-FX 8.
21-11-2013

+1 I tested it and looks fine. I'm OK with the fix, but would like to know the answer to my question about the filter.
20-11-2013

One question. The following seems unrelated to this fix: - // Set texture filter to bilinear for 3D rendering - SUCCEEDED(res = pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR)) && - SUCCEEDED(res = pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR)); Why is this part of the patch? Is setting the min/mag filter handled elsewhere?
20-11-2013

Defaulting to wrap instead of clamp has some drawbacks too, but I think we can do that and add the API later. Looks good to me.
20-11-2013

It does require new API therefore it will not be in the coming release but we definitely should consider in future.
19-11-2013

Please reconsider making it configurable. Clamp/border clamp and mirror repeat are quite often used in 3d graphics, default arbitrarily to repeat doesn't sound very good.
19-11-2013

Kevin and Vadim, Please review my proposed fix for this bug: http://cr.openjdk.java.net/~ckyang/RT-29527/webrev.00/ I have done a fairly extensive testing on our 3D programs. This fix exposes a d3d 3D state bug in Prism in 2 test programs, one with a JavaOne technical talk demo and the 3DViewer. The bug manifests as a rendering artifact. I will file a separate JIRA to address the d3d specific bug if this fix is approved.
19-11-2013

Attached an improved test program
19-11-2013

It should be configurable. Some people may want repeat, but some will prefer mirror-repeat (for non-tiling textures) and I'm sure that clamp/border clamp will be also needed in some cases.
06-11-2013

I also tried the attached patch but it didn't work for me.
06-04-2013