Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (472)
Games in Android Showcase (105)
games submitted by our members
Games in WIP (524)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Strange Lines on texture  (Read 1805 times)
0 Members and 1 Guest are viewing this topic.
Offline roland
« Posted 2011-10-29 13:12:37 »

Hi, I am loading a 1024x512 png image and drawing it on the screen. when I translate it, sometimes a strange grey line shows along it.
Does anyone know what the problem is?
image: http://www.use.com/2dc0018cea8a9b9306d7
Thanks,
roland
Offline Cero
« Reply #1 - Posted 2011-10-29 13:20:19 »

image(link) doesnt work

Offline roland
« Reply #2 - Posted 2011-10-29 13:22:54 »

hmm...

http://www.use.com/2dc0018cea8a9b9306d7
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mike

JGO Ninja


Medals: 70
Projects: 1
Exp: 5 years


Java guru wanabee


« Reply #3 - Posted 2011-10-29 16:33:30 »

If you are tiling the texture, did you try clamp to edge?
If you are using texture positions of <0 or >1 instead of tiling, are you sure there isn't a semi transparent line in there?
Do you have one or multiple textures within one file?


Mike

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline theagentd
« Reply #4 - Posted 2011-10-29 16:42:33 »

GL_CLAMP_TO_EDGE?

Myomyomyo.
Offline roland
« Reply #5 - Posted 2011-10-30 01:58:59 »

Thanks for the replies.
I wasn't using >1 or <0 texture coords, but the clamp fixed it  Smiley

Am I right that I have to put it just before the draw call each time? I tried to put it in my opengl init function and it didnt do anything?
eg.
1  
2  
3  
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
        GL11.glBegin(GL11.GL_QUADS);


Thanks again,
Roland
Offline theagentd
« Reply #6 - Posted 2011-10-30 13:28:52 »

Due to interpolation, it is entirely possible for OpenGL to sample outside of the bounds of your texture coordinates. GL12.GL_CLAMP_TO_EDGE fixes this. GL11.GL_CLAMP only clamps texture coordinates to 0.0-1.0, so it doesn't do anything to prevent interpolation outisde of 0.0 - 1.0. Try it. =D

Myomyomyo.
Offline Mike

JGO Ninja


Medals: 70
Projects: 1
Exp: 5 years


Java guru wanabee


« Reply #7 - Posted 2011-10-30 23:56:49 »

Am I right that I have to put it just before the draw call each time? I tried to put it in my opengl init function and it didnt do anything?

No problems, I'm just happy that I can have some use of the knowledge I built up from trial and error Smiley

Put it where you first create the texture and not at every draw.

Mike

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline roland
« Reply #8 - Posted 2011-10-31 04:40:57 »

Due to interpolation, it is entirely possible for OpenGL to sample outside of the bounds of your texture coordinates. GL12.GL_CLAMP_TO_EDGE fixes this. GL11.GL_CLAMP only clamps texture coordinates to 0.0-1.0, so it doesn't do anything to prevent interpolation outisde of 0.0 - 1.0. Try it. =D
Does this mean I have to switch everything to 1.2?

Am I right that I have to put it just before the draw call each time? I tried to put it in my opengl init function and it didnt do anything?

No problems, I'm just happy that I can have some use of the knowledge I built up from trial and error Smiley

Put it where you first create the texture and not at every draw.

Mike

Thanks  Smiley
Offline theagentd
« Reply #9 - Posted 2011-10-31 12:44:44 »

Due to interpolation, it is entirely possible for OpenGL to sample outside of the bounds of your texture coordinates. GL12.GL_CLAMP_TO_EDGE fixes this. GL11.GL_CLAMP only clamps texture coordinates to 0.0-1.0, so it doesn't do anything to prevent interpolation outisde of 0.0 - 1.0. Try it. =D
Does this mean I have to switch everything to 1.2?
You don't have to change the texture coordinates at all. Why on Earth would you want to change it to 1.2 in the first place?

Myomyomyo.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline cylab

JGO Knight


Medals: 38



« Reply #10 - Posted 2011-10-31 13:01:09 »

Does this mean I have to switch everything to 1.2?
You effectively change your runtime requirements to GL1.2, but you don't have to change anything in the code, just use GL12.GL_CLAMP_TO_EDGE and you are done.

Mathias - I Know What [you] Did Last Summer!
Offline Mike

JGO Ninja


Medals: 70
Projects: 1
Exp: 5 years


Java guru wanabee


« Reply #11 - Posted 2011-10-31 13:06:26 »

Does this mean I have to switch everything to 1.2?
You effectively change your runtime requirements to GL1.2, but you don't have to change anything in the code, just use GL12.GL_CLAMP_TO_EDGE and you are done.

Make sure you add a check to make sure that the capability for 1.2 is there before calling that.

Mike

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline Cero
« Reply #12 - Posted 2011-10-31 14:17:42 »

Make sure you add a check to make sure that the capability for 1.2 is there before calling that.

How exactly ?
I would use GL11.glGetString(GL11.GL_VERSION); and then check

Yeah I have this line problem too, but only if I scale the whole screen, which is still experimental
I think its because the positions aren't accurate enough anymore - but using Slick not sure this CLAMP will help me there.

Offline Mike

JGO Ninja


Medals: 70
Projects: 1
Exp: 5 years


Java guru wanabee


« Reply #13 - Posted 2011-10-31 20:07:09 »

if (GLContext.getCapabilities().OpenGL12){
...
}

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline theagentd
« Reply #14 - Posted 2011-10-31 20:39:29 »

Wow. Eternal embarrassment to me then. ._.

Myomyomyo.
Offline roland
« Reply #15 - Posted 2011-11-01 07:51:05 »

Thanks   Smiley
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (7 views)
2014-07-10 20:20:18

CopyableCougar4 (16 views)
2014-07-10 02:26:14

CopyableCougar4 (25 views)
2014-07-09 02:55:38

Code Mage (25 views)
2014-07-08 23:57:00

Code Mage (10 views)
2014-07-08 23:49:08

AppleSauce (20 views)
2014-07-08 19:25:32

CopyableCougar4 (21 views)
2014-07-06 01:51:26

ipe369 (26 views)
2014-07-05 14:18:25

vastrolorde (37 views)
2014-07-04 18:45:44

theagentd (53 views)
2014-07-02 22:19:37
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!