Generating Textures. MAX_TEXTURE_SIZE: 16384


#1

Hello!

I’m writing an atlasser for my code and I’ve based its limits on max_texture_size:

 max_texture_size    = GL.getParameter(GL.MAX_TEXTURE_SIZE);

On my development system this is 16384 (NVidia). I create the texture like this:

 atlas_bitmaps[id]   = new BitmapData(max_texture_size, max_texture_size, true, 0);
 // Process, Copy Pixels, etc ...
 // then make Tilesets when done.

This does not work with a value of 16384. It does work a size of 8192.

 max_texture_size    = Std.int(Math.min(GL.getParameter(GL.MAX_TEXTURE_SIZE), 8192));

I’m thinking that BitmapData or Tileset can’t handle the amount of bytes: 16384^2x4 = 1073741824b. Also, Neko - which I only use for testing - is Internally fixed on 2^28-1. But it would be sad if we cant take advantage of the 16384 textures on Windows Systems.

is there anyway this can be fixed?

Edit: The Iphone simulator is showing the same behavior. the max_texture_size in Iphone x is 4096 but it will only work with 2048;


#2

My math is probably just off. MAX_TEXTURE_SIZE is in bytes and I was using it in pixels. BitmapData is in 4 bytes so MAX_TEXTURE_SIZE needs to be divided by that.


#3

We should probably handle the max size internally at some point, and throw a warning or error when a BitmapData has exceeded the size