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

Why doesn't ALLEGRO_PRIM_COLOR_ATTR respect the storage declaration provided in ALLEGRO_VERTEX_ELEMENT? #1574

Open
ghassanpl opened this issue Aug 11, 2024 · 3 comments

Comments

@ghassanpl
Copy link

As far as I understand, there should be no reason for it not to. Non-float4 color data is supported by most modern cards, and it would be easy to error-out in case it's not supported for some reason.

If I could build allegro from source

I'd make a change at: https://github.com/liballeg/allegro5/blob/master/addons/primitives/prim_opengl.c#L158

ALLEGRO_PRIM_POSITION, ALLEGRO_PRIM_TEX_COORD and user attributes use convert_storage to get the parameters for glVertexAttribPointer to setup the vertex declaration, but the call for ALLEGRO_PRIM_COLOR_ATTR at the link above does not.

Analogous for DX.

There might be a reason this is not done, so feel free to correct me :)

@ghassanpl ghassanpl changed the title Why doesn't ALLEGRO_PRIM_COLOR_ATTR respect the storage declaration provided in ALLEGRO_VERTEX_ELEMENT? Why doesn't ALLEGRO_PRIM_COLOR_ATTR respect the storage declaration provided in ALLEGRO_VERTEX_ELEMENT? Aug 11, 2024
@SiegeLord
Copy link
Member

ALLEGRO_PRIM_COLOR_ATTR is meant to be used with arrays of ALLEGRO_COLOR, which has a specific layout. For other color formats you'd use one of the custom attributes.

@ghassanpl
Copy link
Author

ALLEGRO_PRIM_COLOR_ATTR is meant to be used with arrays of ALLEGRO_COLOR, which has a specific layout. For other color formats you'd use one of the custom attributes.

But then I wouldn't be able to use the default primitive shader, right? Changing the storage of the other default attributes isn't an issue, why is color different? I.e. is there a reason Allegro needs me to use ALLEGRO_COLOR in my own vertex formats?

@SiegeLord
Copy link
Member

That's fair. This can't be fixed for this existing constant for backwards compatibility reasons, but we could add a ALLEGRO_PRIM_COLOR_FLEX_ATTR or something to accomplish what you want.

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

2 participants