Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 15

Thread: Convert to HLSL clip-space as a last step in vertex shader?

Threaded View

  1. #1
    Member Regular Contributor
    Join Date
    Jan 2005
    Location
    USA
    Posts
    411

    Convert to HLSL clip-space as a last step in vertex shader?

    From what I can tell OpenGL uses a -1,+1 clip space (along Z) and Direct3D uses a 0,1 clip space (the Y axis is also flipped I think??)

    I have this arrangement where the client app doesn't know what the underlying vendor API is going to be, so it is up to the shader (ideally) to deal with the agnostic inputs.

    Given OpenGL conventions running in an HLSL shader. The only challenge I think is the clip space.

    I am hoping that this can be wrapped up in the last few lines of the vertex shader. And thought it would not hurt to just ask


    FYI: For what it's worth, I've always liked OpenGL (column major) matrices on the CPU side, though I know people bemoan them. The real value in my opinion is having the axes and position of the matrix accessible as contiguous memory. I don't know if that was the original motivation for the arrangement, but if your code needs to be around for a long time I think this is best for everyone on the maintainer side. I'm not as crazy about the -1,1 clip space (at least it's consistent in all 3 dimensions) but I reckon it would help to just pick a side, and OpenGL is obviously the better side from an openness standpoint.
    Last edited by michagl; 09-08-2012 at 01:32 PM.
    God have mercy on the soul that wanted hard decimal points and pure ctor conversion in GLSL.

Posting Permissions

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