Dinosaurs (eg. tyrannosaurs) had bristles. They did not have any form of feather.
On the other hand, pterosaurs had Stage I and Stage II feathers. Those early stage feathers kept the endothermic pterosaur warm, which was necessary in flying.
Primitive birds (basal paraves) had pennaceous feathers. Those pennaceous feathers developed in the transition from pterosaur to primitive bird.
In order to understand this topic, it is essential to understand the development stages a feather goes through.
Drawing B represents Stage I. Note that the follicle appears at Stage II (drawing C):
See here for more details: