Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / OpenGL Development / Re: Artifact/Tearing Problem with LibGDX on: 2013-05-11 22:33:59
Ya I was using the texture packer and it was doing that by default, but I didn't feel like splitting up all my tiles and animations into separate images. This other fix looks good enough I think.
2  Java Game APIs & Engines / OpenGL Development / Re: Artifact/Tearing Problem with LibGDX on: 2013-05-10 23:50:07
It was happening with any of my TextureRegions I found out, and yes it shimmered when the camera moved, as well as appeared in different locations. I ended up trying out this technique below and the bleeding is gone, though I tweaked the coordinates of the region.setRegion line a little bit (from .5f to .01f), and I don't understand whats happening exactly. It seems like it is just tightening up the region by a subpixel amount. Though when it was adding and subtracting .5f it was shaving of a whole pixel in most cases so my tiles had a line of transparent pixels in between each.

http://www.wendytech.de/2012/08/fixing-bleeding-in-libgdxs-textureatlas/
3  Java Game APIs & Engines / OpenGL Development / Re: Artifact/Tearing Problem with LibGDX on: 2013-05-10 06:21:52
Ya, from a cursory google search that's probably what it is, I didn't know the proper term. I'm using a 128x128 texture with 32x32 tiles, here it is:



I'm pretty sure LibGDX defaults to Filter.Nearest, but I made sure when I loaded the texture that is to be split into multiple TextureRegions, I set its filtering to Nearest. Though I'm unsure if that's the proper way to do it.
4  Java Game APIs & Engines / OpenGL Development / Artifact/Tearing Problem with LibGDX on: 2013-05-10 03:44:29
Hi JGO!

I'm currently working on a simple side-scrolling game for my software engineering class. I've been working on the graphics lately and being able to resize the screen while having the aspect ratio stay the same. Everything is working fine with the resizing, but once I begin resizing it, I get weird lines between my tiles. Here's a picture:
http://i.imgur.com/ymlBAsj.png

I checked out this thread below which seemed similar, but most of the proposed solutions did not seem to work for me.
http://www.java-gaming.org/topics/solved-white-lines-tearing/27958/view.html

I tried rounding the camera coordinates before sending it to the SpriteBatch but that didn't help. I'm loading the tiles from a single Texture and splitting them up into an array of TextureRegions, but the pink color of the line artifact is from a neighboring tile to the dark purple one seen here. If I change the pink tile to gray, sure enough the line artifact changes gray. I tried loading the texture with different filters but nothing worked. I feel like it must be something with the texture though because of the way its sampling the texture outside of its region.

Now that I think about it, I haven't really seen many games allow you to stretch the window to whatever size you want. Is this why perhaps? Maybe I should just have a couple different scales that are stable, to scale the resolution up by? Here is the resize method from my Game class (implementing ApplicationListener from gdx). The code is taken off a tutorial I found, I can try to find the link for it if anyone wants.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
   public void resize(int width, int height) {
      float aspectRatio = (float) width / (float) height;
      float scale = 1f;
      Vector2 crop = new Vector2(0f, 0f);

      if (aspectRatio > Screen.ASPECT_RATIO) {
         scale = (float) height / (float) Screen.SCREEN_H;
         crop.x = (width - Screen.SCREEN_W * scale) / 2f;
      } else if (aspectRatio < Screen.ASPECT_RATIO) {
         scale = (float) width / (float) Screen.SCREEN_W;
         crop.y = (height - Screen.SCREEN_H * scale) / 2f;
      } else {
         scale = (float) width / (float) Screen.SCREEN_W;
      }

      Gdx.gl.glViewport((int) crop.x, (int) crop.y, (int) (Screen.SCREEN_W * scale), (int) (Screen.SCREEN_H * scale));
   }


Thanks for your help!
-Bukky
5  Game Development / Performance Tuning / Re: ArrayList, Hashtable, or ... for holding in-game-objects on: 2012-02-10 01:58:16
I may have just overcomplicated it a lot, but I hope you understand... xD

No, that was a beauteous metaphor.

Before all this, entities0 and entities1 referred to 2 different objects and, as theagentd explained, we simply switched the references and cleared one.

Thank you both theagentd and ra4king, I understand now!
6  Game Development / Performance Tuning / Re: ArrayList, Hashtable, or ... for holding in-game-objects on: 2012-02-09 09:27:27
The temp ArrayList is used so that you can switch the references of entities0 and entities1. Then you clear entities1 so you can re-add entities then next time the for loop is executed. It is true you could have just done "entities1 = new ArrayList<Entity>()" but why waste memory? Wink

why can't you just do this

1  
2  
entities0 = entities1;
entities1.clear();

wouldn't that accomplish the same thing? what am I missing here? WHY AM I SO DUMB  Huh Undecided Emo

Btw, welcome to JGO Smiley

Thanks!
7  Game Development / Performance Tuning / Re: ArrayList, Hashtable, or ... for holding in-game-objects on: 2012-02-09 06:50:59
May I ask someone to explain the purpose of the temp ArrayList in princec's code example? Setting entities1 = temp right before you .clear() it seems unnecessary, though I'm sure there is a reason for doing so. Is this done to help java's garbage collector?

Thank you,
-Bukky
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (30 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (42 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (51 views)
2014-12-03 16:27:13

CopyableCougar4 (49 views)
2014-11-29 21:32:03

toopeicgaming1999 (115 views)
2014-11-26 15:22:04

toopeicgaming1999 (105 views)
2014-11-26 15:20:36

toopeicgaming1999 (31 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
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!