Results 1 to 3 of 3

Thread: SDL, OpenGL, and ray tracing

  1. #1
    Join Date
    Apr 2009
    Location
    ~/
    Beans
    210

    SDL, OpenGL, and ray tracing

    Hello, I've recently been working on a ray tracer as a hobby and have stumbled upon a problem. I have a malloced buffer that contains RGBA pixels as floats and was wondering what the best way to get them on the screen.

    I'm currently trying to use SDL with OpenGL's glDrawPixels() but that isn't working. Is there a way to take this buffer and turn it into a 2d OpenGL texture or an SDL_surface?

  2. #2
    Join Date
    Sep 2009
    Beans
    202
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: SDL, OpenGL, and ray tracing

    Since you're already working with OpenGL I suppose you remember the very first example in every SDL tutorial: Drawing pixels on screen. You already have the colors set, now simply draw them (Lock surface -> draw -> Unlock Surface-> Update).

    I can't think of a better tutorial on starting with SDL than this: the3fold.free.fr/doc/games.pdf (It's a game programming guide but the introduction to SDL is great).
    So, you were talking about that... ummm... that... errr...
    Oh, yes, yes...

  3. #3
    Join Date
    Apr 2009
    Location
    ~/
    Beans
    210

    Re: SDL, OpenGL, and ray tracing

    Well that was easy enough. Thanks for pointing me in the right direction, everything works.

Tags for this Thread

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
  •