lars.saalbach Posted March 8, 2013 Share Posted March 8, 2013 Hey Unigine, setLayerTexCoord isn't working with X and Y as 0 / 0 if you set now: mysprite.setTexCoord(vec4(0.0f,0.0f,(engine.app.getWidth() / statusBarLayerSprite.getWidth()) +2,45.0f)); The sprites aren't rendered at all. In attachment the example. Greetings Lars roastatus.rar Link to comment
frustum Posted March 9, 2013 Share Posted March 9, 2013 x, y is tex coord scale z, w is tex coord offset Link to comment
lars.saalbach Posted March 9, 2013 Author Share Posted March 9, 2013 Hello Frustum,thanks for the help.Now it make sense why the behavior was such strange.I think the documentation needs an update:"vec4 texcoord - Texture coordinates. The first pair of coordinates (x and y) is for the upper left corner, the second pair (z and w) is for the lower right corner."Thanks Link to comment
frustum Posted March 9, 2013 Share Posted March 9, 2013 Sorry, the documentation was right. The default texture coordinates are 0, 0, 1, 1. The first pair is upper left. The second pair is lower right corner. Link to comment
lars.saalbach Posted March 9, 2013 Author Share Posted March 9, 2013 Hey Frustrum, but then its strange,test my example and put the first two textures to 0/0, and the textures aren't repeated, if you put them to 1/1 they are repeated. I'm standing on a pipe? Link to comment
lars.saalbach Posted March 13, 2013 Author Share Posted March 13, 2013 Update: Found something realy strange going on: If you have a look into spacing.png you'll the the red - arrow which displays on a "spacing" on the graphic -> If you'll have a look on the pure added image -> theres no spacing at all. I found out that: statusbarTopSprite.setWidth(engine.app.getWidth()); statusbarTopSprite.arrange(); WidgetSprite statusBarLayerSprite = new WidgetSprite(engine.getGui(),"roastatus/statusbar_repeating.png"); statusBarLayerSprite.arrange(); statusbarTopSprite.setTexCoord(vec4(1.0f,1.0f,(engine.app.getWidth() / statusBarLayerSprite.getWidth()) +2,45.0f)); statusbarTopSprite.setWrapRepeat(1); statusbarTopSprite.arrange(); Textcord with setWrapRepeat includes this spacing: statusbarTopSprite.setTexCoord(vec4(1.0f,1.0f,(engine.app.getWidth() / statusBarLayerSprite.getWidth()) +2,45.0f)); statusbarTopSprite.setWrapRepeat(1); Update: if you remove the setTexCoord and setWrapRepeat it looks like (left top) - so theres no blackspacing between. In attachment you're finding a little example where you can reproduce this error. For a fast help I would be realy glad. Thanks Lars roastatus.rar Link to comment
frustum Posted March 17, 2013 Share Posted March 17, 2013 Be carefully with integer division because int/int = int. statusbarTopSprite.setTexCoord(vec4(0.0f,0.0f,float(engine.app.getWidth()) / statusBarLayerSprite.getWidth(),1.0f)); with repeat: without: Link to comment
lars.saalbach Posted March 17, 2013 Author Share Posted March 17, 2013 Hey frustum, thanks for advice, float() casting didn't bring up the solution: topLayerSprite.setTexCoord(vec4(1.0f,1.0f,float(float(engine.app.getWidth()) / float(statusBarLayerSprite.getWidth())) +float(2),45.0f)); topLayerSprite.setWrapRepeat(1); topLayerSprite.arrange(); I just tried with float around engine app and then I put every where, same error. I attached again the problem after casting to float aswell. Edit: It makes no difference if I remove +float(2) or not. FYI. Greetings Lars Link to comment
manguste Posted March 21, 2013 Share Posted March 21, 2013 Lars, As you can see by yourself, in the example Frustum has provided there is no black spacing. And since it is rendered correctly, I suggest you look through your code again. It is possible that this pixel appears due to incorrect scaling (if we are talking about int division) or if wrong texture coordinates are set. Link to comment
lars.saalbach Posted March 21, 2013 Author Share Posted March 21, 2013 Hey Manguste, I'll check it this evening again with the sample I provided Frustum aswell. I changed all int divisions to float division so there shouldnt be a problem anymore. But y I'll check it this evening and notify you. Greets Lars Link to comment
lars.saalbach Posted March 21, 2013 Author Share Posted March 21, 2013 Hello Manguste, Hello Frustum, I tried it a new, I attached a label where you see this problem. Here the screenshot where you see the label "test" which shows that setTexCoords does something strange: If i remove the texcoord and the wrap I got this: Where you see the Image isn't destroyed. PS: I casted all to (float) etc. but problem still exists. I hope you can reproduce this error now. In attachment the project with the attached label so you can see it. Thanks Lars roastatus_new.rar Link to comment
anton.stetz Posted March 21, 2013 Share Posted March 21, 2013 Put <label/> in UI under <sprite/> Link to comment
lars.saalbach Posted March 22, 2013 Author Share Posted March 22, 2013 Hey Anton, but that means that the label is attached ABOVE the sprite. I wanted to show that the label is shown below the sprite cause its wrapped wrong and so a spacing is created. Have a look into the pic posted before. Here you see that the label is shown if i attach this behind the sprite. This comes up if I use "settexcoord" and "setWrap" functionality, without it doesn't happend. But thanks for hint anyway. So Issue still open. Greets Lars Link to comment
lars.saalbach Posted March 23, 2013 Author Share Posted March 23, 2013 Update: Maybe its a problem in Windows and you're testing it on Linux? Greetings Lars Link to comment
lars.saalbach Posted March 25, 2013 Author Share Posted March 25, 2013 Maybe I found a solution for this problem I'll inform you in some days anew with the solution or with more informations. What I can say till now: Seems like a white space above the image which is rendered into the middle (realy strange whats going on there). Greetings Lars Link to comment
lars.saalbach Posted March 29, 2013 Author Share Posted March 29, 2013 Hello Unigine again, I found the issue of the repeating bug now. It seems, like I posted above, that the "whitespace (its transparent)" in the image is killing the wrapFunctionality. This whitespace is above the "statusbar" can be made visibile in photoshop or call this image with paint then you will see it. - It would be cool when you can check this aswell, a transparency shouldn't kill this functionality at all. IMPORTANT ASWELL: At all we got another issue with this functionality: In Windows 7 the wrapping works after I removed the transparency above the statusbar. In Linux (Ubuntu 12.10 to be exactly) it doesn't work. This bug occures with and without the transparency in image.. Have a look into the attachment to see the bug in Linux: Have a look into the attachment to see how it works looks on Windows: In attachment the new version with the new image file without the transparency above the statusbar. Iif you want the transparency as well to test, have a look into a post before with the attached roastatus.rar. Greetings Lars roastatus.rar Link to comment
silent Posted April 3, 2013 Share Posted April 3, 2013 lars.saalbach, Thanks! I've sent this information to the developers (and about sprite with alpha-channel too). How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
lars.saalbach Posted April 4, 2013 Author Share Posted April 4, 2013 Hi Manguste, it isn't fixed. We did a workarround with a sprite with 2600 pixel width. Cause the widest resolution we support is 2550. So we dismissed at first the .setWrap functionality etc. So bug is still open. Greetings Lars Link to comment
frustum Posted April 5, 2013 Share Posted April 5, 2013 Please set the correct texture coordinates for sprites: statusbarTopSprite.setTexCoord(vec4(0.0f,0.0f,float(engine.app.getWidth() / statusBarLayerSprite.getWidth()),1.0f)); mysprite.setTexCoord(vec4(0.0f,0.0f,float(engine.app.getWidth() / statusBarLayerSprite.getWidth()),1.0f)); Link to comment
frustum Posted April 5, 2013 Share Posted April 5, 2013 The problem is in wrong texture coordinates. statusbarTopSprite.setTexCoord(vec4(0.0f,0.0f,float(engine.app.getWidth()) / statusBarLayerSprite.getWidth(),1.0f)); mysprite.setTexCoord(vec4(0.0f,0.0f,float(engine.app.getWidth()) / statusBarLayerSprite.getWidth(),1.0f)); The first pair of numbers is upper-left corner.The second pair is a lower-right corner. The default value (0,0,1,1) means whole sprite coverage by texture without repeat. Link to comment
lars.saalbach Posted April 8, 2013 Author Share Posted April 8, 2013 Hey Frustum, we tested it now on Windows and Linux, its working! Thanks for your BIG afford! Case can be closed. Greetings Lars Link to comment
Recommended Posts