Re: Texture clamping
- From: Wolfgang Draxinger <Wolfgang.Draxinger@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 24 Sep 2007 12:31:15 +0200
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
.
- Follow-Ups:
- Re: Texture clamping
- From: Miles Bader
- Re: Texture clamping
- From: Gernot Frisch
- Re: Texture clamping
- From: Dave Eberly
- Re: Texture clamping
- References:
- Texture clamping
- From: Sam Brown
- Re: Texture clamping
- From: Wolfgang Draxinger
- Re: Texture clamping
- From: Sam Brown
- Texture clamping
- Prev by Date: Re: gluSphere Texture Mapping
- Next by Date: Re: How to stress the GPU most?
- Previous by thread: Re: Texture clamping
- Next by thread: Re: Texture clamping
- Index(es):
Relevant Pages
|
Loading