Proxy mode using GL_EXT_blend_color

Proxy mode using GL_EXT_blend_color

I am in way over my head in trying to play with this but I am trying it anyway. I am trying to change from ARB_imaging to GL_EXT_blend_color in wings_proxy.erl. After getting some errors about undefined macros, I discovered that inside of esdl-1.0.1\api_gen\gldefs is a list of (I assume) macros. There is already a list for GL_EXT_blend_color in the gldefs file. Using the names in this list got rid of the undefined macro errors. The code below will compile but when I use Shift Tab followed by Tab I get a crash that locks up Wings3d and requires shutting down the erlang console window in order to exit wings3d. In the erlang console I see the following which I assume is the problem. "setting wireframed_objects on geom to {1,{1,nil,nil}}"nil cannot be a good thing.... I am thinking the nils are coming from the gl:blendColor line below???

The documentation for GL_EXT_blend_color says I should use "BlendFunc" instead of "blendFunc" and use "BlendColorEXT" instead of "blendColor". However, when I change those I get "variable 'BlendFunc' is unbound".

I used AstroGreep (windows version only). It was using it I found every thing I want in the sources. I assigned jEdit editor to *.erl extension on its Options->Text Editor, so after it find the file and line where the text is present I just double-click and get into the code.

oort, take care about changing esdl. As you know dgud has updated it - is a 2nd version.Also, I have thinking about this and the transparence works fine in proxy mode exept when you are moving the mesh itens. So it seems that only in this case something had bad settings. I would like to take a look at the wings_draw/wings_draw_setup/...

oort, I don't have many time until Saturday. I would like you could take a look at:wings_drag.erl - functions: motion_update and motion_update_funwings_draw.erl - function: update_dynamic and draw_smooth_faces (it checks for solid and transparent materials)wings_proxy.erl - function: update_dynamic

They will prepare the #dlo record for painting the objects. It's just what I had thought to verify.__________________OFF:There is a little trick in order to use jEdit and AstroGreep together:Create a batch file (jEdit.bat) and add a line like this (adjust the path if necessary):

Then, in the Options->Text Editor use Add button and:- set the File Type field to *.erl;- for Text Editor Location browse the bat file that you just created;- and set the Command Line field with %1 +line:%2

Just posting to say I looked at those functions a little bit last night. I need to study them a lot more since they require a lot more coding knowledge than I have at this time.

Also, I like AstroGrep very much.

Edit:I found out why I was getting the "variable 'BlendFunc' is unbound" error. I needed to use "glBlendFunc" and "glBlendColorEXT". Somehow I missed seeing the gl. The official documentation for OpenGL does not show the gl. I restored all the esdl_1.0.1 files to the official release and Wings3d compiles with the wings_proxy.erl code below.

I found out that it was the "gl:blendColor(0, 0, 0, Opacity)" in the code that was causing the Shift Tab > Tab crashes. If blendFunc is part of the core it looks like blendColor is not. That part doesn't seem to work without ARB_imaging. I copied some other code to replace it and now I have proxy mode moving opacity working to some degree. It still needs some more work.

Here is the code I am using to get Proxy Mode Material Opacity when moving verts, while using GL_EXT_blend_color. It probably needs more work but I thought I would post my progress so far. Also, if there is a fear that there may be some that do not have support for GL_EXT_blend_color, a programmer could probably test for both GL_ARB_imaging and GL_EXT_blend_color. Note that I had to switch form CONSTANT_ALPHA's to SRC ALPHA's in wings_proxy.erl. I don't know how Moving and Stationary Opacity settings are supposed to get added into the code.

Edit: The following may be what is used to access the moving and stationary opacity setting with ARB_imaging. I cannot access blendColor when using GL_EXT_blend_color at this time.

In that PC with Intel G33/31 video card, the only necessary change to wings_proxy.erl was that in the case clause. Then I got the transparency working exactly like it works on my home PC (with GTX 560Ti).If I add those lines inside of case statement as you had suggested I get this kind of image:Uploaded with ImageShack.us

I tried again tonight to get this working with the CONSTANT functions and gl:blendColor. I didn't get it to work but I came up with some cleaner code. This doesn't crash but the Preferences > Misc >Proxymode > Moving and Stationary Opacity settings still only function as on/off switches.

oort, I did some tests with many variations of parameters without success (as spected). I think we never will get it working without to use the GL_CONSTANT_ALPHA and GL_ONE_MINUS_CONSTANT_ALPHA parameters.You already should be noticed that its math in glBlendFunc is impossible to be generated with other parameters. It's really an OpenGL limitation - best if you could upgrade it at least to version 1.4.

I searched a bit more and I found these posts (post1 and post2) that can help us to understand a little more about how some parametes work.

Micheus,I think you are right. Is it possible to change the else statement so that it tests for OpenGL 1.4 instead of GL_ARB_imaging (Current code) and GL_EXT_blend_color (Current fix for you). That way anyone with a card that supports the minimum of OpenGL 1.4 will get the code that works for you (true result). Then add the code that partly works for me to help people who do not have OpenGL 1.4 (false result). This will get rid of the obscure GL_ARB_imaging (imaging subset) that is currently in the code.

Funny that post1 is one that I had come across. Post2 is a very helpful one.

<<Then add the code that partly works for me to help people who do not
have OpenGL 1.4 (false result). This will get rid of the obscure
GL_ARB_imaging (imaging subset) that is currently in the code.>>

Should we add a test looking for OpenGL version in this case statement?If we do this - as you told - the people with a OpenGL version less than 1.4 will be able at least to use the transparence of material to get a result close to that they would get with the currente code.

You are probably right. Test for GL_ARB_imaging ... if that fails test for OpenGL 1.4... if that fails use the method that hopefully works for all other cards with the Moving/Stationary Opacity missing. Maybe have the info about this in the information line. Something like... "Moving/Stationary Opacity requires GL_ARB_imaging or minimum OpenGL 1.4. otherwise 1= 100%, <1= Material Opacity."

<< Maybe you can come up with some better information line statement? >>

Yes. I also think that we will have to leave this clear there.

Just for test, today I decided to run Wings inside of VirtualBox - I have a virtual machine for WinXP 32 - hosted in my desktop and I noticed that Wings3d information about OpenGL reports:Vendor: Microsoft Corporation; Renderer: GDI Generic; Version: 1.1.0GL extensions: GL_EXT_bgra, GL_EXT_paletted_texture and GL_WIN_swat_hint.

Curiously - by using this fixed version of Wings - the Moving/Stationary Opacity sliders are disabled. So, I can see translucent materials just by using either Tab or Shift+Tab, despite the good OpenGL support.I will try to figure out what is going on.

By the fixed version of wings I assume your fixed version and not the code listed in my last post. You saying the sliders are disabled makes me worry that you are using the code exactly as I posted it. Hopefully this is not the case. If you already have a fixed version that checks for OpenGL 1.4 but also works on systems without it, I can test it to see what happens on my system.

The code in my last post was to only check for ARB_imaging and disable the sliders when it is not present.