17

Protip: always account for endianness when using a library that does hardware access, like SDL or OpenGL :/

I spent an hour trying to figure out why the fucking renderer was rendering everything in shades of pink instead of white -_-

(It actually looked kinda pretty, though...)

I'd used the pixel format corresponding to the wrong endianness, so the GPU was getting data in the wrong order.

(For those interested: use SDL_PIXELFORMAT_RGBA32 as the pixel type, not the more "obvious" SDL_PIXELFORMAT_RGBA8888 when making a custom streaming SDL_Texture)

Comments
  • 3
    I also had a problem with pixelformat, when you use RGBA instead of ABGR so your render of that red sphere doesn't appear
  • 2
    @notroot Graphics programmers unite!
  • 1
    Trying to make an engine ?
  • 1
    Haha, not this time. Raytracing engine. I've caught the photorealistic rendering bug, it's what occupies me for most of the time these days. I made a few PBR shaders in GLSL but nothing beats implementing a Trowbridge-Reitz BRDF in your own raytracer.

    I render to a memory buffer and then shove it onto the monitor via some graphics API. I was using SDL earlier, but changing to OpenGL now because it's easy to host it inside a Qt application.

    I did make a game engine before, though (OpenGL). Couldn't turn it into a game due to time constraints :/
  • 2
    50 shades of pink
Add Comment