Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (636)
Games in Android Showcase (178)
games submitted by our members
Games in WIP (685)
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 864 times)
0 Members and 1 Guest are viewing this topic.
Offline JeramieHicks

Senior Newbie

Java games rock!

« Posted 2004-10-18 09: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 Devvie

Java games rock!

« Reply #1 - Posted 2004-10-18 11: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 15: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 16: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 01: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.

Dwinin (60 views)
2015-11-07 13:29:08

Rems19 (73 views)
2015-10-31 01:36:56

Rems19 (65 views)
2015-10-31 01:32:37

williamwoles (102 views)
2015-10-23 10:42:59

williamwoles (88 views)
2015-10-23 10:42:45

Jervac_ (102 views)
2015-10-18 23:29:12

DarkCart (129 views)
2015-10-16 00:58:11

KaiHH (112 views)
2015-10-11 14:10:14

KaiHH (150 views)
2015-10-11 13:26:18

BurntPizza (164 views)
2015-10-08 03:11:46
Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30

Rendering resources
by Roquen
2015-10-15 07:40:48

Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11 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!