diff --git a/glm/gtx/color_cast.inl b/glm/gtx/color_cast.inl index 5236869b..fe36dd22 100644 --- a/glm/gtx/color_cast.inl +++ b/glm/gtx/color_cast.inl @@ -356,10 +356,10 @@ template <> GLM_FUNC_QUALIFIER detail::tvec4 f32_bgra_cast(uint32 color) { detail::tvec4 result; - result.x = static_cast(color >> 16) / static_cast(255); - result.y = static_cast(color >> 8) / static_cast(255); - result.z = static_cast(color >> 0) / static_cast(255); - result.w = static_cast(color >> 24) / static_cast(255); + result.x = static_cast((color >> 16) & 0xFF) / static_cast(255); + result.y = static_cast((color >> 8) & 0xFF) / static_cast(255); + result.z = static_cast((color >> 0) & 0xFF) / static_cast(255); + result.w = static_cast((color >> 24) & 0xFF) / static_cast(255); return result; }