Are all vertex programs compatable with both DX and OpenGL?

Can I use the DX asm tools and use them with OpenGL? I’m ready to start experimenting with these vertex and pixel shaders

not directly
go to your hardware vendor in the development section to find out how to expose your hardware features with the specific extensions…

nvidia:
GL_NV_vertex_program(1,1.1)
GL_NV_texture_shader(1,2,3)
GL_NV_register_combiners(1,2)

ati:
GL_EXT_vertex_shader
GL_ATI_fragment_shader

NV_vertex_program was designed to be almost exactly compatible with DX8 vertex shaders.

  • Matt

NV_vertex_program was designed to be almost exactly compatible with DX8 vertex shaders.

There is still this “almost” :slight_smile:
I know there is a tool on the NVIDIA website which alows loading dx shaders in OpenGL directly. The tiny bit of documentation i found about it just mentioned that it doesn’t support pixel shaders.
But are there Vertex Operations that can’t be converted from dx to gl or gl to dx ?

Lars

I don’t understand why D3D has all the vertex program helpers and OpenGL has none…as far as I know. I need help getting started with vertex and pixel shaders in OpenGL but all the resources are revolving around D3D!

I know Nutty has some source examples, but I need to get my hands on a very informative white paper. Something that will walk you through step by step explaining what’s happening. Without that I’m dead in the water. I’ve tried on several occasions to try and start learning this stuff, but have always quit because the info for doing it in OpenGL is just not there, or very well hidden.

So does anyone have links to some resources that can help me? I would extremely appreciate it if I could get some.

Thx,
Aaron Taylor

Originally posted by mcraighead:
[b]NV_vertex_program was designed to be almost exactly compatible with DX8 vertex shaders.

  • Matt[/b]

Too bad it’s not support on non-GeForce hardware.

I went and dled Nuttys first sample vertex program…so I guess all I really need is just a paper that describes what the keywords mean and maybe some examples on how to do cross products and stuff.

I would suggest the NV_vertex_program specification, if nothing else; it certainly has an example of how to do a cross product.
http://oss.sgi.com/projects/ogl-sample/registry/NV/vertex_program.txt

Search for “How do you perform a 3-component cross product in two instructions?”

  • Matt

Originally posted by Lars:
But are there Vertex Operations that can’t be converted from dx to gl or gl to dx ?Lars

I believe that all possible DX8 programs can be trivially modified to work with VP1.0, and vice versa. VP1.1 programs may not necessarily be portable to DX8.

By ‘trivially’ I mean that all you need not do any extensive parsing or semantic or dataflow analysis of the program.

It should be possible to port from DX8 to ARB_vertex_program with not much more difficulty than porting to NV_vertex_program, but the reverse is likely not true.

I can’t speak for automatic porting to/from EXT_vertex_shader, since I am not very knowledgeable about it, though I suspect it would be somewhat more difficult, because you would actually have to parse C source code (which might use other language constructs, like looping).

  • Matt

Awesome! Thx Matt!

Do you guys usually just write the programs yourself and not use any tools to create them for you like the one for D3D?

Does anyone know if someone is writing something similar to the D3D vertex compiler for OpenGL? That would be VERY handy.