  The formation of galaxies in a CDM cosmogony is investigated by following the
evolution of dark and baryonic matter and of the frequency- dependent spatially
averaged radiation field. The gas is allowed to form stars which are
independently treated as a fourth collisionless component. By supernovae,
energy and metal enriched gas is returned to the interstellar medium. Two
extreme cases, the formation of an isolated field galaxy and the merging of two
gas rich proto spirals are considered the latter being used as a model for
galaxy formation in a cluster. The isolated galaxy is assumed to interact with
the surrounding matter via tidal fields only, resulting in a rotation with a
spin parameter of about 0.08. The forming field galaxy shows the main
properties of spiral galaxies: A metal rich, rotatianally flattened bulge, a
metal poor anisotrope stellar halo and a exponetial disk of nearly solar
composition. The spiral is embedded in a triaxial halo of dark matter. The
stars of the bulge form from gas which is initially located in the largest
maxima of the primordial density fluctuations, whereas the halo stars originate
from gas accumulated in less pronounced maxima. Merging proto spirals evolve to
objects which can be interpreted as luminous ellipticals . The metal rich
anisotrope elliptical rotates only slowly. Depending on the geometry of the
merger event sometimes counter rotating gas is observed.
