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


OpenGL Pixel shaders in OpenGL

Recommended Posts

browny    139
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 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
guts    122
Either GL_ARB_fragment_shader or GL_ARB_fragment_program is an ATI extension??!

Share this post

Link to post
Share on other sites
Yann L    1802
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
RipTorn    722
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
JD    208
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
Yann L    1802
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

  • Partner Spotlight

  • Similar Content

    • By pseudomarvin
      I assumed that if a shader is computationally expensive then the execution is just slower. But running the following GLSL FS instead just crashes
      void main() { float x = 0; float y = 0; int sum = 0; for (float x = 0; x < 10; x += 0.00005) { for (float y = 0; y < 10; y += 0.00005) { sum++; } } fragColor = vec4(1, 1, 1 , 1.0); } with unhandled exception in nvoglv32.dll. Are there any hard limits on the number of steps/time that a shader can take before it is shut down? I was thinking about implementing some time intensive computation in shaders where it would take on the order of seconds to compute a frame, is that possible? Thanks.
    • By Arulbabu Donbosco
      There are studios selling applications which is just copying any 3Dgraphic content and regenerating into another new window. especially for CAVE Virtual reality experience. so that the user opens REvite or CAD or any other 3D applications and opens a model. then when the user selects the rendered window the VR application copies the 3D model information from the OpenGL window. 
      I got the clue that the VR application replaces the windows opengl32.dll file. how this is possible ... how can we copy the 3d content from the current OpenGL window.
      anyone, please help me .. how to go further... to create an application like VR CAVE. 
    • By cebugdev
      hi all,

      i am trying to build an OpenGL 2D GUI system, (yeah yeah, i know i should not be re inventing the wheel, but this is for educational and some other purpose only),
      i have built GUI system before using 2D systems such as that of HTML/JS canvas, but in 2D system, i can directly match a mouse coordinates to the actual graphic coordinates with additional computation for screen size/ratio/scale ofcourse.
      now i want to port it to OpenGL, i know that to render a 2D object in OpenGL we specify coordiantes in Clip space or use the orthographic projection, now heres what i need help about.
      1. what is the right way of rendering the GUI? is it thru drawing in clip space or switching to ortho projection?
      2. from screen coordinates (top left is 0,0 nd bottom right is width height), how can i map the mouse coordinates to OpenGL 2D so that mouse events such as button click works? In consideration ofcourse to the current screen/size dimension.
      3. when let say if the screen size/dimension is different, how to handle this? in my previous javascript 2D engine using canvas, i just have my working coordinates and then just perform the bitblk or copying my working canvas to screen canvas and scale the mouse coordinates from there, in OpenGL how to work on a multiple screen sizes (more like an OpenGL ES question).
      lastly, if you guys know any books, resources, links or tutorials that handle or discuss this, i found one with marekknows opengl game engine website but its not free,
      Just let me know. Did not have any luck finding resource in google for writing our own OpenGL GUI framework.
      IF there are no any available online, just let me know, what things do i need to look into for OpenGL and i will study them one by one to make it work.
      thank you, and looking forward to positive replies.
    • By fllwr0491
      I have a few beginner questions about tesselation that I really have no clue.
      The opengl wiki doesn't seem to talk anything about the details.
      What is the relationship between TCS layout out and TES layout in?
      How does the tesselator know how control points are organized?
          e.g. If TES input requests triangles, but TCS can output N vertices.
             What happens in this case?
      In this article,
      the isoline example TCS out=4, but TES in=isoline.
      And gl_TessCoord is only a single one.
      So which ones are the control points?
      How are tesselator building primitives?
    • By Orella
      I've been developing a 2D Engine using SFML + ImGui.
      Here you can see an image
      The editor is rendered using ImGui and the scene window is a sf::RenderTexture where I draw the GameObjects and then is converted to ImGui::Image to render it in the editor.
      Now I need to create a 3D Engine during this year in my Bachelor Degree but using SDL2 + ImGui and I want to recreate what I did with the 2D Engine. 
      I've managed to render the editor like I did in the 2D Engine using this example that comes with ImGui. 
      3D Editor preview
      But I don't know how to create an equivalent of sf::RenderTexture in SDL2, so I can draw the 3D scene there and convert it to ImGui::Image to show it in the editor.
      If you can provide code will be better. And if you want me to provide any specific code tell me.
  • Popular Now