JOGL and software pixel shader?

Hello guys,

I have little-to-no knowledge about pixel shaders. All I know is, that they are small programs that run through your image(buffer?) and modify your pixels.
I know you can get some real nice full-screen effects this way, and I would really like to implement it in my small java game demo.

…BUT!

It seems my intel graphics card is not built for pixelshaders, so I was wondering if it’s possible to create a software pixelshader, and still get at least 30 fps.
I know the zsnes emulator(I hope to god you are familiar with this) uses some kind of software-rendering to create a nice (compatible!) fullscreen shader. It works flawlessly on the zsnes, but I want to grasp this technology and use it on my game.

If anyone can point me in the way of anything that would work with java and JOGL, I would be very happy.

It doesn’t really matter what kind of shader, I’m just looking to get rid of small jaggies in my game. Also, the smoothline stuff, and smoothpolygons in JOGL seems to be a hassle, it looks awful on my machine(at least from what I have made so far) and it runs even worse. So I can’t use those approaches.

Fullscreen software shaders is what I need.
Thanks in advance

-Felix

Well you are in fact in luck, most Intel parts do support shaders, just not the good shaders.

This may help get you started
http://opengl.org/registry/specs/ARB/fragment_program.txt

Though if you are in fact just interested in eliminating jaggies there was a recent thread on how to enable multisampling, http://www.java-gaming.org/index.php/topic,18760.0.html the post towards the end from Ihkbob is the one you’ll be most interested in.

And on the fragment shader front, while I won’t give you a detailed explanation, they do much much more than full-screen effects, think of them as little programs that operate in screen space (pixels) but they still have information about the 3D space the surface they’re a member of. Many of the effects they can be used to create are bump mapping, normal mapping, parallax mapping, shadow mapping, procedural texturing, and much much more.

Thank you very much, I will have a look at these links :smiley:

This forum has helped me 3 times or so already. And I always have answers within 1 day, its amazing.

Thumbs up for this community! And to you :wink:

edit

Is there a way to query jogl for available extensions on my card? Because I have tried all the demos I could get, and none of the antialias demos compile or run. I’m pretty sure the ARB_* stuff isnt really supported. The card I have is the 945m intel graphics from Acer aspire 9410z.

The post you linked me to, that didnt work for me either. It seems the standard method wont really work…

The 945 does support the ARB programs, it’s possible you need to update/install drivers for your card though.

Here’s a handy little program that will show you all the interesting details of your cards OpenGL implementation…
http://www.realtech-vr.com/glview/

And as for the multi-sampling, if my memory serves me correctly the Intel part does support it but with only 2 samples, so the 4 sample examples probably won’t work (change the 4 to a 2).

How do you sleep at night? Linking me to a dot.net program from a java forum heehehhe…

no seriously thanks alot, im gonna see what I can do with this information.

This laptop shipped with coughvistacough, and since I’m using ubuntu 8.04 and windows XP now, maybe the drivers wont support it? I guess they should, but I don’t know much about drivers.

Anyhow thanks, its lovely to get all this help :slight_smile:

Report him to the moderator! ;D

you don’t know MR. My (J)OGL?
http://mr.myogl.org/

we also have a GL capabilities viewer in the OpenGL Pack in case you are using NetBeans.

yup, I use netbeans hehe :smiley: but not with any JOGL package…Netbeans doesnt need to get any slower IMO hehe :slight_smile: Convince me to get it :stuck_out_tongue: I dare you!

BTW, breaking news…it’s an intel 945GM card in my laptop. And according to the .NET program, I don’t have GL_ARB_MULTISAMPLE :frowning: shux…

I wont report him…at least this time hahhaa…

edit

This doesnt really solve my problem :frowning: There must be a way to implement fullscreen shaders without having the GPU handle it…I know it might be a bit slow, but I would love to be able to do it. Ultimately I would like to be able to implement something which is compatible on every system…

Believe it or not I don’t program Java for a living. Unfortunately I get paid to write C and every day I’m reminded how much I love Java.

The 945 does support the ARB programs, at least under XP and Vista, it’s just a matter of making certain you have the appropriate drivers installed. Check the vendor string, if it says anything about GDI, Microsoft, or Mesa under Linux then you need to update your drivers, and even if it doesn’t I’d look into getting the latest drivers.

Hmm…thats strange…I went to intels site and got the latest drivers for my card (XP) and it still says I dont have multisample or ARB-support :(… Where do you get that info? (that 945gm supports multisample and ARB-program)


GL_ARB_depth_texture GL_ARB_fragment_program GL_ARB_multitexture GL_ARB_point_parameters GL_ARB_shadow GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_dot3 GL_ARB_texture_env_crossbar GL_ARB_transpose_matrix GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_window_pos GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_clip_volume_hint GL_EXT_compiled_vertex_array GL_EXT_cull_vertex GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_multi_draw_arrays GL_EXT_packed_pixels GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_texture_compression_s3tc GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_lod_bias GL_EXT_texture_filter_anisotropic GL_EXT_texture3D GL_3DFX_texture_compression_FXT1 GL_IBM_texture_mirrored_repeat GL_NV_blend_square GL_NV_texgen_reflection GL_SGIS_generate_mipmap GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_WIN_swap_hint WGL_ARB_buffer_region WGL_ARB_extensions_string WGL_ARB_make_current_read WGL_ARB_pixel_format WGL_ARB_pbuffer WGL_EXT_extensions_string WGL_EXT_swap_control

These are the formats supported according to the extensions viewer. Also, it looks like its not looking at my card, it looks up my card in some database and tells me what is actually supported(not what my driver supports).

I dont see multisample here…please tell me if im missing something or direct me to better drivers… Im using the graphics drivers from this link

You’ve got it, that second one on the list, GL_ARB_fragment_program, and I assume the vertex version is somewhere in there too.

As for the lack of multisample extension I’m vaguely remembering there is no support for that, though strangely enough isn’t there an option for it in their control panel? Or is that anisotropic filtering that they have, but is limited to a really low sample count?

I figured it might be that fragment program extension, thanks for enlightening me :slight_smile:

I’m looking at the settings of my driver now and OMG they translated it to danish for me u_u… loool I have no idea what it is,
you should never translate technical terms hehe…

But hey, since you seem to know a bit about this, maybe you can tell me if I can achieve this full-screen effect with the arb_fragment_program? And if yes, please can you point me to a demo? I searched google thin trying to find fullscreen effect demos using the arb_frag… but I couldnt really land anything.

But hey, horraaaayh for having anything remotely useful on my card hehe. I guess the arb_frag program is quite common! If most people have this, i will consider adding it to my game.

I really shouldn’t be posting while at work, but I’m stalled waiting for someone else at the moment so here we go! ;D

The basic algorithm for doing it is…
1.) draw your scene
2.) get your scene into a texture some how (FBOs, pbuffer + Render_texture, glCopyPixels)
3.) bind your scene texture
3.) draw a fullscreen quad with a fragment program that looks up the scene texture and performs your effect.

[quote]But hey, horraaaayh for having anything remotely useful on my card hehe. I guess the arb_frag program is quite common! If most people have this, i will consider adding it to my game.
[/quote]
Well the 945 is about as low end as it gets and is frighteningly common. Basically anything from ATI or Nvidia should be well beyond a 945 in features, the Geforce 3 and Radeon 8500 supported these features I believe, which should give you a feel for the era the 945 was designed for.

Nice…

So which one of step3’s should I choose? :stuck_out_tongue: jk…

But that sounds mighty nasty “…draw a fullscreen quad…” ehehe…Sounds like this might be a dirty hack to do something which is supposed to be done with some other function. But it sounds easy when you put it like that. I guess I just need to read up on some texture demos then. I haven’t really done much in this field, so this will be a challenge for me.

I’ll see what I can dow this, I guess we have solved my problem. At least so far!

Thanks alot for your time and help!

Ok I know how to render quads with textures. I guess I can quickly work out a way to do the CopyPixels thing and get it on a texture, but I simply cant find a tutorial about fragment_program :frowning: I really spent alot of time on google, but no luck.

Does anyone know how to do it or know any pages offering a tutorial/demo/source for an example doing anything simple with ARB_FRAGMENT_PROGRAM ?

I know i’m getting quite helpless with this, but i’m willing to do some work, I just cant shake this thing out my sleeve if I don’t have some example or idea about how the fragment program works…

thanks in advance

ARB_fragment_program is an assembler style language. It would maybe be easier to use CG and compile the high-level shader to the ARB_fragment_program profile. With a quick google run, I found http://www.3ddrome.com/articles/cgshaders.php. If you have it running, CG shader tutorials might get easy to find.

Thanks, im ashamed to be asking this many questions, but i’m really new to openGL so some of this stuff is hard to swallow. I have learned the fastest way to learn something is to ask seniors hehe :slight_smile:

Thanks for everyones patience with me :smiley: