Author Topic: Line appears at the top of transparent texture (texture shifted?)  (Read 4696 times)

Offline 32kda

  • byte
  • *
  • Posts: 10
    • View Profile
Hi
Got a problem - created a poly (two triangles), used grass texture (transparent png) for it. When rotating camera up/down, black line sometimes appears at the top of "grass" poly. See http://prntscr.com/bajmq
 Is it a result of inproper texture mapping (maybe line is actually bottom row of grass texture?) or smth other.
Size of texture is 512*128, size of poly is 4*1.
How to make texture to fit this poly properly?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Line appears at the top of transparent texture (texture shifted?)
« Reply #1 on: June 29, 2012, 10:57:21 am »
try

Code: [Select]
<grassTexture>.setClamping(true);

Offline 32kda

  • byte
  • *
  • Posts: 10
    • View Profile
Re: Line appears at the top of transparent texture (texture shifted?)
« Reply #2 on: June 29, 2012, 03:49:13 pm »
Do you mean
Quote
texture.enableClamping();
?

It solved the problem, thanks alot.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Line appears at the top of transparent texture (texture shifted?)
« Reply #3 on: June 30, 2012, 12:21:39 am »
No, i actually mean setClamping() as enableClamping() is deprecated...anyway, both do the same thing.... ;)

Offline arianaa30

  • byte
  • *
  • Posts: 44
    • View Profile
Re: Line appears at the top of transparent texture (texture shifted?)
« Reply #4 on: July 03, 2012, 11:39:09 pm »
Egon,
I've a problem with a PNG texture, in which the background is transparent. in the game, the background gets black. What should I do?
attached is the grass texture!!!

[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Line appears at the top of transparent texture (texture shifted?)
« Reply #5 on: July 03, 2012, 11:41:20 pm »
You have to set some transparency by calling...setTransparency(0...x) on your grass objects. If the png contains an alpha channel, make sure to use the appropriate construtor or jPCT will ignore it and create it's own.

Offline arianaa30

  • byte
  • *
  • Posts: 44
    • View Profile
Re: Line appears at the top of transparent texture (texture shifted?)
« Reply #6 on: July 03, 2012, 11:55:06 pm »
I'll test it. What if I make the background dark by myself?
the JPG rock texture looks good.

[attachment deleted by admin]