Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe possibly Invalid Default Texture? #3959

Closed
MicroRJ opened this issue May 4, 2024 · 5 comments
Closed

Maybe possibly Invalid Default Texture? #3959

MicroRJ opened this issue May 4, 2024 · 5 comments

Comments

@MicroRJ
Copy link

MicroRJ commented May 4, 2024

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.

@MicroRJ MicroRJ changed the title Invalid Default Texture Maybe possibly Invalid Default Texture? May 4, 2024
@colesnicov
Copy link

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.

@MicroRJ
Copy link
Author

MicroRJ commented May 4, 2024

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.

@colesnicov
Copy link

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.

@colesnicov
Copy link

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.

@raysan5
Copy link
Owner

raysan5 commented May 5, 2024

@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.

@raysan5 raysan5 closed this as completed May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants