Generating Universe with System.Drawing.Bitmap before Xna.Texture

Hi. I've done a code that can show a generated "constillations" (sp ) like in outer space, known as a "Star Generator" which generates stars in a bitmap.

Here's the code which I'm about to show:


Answer this question

Generating Universe with System.Drawing.Bitmap before Xna.Texture

  • benwalker

    Oh okay so I don't have to worry about creating textures.

    Thanks! :)



  • stallion_alpa

    YOu would probbly generate it as part of your build process and just import the artwork as a texture files.

    Or you could use a pointlist and draw the points like I did in the spacewar retro code. See retro/retrostarfield.cs

    Or you could use a pointlist to draw into an offscreen texture and use that texture.



  • nairB

    You could also look at Surface.SetData(). A quick example:
  • aragon127

    All I get when applying this is a

    "Index was outside the bounds of the array" error.

    Any idea's, I even tried applying the surface directly on to the new texture surfac which does not produce errors



  • Alin Constantin - MSFT

    Okay, that helps.

    So If I wanted to develop a game for XBox (well I don't have one right now), how would I go about generating my own texture if there's no System.Drawing namespace support for XBox 360



  • Luc Pettett

    You should set the position of your stream back to the beginning before you try to read the texture from it.

    tempStream.Seek (0, SeekOrigin.Begin);

    But AFAIK there will be another future problem if you want to run this on the XBox. System.Drawing will be not supported there.



  • ku19832001

    Never mind me, good rule of thumb, always check the rest of your code before putting questions on a board.

    Damn array's.

    Although the effectgenerated is not a starfield as such but a nice gradient colout texture, ideas on how to use this methof a starfield



  • Generating Universe with System.Drawing.Bitmap before Xna.Texture