Jump to content

rmbennin
 Share

Recommended Posts

Hello everyone,

 

I've looked over all the forums and help docs for how to include a background image for my Phaser game, but for some reason mine isn't working. I keep getting this error repeatedly:

 

"WebGL: drawElements: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'. Or the texture is Float or Half Float type with linear filtering while OES_float_linear or OES_half_float_linear extension is not enabled. "

 

 

I have this code in preload():

game.load.image("background", "assets/background.jpg");

And this code in create():

background = game.add.tileSprite(0, 0, 1000, 600, "background");

Any help would be appreciated... Thanks!

Link to comment
Share on other sites

The clue is in the error - it's basically complaining that you're not using a power of 2 sized texture (something like 1024x512) - from what I've seen this is quite a GPU specific error, I certainly don't see it on my main work PC for example, but it's not a bad habit to get in to using ^2 texture sizes.

Link to comment
Share on other sites

The clue is in the error - it's basically complaining that you're not using a power of 2 sized texture (something like 1024x512) - from what I've seen this is quite a GPU specific error, I certainly don't see it on my main work PC for example, but it's not a bad habit to get in to using ^2 texture sizes.

 

Thank you so much! I was so confused at what that meant. I'm new to programming and can be dumb about some stuff!

Link to comment
Share on other sites

  • 2 months later...
  • 4 months later...

Has this issue been fixed in phaser v2.0.5? I'm running into this on my desktop Chrome browser using texture atlas. in IE 11 it works fine. 

 

[update]: I think this may not be a power of 2 issue. I tried just cropping the [32,32] region of my atlas at [0,0] but still getting the error.

Link to comment
Share on other sites

IE11 uses Canvas rendering, the error this thread is about is to do with WebGL specifically.

 

I'm pretty sure you can't use a texture atlas for a TileSprite, although I ought to test this in Pixi to see what happens. My gut feeling tells me it won't work though.

Link to comment
Share on other sites

thanks Rich, it seems you are right about tilesprite and texture atlas. I removed my code and used only sprite and it worked. in case others like me who are new to game dev, would you mind elaborating why it doesn't work?

Link to comment
Share on other sites

Hmm.. So I just saw this example that uses texture atlas for tiling. It's exactly just like my code but it works. I even downloaded the .png and .json to try with my project, it loaded the octopus and tiled correctly. I'm beginning to think that there's something wrong with my .png. I downloaded it from opengameart and manually created a json file for it. The json should be ok though as I can load a normal sprite without errors. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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