Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (108)
games submitted by our members
Games in WIP (536)
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  
  Foreground and screen-size texture  (Read 645 times)
0 Members and 1 Guest are viewing this topic.
Offline JeramieHicks

Senior Newbie




Java games rock!


« Posted 2004-10-18 11:49:35 »

I'm trying to make a full-screen quad that is covered by a texture which is the pixel size of the current window... that is, a texture which covers the entire window surface, as a glass plate to draw our own in-house GUI system on. It uses the Foreground node and initially seems to function ok.

However, the quality of the resulting texture is bad. If I have a window size of 800x600 and then load an 800x600 graphic, the resulting image is not per-pixel correct. It appears as though the image itself has been downsized (losing every few pixel lines), and then that result has then been stretched full-screen.

I don't believe I'm creating mipmaps. At any rate, the poly is being drawn only 0.6f from the camera, so I can't imagine why it would be using a lower mipmap level.

Any thoughts?
Offline cascade

Junior Member




Java games rock!


« Reply #1 - Posted 2004-10-18 13:14:05 »

Correct me if I am wrong but does'nt OpenGL (not version 2.0) only support textures with dimensions of powers of 2 ?

How are textures having non-power-of-2 sizes handled by Xith ? Downscaled automagically ?

Perhaps your 800x600 texture was scaled to 512x512 or 512x256 internally since may not be displayable at 800x600.

just a guess, however Huh

Try to create a 1024x1024 texture to copy your 800x600 image into it (centered). Then adjust the distance of the image to match the field of view.

Offline JeramieHicks

Senior Newbie




Java games rock!


« Reply #2 - Posted 2004-10-18 17:44:05 »

As far as I thought, OpenGL required power-of-2 sized textures that were a maximum size of 256 x 256. However, already thinking of that, I rescaled the texture in a graphics editor to get a feel for how much it had been rescaled down... and the quality I'm seeing appears consistent with only having been scaled down a few pixels (800x600 -> 512x512 looks far worse, with much more data lost).

I was wondering if maybe the canvas had been scaled up to 1024x1024 (next power of 2), and then using floats to UV back down to 800x600 was responsible for missing a pixel here or there.

I mean, the quality is pretty good, I'd say 90%, but to be the basis of a GUI I gotta have per-pixel accuracy. And I'd understand if I was stretching or shrinking the on-screen drawing of the texture to a size that was not the original, but I just can't seem to figure out how it's seemed to have lost like 10% of the image. I think it's probably more like it's trying to grab a pixel, and the UV float fuzziness means that it's occasionally grabbing a pixel that's just 1 pixel too high or low...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline JeramieHicks

Senior Newbie




Java games rock!


« Reply #3 - Posted 2004-10-18 18:07:48 »

I did a high-quality rescale of the 800x600 GUI example screenshot and made a 1024x768 version. When I load that into my client and draw it at 800x600, it comes out with about 98% accuracy. A much better improvement, but I'd hate to think of coding a GUI system that works on an 800x600 display only by writing to a 1024x768 texture, heh.

Is there some sort of "quality vs speed" switch somewhere that I could set to do more accurate texturing?
Offline JeramieHicks

Senior Newbie




Java games rock!


« Reply #4 - Posted 2004-10-19 03:20:44 »

It appears that it is, indeed, a "fuzzy float" UV issue. I've noticed that the distortion is more pronounced whenever the image is farther from the next power of 2 (ie, 800x600 -> 1024x1024), and the distortion is more pronounced on the axis furthest from it (ie, 800 is closer to 1024 than 600, so the X axis is less distorted than the Y axis).

I was looking through the UIOverlay code, and I see David coded up a tiled texture process, which is what we used in our own in-house 3D engine. That's just as well though, I'd rather the full-screen image be broken into very small tiles, to help keep the "dirty texture needs updating" resolution as high as possible. Nothing worse than updating one pixel on a 1024x1024 texture and requiring the entire thing be pushed up again...

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.

CogWheelz (16 views)
2014-07-30 21:08:39

Riven (22 views)
2014-07-29 18:09:19

Riven (14 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (32 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

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

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

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

Riven (31 views)
2014-07-23 20:56:16
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!