Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (739)
Games in Android Showcase (224)
games submitted by our members
Games in WIP (820)
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 6871 times)
0 Members and 1 Guest are viewing this topic.
Offline Screem
« Posted 2013-08-09 13: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:
Last but not least, here's the class:

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 13: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 14: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 16: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 16:24:43 »

It's done with the Texture class from the book.

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 17:11:04 »

What texture format you are using?
Offline Screem
« Reply #6 - Posted 2013-08-09 17: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 17: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 18: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.

Ecumene (48 views)
2017-09-30 02:57:34

theagentd (71 views)
2017-09-26 18:23:31

cybrmynd (181 views)
2017-08-02 12:28:51

cybrmynd (180 views)
2017-08-02 12:19:43

cybrmynd (187 views)
2017-08-02 12:18:09

Sralse (192 views)
2017-07-25 17:13:48

Archive (744 views)
2017-04-27 17:45:51

buddyBro (876 views)
2017-04-05 03:38:00

CopyableCougar4 (1421 views)
2017-03-24 15:39:42

theagentd (1315 views)
2017-03-24 15:32:08
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51 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‑
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!