Jump to content

Help with Texture / WebGl error


zxxz
 Share

Recommended Posts

Hello,

 

I would really appreciate some help. I am making a phaser game for a university project and have uploaded the current progress of the game to Kongregate. The game works fine on my laptop but I tried it on another laptop and it errors. The initial menu and loading screen loads and then when the game starts the sprites show but the tiles do not and there is a black background. On the console it says: webGL:invalid_value: texImage2d: width or height out of range. And that the texture is not a power of two. I'm assuming I may have to resize some of the assets I have used? I am confused as to why the game works on my laptop though. Also two players have scores on the leader board which I assume means the game worked for them also? 

 

Any help would be greatly appreciated. Thank you. 

Link to comment
Share on other sites

WebGL support is based, not on the browser itself, but the video hardware and drivers of the computer running it. This error might mean that the video drivers of that particular computer might need to be updated. Or maybe that support for WebGL isn't as good as it should be. (On some low end devices like most netbooks, WebGL won't work at all, for example.)

 

The Non Power of Two (NPOT) issue has to do with how images are loaded on a low level. For WebGL mode, it is best to have images be 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, or 2048 pixels. Any other sized image is moved to the next highest power-of-two number, or sometimes not loaded at all depending on the software and hardware running it.

 

As something to test, it might be worth switching to CANVAS mode and seeing if the same problems occur on that specific computer or others.

Link to comment
Share on other sites

Thank you for your comment. So would it be possible to get the game to run on that low end device? I want the game to run on as many different set ups as possible.

 

There isn't a maximum or recommended size for a JSON / tile map is there? I have just double checked and all of the images I am using are 1024 x 512 pixels except for sprites, so I am not sure where the error is occurring?

 

I will test it in a minute in Canvas and see what happens.

Link to comment
Share on other sites

The game level loads on the other laptop when it is set to Canvas, however the game runs fairly badly and seems a bit buggy. Also no sounds are played. Could this be due to the specs of that device? 

Link to comment
Share on other sites

There isn't a maximum or recommended size for a JSON / tile map is there?

 

Nope. But its computed size can often not be a power-of-two, sometimes. This can be a hidden problem for WebGL projects.

 

For the NPOT issue, all images themselves must have their dimensions be powers-of-two as well. Anything loaded must be in those pixel sizes I listed.

 

The game level loads on the other laptop when it is set to Canvas, however the game runs fairly badly and seems a bit buggy. Also no sounds are played. Could this be due to the specs of that device?

 

Maybe?

 

Check all the obvious things like sound volume (browsers often have lower sound levels) and the audio files loaded. Is this just a different computer, or a different browser too? Some browsers can't load certain audio formats for licensing reasons. Check the console to see if there were any problems for that.

 

Also check the most obvious thing too: does that computer even play sounds? Is it connected to speakers somehow?

Link to comment
Share on other sites

The other computer is using chrome which is what my computer is using. The audio files have loaded and there are no errors in the console. Also I have tested it and the speakers are working. I'm guessing the computer maybe just isn't compatible with it?

 

One of my sprites is about 60 x 64 pixels, should it ideally be 64 x 64 pixels to fit in with the power-of-two then? 

Link to comment
Share on other sites

  • 1 year later...

I am finding that phaser is unable to render groups larger than 8000 pixels. I get the "width or height out of range" error. 

 

I've tried setting the render texture width/height to power of 2, e.g. 16,384 but it still throws the error. I've also tried making the source that is being rendered (a Phaser.Group) to the power of two but am still getting the error. 

 

Does anyone have any bright ideas for rendering a 8000+ x 8000+ group containing images onto a render texture? obviously this stuff is scaled down with the resolution property. The render texture is a mini-map. 

Link to comment
Share on other sites

  • 5 months later...

I am finding that phaser is unable to render groups larger than 8000 pixels. I get the "width or height out of range" error. 

 

I've tried setting the render texture width/height to power of 2, e.g. 16,384 but it still throws the error. I've also tried making the source that is being rendered (a Phaser.Group) to the power of two but am still getting the error. 

 

Does anyone have any bright ideas for rendering a 8000+ x 8000+ group containing images onto a render texture? obviously this stuff is scaled down with the resolution property. The render texture is a mini-map. 

Damn. I was still having this issue and came back to this thread via a google search 6 months later. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...