Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (492)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
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  
  Which is faster: large pre-scaled images or small scaled images  (Read 770 times)
0 Members and 1 Guest are viewing this topic.
Offline samdeman22

Junior Member


Projects: 1



« Posted 2013-12-12 17:03:44 »

I'm trying to start a 2d opengl game, and I have 2 choices for sprite textures that are loaded onto quads (that I can see): make a texture in PS and scale it up with "nearest neighbour" and load it in; Or load in the small texture and do blending with these two lines of code:

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

My thinking is that both ways the texture would take up the same amount of VRAM, but the second way would require more processing power (during game execution, that is, albeit not that much). Do you agree with me?

If in doubt go flat out - Collin McRae
Offline theagentd
« Reply #1 - Posted 2013-12-12 19:07:01 »

Scaling is free on the GPU. The hardware does it for you. A smaller texture is always better.

Myomyomyo.
Offline Danny02
« Reply #2 - Posted 2013-12-12 20:09:12 »

why would you think that both would use the same amount of memory??

Also, the textures are not scaled on your GPU they are sampled. The processing time is independent of the scale of the texture.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline theagentd
« Reply #3 - Posted 2013-12-12 20:35:55 »

The processing time is independent of the scale of the texture.
Actually a smaller texture is faster since there's less memory to read (and depending on the read pattern, possibly less texture cache misses), but in this case the difference miles from noticeable.

Also, the textures are not scaled on your GPU they are sampled. The processing time is independent of the scale of the texture.
Maybe he meant scaling the texture to a power-of-2 instead of padding to power-of-2. There's no need to stick power-of-2 sizes anymore.

Myomyomyo.
Offline samdeman22

Junior Member


Projects: 1



« Reply #4 - Posted 2013-12-13 17:17:42 »

why would you think that both would use the same amount of memory??

Also, the textures are not scaled on your GPU they are sampled. The processing time is independent of the scale of the texture.

well, I imagined that, once scaled up, the data would be the same size as data that was pre-scaled, as it is being displayed on the screen in the same size as the pre-scaled. So by sampling I do not effect performance in ANY way?

If in doubt go flat out - Collin McRae
Offline davedes
« Reply #5 - Posted 2013-12-13 17:50:51 »

Chances are your bottlenecks will lie in draw calls and/or fill rate, rather than the size of your textures.

It's more important to use sprite sheets and batch render, than it is to worry about individual texture sizes.

Offline pitbuller
« Reply #6 - Posted 2013-12-13 20:42:36 »

Texture cache miss is really slow. Thousands of cycles but gpu's are quite smart to hide that latency. Still smaller is always as fast or faster(can be even magnitude) but never slower. Just try to disable mipmapping from some AAA game(gpu settings, texture lod bias) and notice how much it will slow down.
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.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (33 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (40 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (37 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!