Texture sizes

Texture sizes

von Florian Johannes Pössl -
Anzahl Antworten: 3

I have a weird "bug" where only textures which match the exact sizes of the lava texture from the lab get accepted and portrayed correctly (256x256)

Is this intended or do i have a bug somewhere in my code

Als Antwort auf Florian Johannes Pössl

Re: Texture sizes

von Jonathan Kudlich -
The size of the texture *should* not matter for the program, so I would guess that there is a bug somewhere in the code. What is the error message/display bug when you use textures of a different size?

Also, if you could tell us the name of your group and push your code to the repository, we may be able to diagnose the problem in a little more detail. ;)

LG,
Jonathan Kudlich
Als Antwort auf Jonathan Kudlich

Re: Texture sizes

von Florian Johannes Pössl -
There is no error, just a black texture. I guess that something is wrong because I inserted my textures into the lab project and they worked there.

I pushed my current version to the "Waking up" team.

I added a comment in the main.js in line 46. The problem i described there applies for all of my textures.

It would be really nice if you could help me out here.
LG Florian
Als Antwort auf Florian Johannes Pössl

Re: Texture sizes

von Patrick Adelberger -
Hi,

In WebGL there are restrictions for textures that are not a power of 2 in both dimensions, e.g. no mip mapping and not all wrap modes are available.
The easiest way to circumvent these restirctions is to use textures with sizes of power of 2 (128x128, 256x256, 1024x1024, ...).

Here are some resources where you can look up these restrictions:
- https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL
- https://webglfundamentals.org/webgl/lessons/webgl-3d-textures.html
- http://learnwebgl.brown37.net/10_surface_properties/texture_mapping_images.html

KR,
Patrick Adelberger