raysan5/raylib

Maybe possibly Invalid Default Texture?

MicroRJ opened this issue · 5 comments

texShapes = (Texture2D){ 1, 1, 1, 1, 7 };

Is this code meant to reset the texture to the default texture loaded by?

RLGL.State.defaultTextureId

or is the user expected to do so with rlGetTextureIdDefault()?

Thanks ray.

Are you looking at the documentation?

This function

void SetShapesTexture(Texture2D texture, Rectangle source)

In the case of an invalid texture, the function will load the default. In the case of an invalid texture, the function will load the default. RayLib does not return error codes, does not use enums. It has its default behavior defined, how it behaves in the event of a failure. In this function, it loads a default, mostly empty texture.

That's a constructor:

(Texture2D){ 1, 1, 1, 1, 7 }

create a new texture with #ID 1, width 1, height 1, mipmap 1 and format 7.

Thanks @colesnicov , so what I get from this is that the "default" texture does not refer to RLGL.State.defaultTextureId which is the actual default texture.

Thanks @colesnicov , so what I get from this is that the "default" texture does not refer to RLGL.State.defaultTextureId which is the actual default texture.

I don't see it now, really. I've been here for a few days. And I haven't looked into the source yet...

But I think RLGL.State.defaultTextureId is the texture ID which can be '1' which is the texture ID in this function:

That's a constructor:

(Texture2D){ 1, 1, 1, 1, 7 }

create a new texture with #ID 1, width 1, height 1, mipmap 1 and format 7.

This means that it can easily be the default texture.

It depends on the implementation. If the indexing starts with 0 or if it starts with 1 and 0 it means an error..

Someone more knowledgeable has to answer.

As you can see here : #3962

UNSUPPORTED (log once): POSSIBLE ISSUE: unit 0 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable.

Cite: using zero texture because texture unloadable..

It seems that the texture with ID 0 is the default texture that is uploaded in case of failure? But in the function you pointed to, the ID of the texture is set, in case it is faulty, to 1. Which probably won't be the default texture. **Could it be a mistake? **

Hopefully @rayson5 will be surprised.

@MicroRJ @colesnicov Texture ID 1 is a default internal raylib texture, a 1x1 pixel white texture (RLGL.State.defaultTextureId). OpenGL does not support 0 as a valid texture Id.

Is this code meant to reset the texture to the default texture loaded by?

@MicroRJ Yes, it does.