Results 1 to 3 of 3

Thread: my starfield class

  1. #1

    my starfield class

    my simple class trying to draw a cool looking univers !!

    hope it will be usefull.
    Attached Files Attached Files

  2. #2
    PGDCE Developer de_jean_7777's Avatar
    Join Date
    Nov 2006
    Location
    Bosnia and Herzegovina (Herzegovina)
    Posts
    287
    The effect looks very nice, but the rendering is slow, this having to do with using glBegin() and glEnd(). You could use glDrawArrays to speed up the rendering. And you seem to be calculating the screen coordinates yourself, instead of using an OpenGL perspective projection which should do this task automatically (and thereby lowering the use of CPU immensely and speeding up rendering). You can store the star positions in an array which could be sent to OpenGL directly, and another array for star speeds. Although the points and speeds could be in a single array, but then you'd have to specify OpenGL stride (offset) for your point array.

    I did something like this too, but in Turbo Pascal on a 486DX DOS machine where there was no OpenGL and I had to do the perspective calculations myself for each point.
    Existence is pain

  3. #3
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Looks fast enough in wine... Nice work btw, I might scrutinise the code and change it some, but overall, that is one nice effect.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •