Re: Texture clamping



Sam Brown wrote:

That certainly seems to work. Thanks! I need to find a decent
"DX to GL" document... :)

There's not really much to do. Direct3D uses left handed coordinates,
whereas OpenGL uses right handed coordinates. A glScale(1,1,-1) to the
identity matrix does the trick.

Then the clipping ranges after projection are different. OpenGL uses (-1, 1)
* [x, y, z], whereas Direct3D goes for (-1,-1)*x , (-1,-1)*y , (0,1)*z
(IIRC). (Well, actually the clip range is determined by the 'w' component,
but this 1 most of the time.)

And last but not least the texture coordinate is treated differently.

Then you've got the different shader languages, of course. In this case I
recommend a pragmatic approach: Use the Cg language from NVidia. Any Cg can
be used with either OpenGL or DirectX. You will inevitably have small
differences on how coordinates must be dealt with. For this just use a
DirectX/OpenGL uniform, that scales all incoming vertex vectors
apropriately (most of the time only the Z coordinate).

Since I want my engine to be fully open source, I didn't use Cg, but
developed my very own shading language, which has been inspired by Lisp.
And the 'sh' project may be also of interest, though IMHO creating shaders
by the means of C++ template meta programming is not very wise for a large
scale project: Changing a shader requires full recompilation of the source
code and it's dependencies.

Greets

Wolfgang

.



Relevant Pages

  • Re: 3d
    ... > two choices for the PC, namely based on Directx or based on OpenGL. ... I'm not so sure that Java3D ... If your card advertises hardware acceleration of OpenGL, ... accelerates Direct3D operations, then it's also likely to be accelerated ...
    (comp.lang.java.programmer)
  • Re: is DirectX a good choice for me ?
    ... But I can't because I need to be able to handle RGBA pixel format at least 16bits and Greyscale pixelformat> 16bits, and with OpenGL, some drivers are internally using only 8bits pixel values. ... I need to render the scene offscreen (command line application without window) with and without antialiasing. ... but you still must create a window to use either OpenGL or Direct3D. ... channel, but I am unsure about 32 bits per channel. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Is Direct3D a rip-off of OpenGL?
    ... > WTH wrote: ... > presentation on the Microsoft web site". ... Continue to support OpenGL ICDs ... >>> it compete with Direct3D on even ground in terms ...
    (comp.graphics.api.opengl)
  • Re: please sign for not delete the opengl from next release of windows
    ... OpenGL, Direct3D, GDI all in their drivers. ... If can ONLY lead to more stable and robust drivers. ... with same backend and engineer efficient frontend which feeds from both formats of API. ...
    (comp.graphics.api.opengl)
  • Re: Texture clamping
    ... whereas OpenGL uses right handed coordinates. ... identity matrix does the trick. ... restrictions on matrix conventions, not the APIs:) ...
    (comp.graphics.api.opengl)

Loading