Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

browny

OpenGL Pixel shaders in OpenGL

This topic is 5549 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using a GeForce4 Ti 64 MB card and it certainly has programmable pixel shader capability. But most of the programs/demos floating around the net uses "GL_ARB_fragment_program" extension to do pixel shading which my driver doesn''t have. I have tried updating my drivers from nVidia.com but still... "GL_ARB_fragment_program" seems to be missing though i have extensions like "GL_NV_register_combiners" "GL_NV_register_combiners2" and "GL_NV_texture_shader" which i suppose are NVIDIA''s own pixel shading extensions. If that''s the case then if i write a pixel shader now using the extensions that i have in my driver then it might not run on an ATI board for the same reason the downloaded demos aren''t running on my card only because i dont have an extension (GL_ARB_fragment_program ) whereas my hardware has the capability. NOW the question is... how STANDARD is OpenGL when it comes the the question of some widely used stuffs like "Vertex Shaders" and "Pixel Shaders" ?

Share this post


Link to post
Share on other sites
Advertisement
GL_ARB_fragment_shader?!
Either GL_ARB_fragment_shader or GL_ARB_fragment_program is an ATI extension??!

Share this post


Link to post
Share on other sites
quote:
Original post by browny
If that''s the case then if i write a pixel shader now using the extensions that i have in my driver then it might not run on an ATI board for the same reason the downloaded demos aren''t running on my card only because i dont have an extension (GL_ARB_fragment_program ) whereas my hardware has the capability.


The answer is easy: your card has no support for programmable pixel shaders. ARB_fragment_program is only supported by fully programmable hardware, ie. DX9-type boards: GeForce FX, Radeon 9x00.

The GeForce4 does not support that extension, because it does not have the required hardware support. In fact, a GeForce4 is not programmable, but configurable. Means, it still has a fixed function pixel pipeline, but you can route the fragments around in a multitude of ways. This is done with vendor specific extensions aka. NV_register_combiner(1,2) or NV_texture_shader(1,2,3). Your code will obviously not work on ATI cards then.

Your options:

*) Write two codepaths, one for nVidia and one for ATI. This is certainly the best choice to target a wide range of 3D cards out there, but it''s more work.

*) Get a new 3D card, and use ARB_fragment_program. Your code will only work on DX9-level cards.

*) Don''t use pixelshaders at all, but use standarized combiners, eg. ARB_texture_combine. This will work on all cards, but is technically very limited.

*) Enable NV30 emulation on your GeForce4. This will give you the ARB_fragment_program extension, but it will be 100% software emulated. It will be extremely slow. But you can at least develop for DX9 type cards without needing one.

*) Use Cg. Cg can compile into all kinds of vendor-specific or vendor-independent extensions.

Share this post


Link to post
Share on other sites
Cg is good here.

very good.

One disadvantage in Cg is that it doesn''t compile to Ati extensions (which should be obvious why)... But also, it doesn''t compile to Direct3D pixel shader 1.4... Which is a lot more useful now days than nvidia will probably admit... This makes a radeon 8500/9000/9100/9200 pretty useless in GL and no better than a Ti in D3D.. When in both it is really a lot more powerful.

Although, I havn''t looked into it, I think there might be other Cg compilers, which may solve this problem (there is a dud link on the nvidia dev site called ''open source compiler'', which gives hope)

there is also ''CGFx'' - effectivly the direct3d fx file format, but for GL and D3D, which lets you do nice material and old-school combiner stuff. Tis very good this. I wish I knew about it before I wrote my own combinery shadery materialy codey stuff in the past.

I''ve had a few issues with Cg for some small things not working right but overall it''s really nice.

It''s a lot nicer than writing (and especially converting) asm / combiners... especially if you want a bit of artistic freedom.

| - Project-X - On hold.. - | - adDeath - | - email me - |

Share this post


Link to post
Share on other sites
D3D8 has the same problems as well. While Ati can process ps < 1.4, they''re emulated thru 1.4 and thus loose some speed from what I understand. I were you I would just buy dx9 card ie. one that can do gl arb fragment/vertex programs. Rumors have it that ati''s r300 core and up can do gl2 but it has to be written into drivers first. I also understand that ati has very fast shader path compared to nv gffx. Is it still 50% behind of ati?

Share this post


Link to post
Share on other sites
GL has no problems cg compiles to ARB_fragment_program
my Radeon is running these nVidia Demo''s pretty sweet

- danushka | IRIX

Share this post


Link to post
Share on other sites
Is there a GeForce 4 Ti 64MB? There are the MX cards with 64MB but not the Ti cards.

"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"

Share this post


Link to post
Share on other sites
quote:
Original post by silvermace
Yann, do you use Cg?
im trying to get started with it but i still havnt got round to it


Yes, I do, especially for prototyping new shaders. It''s very convenient and easy to use. Although I generally rewrite the shader in ASM once it is done (performance), it''s so much simpler to have a high-level language, when you experiment around.

I will probably switch to GLSL though, once good drivers are generally available.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!