Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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  
  OpenGL ES adds noise to texture  (Read 2763 times)
0 Members and 1 Guest are viewing this topic.
Offline Screem
« Posted 2013-08-09 15:17:46 »

I'm reading Beginning Android Games: Second Edition and near the end of chapter 10 there's an example where you make a 3D spinning textured cube. I didn't like the texture provided, so I made a very simple 8x8 texture to use. The problem is though, that OpenGL is adding noise to the texture by itself for some reason.

Here are the texture(s) I made:


And this is what OpenGL renders on a Kindle Fire running Android 2.3.4: http://i.imgur.com/oXNWkjO.png
Last but not least, here's the class: http://pastebin.com/yQUmZPr8

The other three sprites also render with noise, but it's not as obvious as the crate sprite. It's only noticeable if you check the colors in an image editing program.

The Texture and Vertices3 classes referenced hold the texture and vertices/texture coordinates/indices of the cube. I can provide them if needed, but they've been used before with no problem.

I have no idea why this happens and I couldn't find anything from searching on Google. All help would be appreciated. Thanks!

Offline Danny02
« Reply #1 - Posted 2013-08-09 15:30:28 »

It is quite possible that the OpenGL drivers use a low bit-depth for the render-target as an  optimisation.

They probably only use 16 bit for the hole rgb color space(5-6-5).
As you can see, because of this you can not represent a grey value in these color-spaces.

This behavior is OS, driver or hardware specific so do some google searches for your kindle fire + version + hardware.

Also, there could be the possibility to force OpenGL to use a full 3x8(24bit) color-space. Google should help there also or someone else on this board.
Offline Screem
« Reply #2 - Posted 2013-08-09 16:55:55 »

You are right - it is OS, driver, or hardware specific. I couldn't figure that out before because the only Android device I have is my Kindle. Smiley Using the device emulator running a Nexus 4 didn't have this problem. Making the image a GIF instead of a PNG fixed the issue, but increased the image size from 291 bytes to 923 bytes. ...that's about 3x the image size and although 630 bytes isn't much, it could add up when using a full sprite sheet. I'm assuming there are other Android devices that do this, but I haven't found a way to force OpenGL to use the full bit depth of an image. Does anyone else know how to do this?

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Danny02
« Reply #3 - Posted 2013-08-09 18:01:38 »

this shouldn't have anything to do with the image format. Can you show us how you upload the texture?
Offline Screem
« Reply #4 - Posted 2013-08-09 18:24:43 »

It's done with the Texture class from the book.
Here: http://pastebin.com/egncgVYh

As you can see from the previous snippet, the texture is initialized in the constructor and the bind() method is called before it's drawn.

Offline pitbuller
« Reply #5 - Posted 2013-08-09 19:11:04 »

What texture format you are using?
Offline Screem
« Reply #6 - Posted 2013-08-09 19:41:20 »

24-bit PNG. As I said earlier, Using a GIF fixes the problem but a JPG or 8-bit PNG doesn't.

Offline pitbuller
« Reply #7 - Posted 2013-10-01 19:43:50 »

24-bit PNG. As I said earlier, Using a GIF fixes the problem but a JPG or 8-bit PNG doesn't.

Those are image formats not texture formats.
Offline xsvenson
« Reply #8 - Posted 2013-10-01 20:31:33 »

Looking at the screenshot, does the quality degradation matter ? I think it rather enhanced the texture.
Or You just want to know why ?

“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
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.

pw (26 views)
2014-07-24 01:59:36

Riven (25 views)
2014-07-23 21:16:32

Riven (20 views)
2014-07-23 21:07:15

Riven (22 views)
2014-07-23 20:56:16

ctomni231 (51 views)
2014-07-18 06:55:21

Zero Volt (46 views)
2014-07-17 23:47:54

danieldean (37 views)
2014-07-17 23:41:23

MustardPeter (40 views)
2014-07-16 23:30:00

Cero (56 views)
2014-07-16 00:42:17

Riven (55 views)
2014-07-14 18:02:53
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!