Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-08

New widgetset

37 messages · 9 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

ZeelandNet Webmail

I've ported the nvidia-widgetset to FPC. This
widgetset is very light-weight and has an OpenGL backend (easily extendible). This means that it's very usefull for projects that use OpenGL and do not want to add dependencies on a "heavy" widgetset. It also makes your project look the same on all platforms because all drawing is done from the code.

There are quite a number of widgets
implemented, for more information see the readme.txt. The nice thing about this widgetset is that it comes with it's own layoutmanager which you can embed to build complex layouts.

It would be nice if this
widgetset could be hosted on the SVN repository of the CCR for instance. Of course I would create a wikipage if it would find it's way up there :) I have some ideas to "pascalize" the code a bit more by cleaning up some of the C++ remains (eg use of sets). Also I know there are some subtle bugs in the code that were there already in the original code and I just ported them because of lack of time :)

Have fun with
it!

Regards, Darius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110815/ac230f7c/attachment-0001.html> -------------- next part --------------
A non-text attachment was scrubbed...
Name: nvidia-widgets.zip
Type: application/zip
Size: 23735 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110815/ac230f7c/attachment-0001.zip>

Reply by email

Vincent Snijders
to Unknown author

2011/8/15 :

Show quoted text 10 lines
I've ported the nvidia-widgetset to FPC. This widgetset is very light-weight?and?has an OpenGL backend (easily extendible). This means that it's very usefull for projects that use OpenGL and do not want to add dependencies on a "heavy" widgetset. It also makes your project look the same on all platforms because all drawing is done from the code. It would be nice if this widgetset could be hosted on the SVN repository of the CCR for instance. Of course I would create a wikipage if it would find it's way up there :)

No problem with that. As far as I can see, you don't have write access to SVN yet. do you?

If that is correct, please read
http://wiki.lazarus.freepascal.org/Using_the_Lazarus-ccr_SVN_repository and send me your SourceForge account name.,

Vincent

Reply by email

Reimar Grabowski
to Unknown author: ZeelandNet Webmail I've ported the nvidia-widgetset to FPC. This widgetset is very…
This means that it's very usefull for projects that use OpenGL and do not want to add dependencies on a "heavy" widgetset.

Unfortunately this widgetset uses immediate mode to do it's drawing. This means it won't mix well with modern designed OpenGL 2.x and up code (performance wise).

Nonetheless, it's better to have more options.

Good work.

R.

A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail?

Reply by email

Graeme Geldenhuys
to Unknown author: ZeelandNet Webmail I've ported the nvidia-widgetset to FPC. This widgetset is very…
Show quoted text 7 lines
This widgetset is very light-weight and has an OpenGL backend (easily extendible). This means that it's very usefull for projects that use OpenGL and do not want to add dependencies on a "heavy" widgetset. It also makes your project look the same on all platforms because all drawing is done from the code.

This sounds so familiar. ;-)

I downloaded, compiled, and installed libglut3. When I run the example project from the command line, I get the frame of the application, but no contents, and continuous output as follows to the console.

------------------------------------------
...
Failed to allocate :
size : 0 bytes
alignment : 256 bytes
domains : 2
Failed to allocate :
size : 0 bytes
alignment : 256 bytes
domains : 2
Failed to allocate :
size : 0 bytes
alignment : 256 bytes
domains : 2
Failed to allocate :
size : 0 bytes
alignment : 256 bytes
domains : 2
Failed to allocate :
size : 0 bytes
alignment : 256 bytes
domains : 2
Failed to allocate :
size : 0 bytes
alignment : 256 bytes^C

---------------------------------------------

The above output never ends, and I need to kill the application.

I'm using 64-bit Ubuntu 10.04 with FPC 2.4.5

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Mark Morgan Lloyd
to Vincent Snijders: 2011/8/15 : No problem with that. As far as I can see, you don't have write access to…
Vincent Snijders wrote
:> I've ported the nvidia-widgetset to FPC. This widgetset is very light-weight and has an OpenGL backend (easily extendible).

If based on OpenGL, does this imply that apps compiled using it won't map across a network connection using VNC, X etc.?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Unknown author
to Unknown author: ZeelandNet Webmail I've ported the nvidia-widgetset to FPC. This widgetset is very…

On Mon, 15 Aug 2011 18:47:25 +0200, wrote: Hi Graeme,

I've tested
it on 32bit Linux, Windows and Mac so it should work. Unfortunately you're not very helpfull by stating it just does not work, talking about sounding familiar! Be more specific if you can. Provide a backtrace or similar. Does glut itself work properly, have you tested that? There could be a problem with texture allocation, could be a million things. For now it's just guessing.

Darius

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110816/9d277ae0/attachment.html>

Reply by email

Graeme Geldenhuys
to Unknown author
you're not very helpfull by stating it just does not work, talking about sounding familiar!

In no way did I mean that rude. I was referring to the relation with fpGUI: Custom drawn, light on dependencies, looking the same on all platforms etc. Exactly the same "design goals" as can be seen with fpGUI. Great minds think alike. :)

Be more specific if you can. Provide a backtrace or similar. Does glut itself work properly, have you tested that?

I know nothing about OpenGL, or even what GLUT is? For the latter, I guess it's a wrapper around OpenGL's API, presumably to make programming easier?

As for giving a backtrace, GDB doesn't seem very helpful either. But if you have other ideas or structions of what I can try, I'll give them a go by all means.

-----------------------------------
[examples]$ gdb ./example
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/home/graemeg/Desktop/nvidia-widgets/src/nvwidgets/examples/example...done. (gdb) run
Starting program:
/home/graemeg/Desktop/nvidia-widgets/src/nvwidgets/examples/example [Thread debugging using libthread_db enabled]
Cannot find new threads: generic error
(gdb)
-----------------------------------

So it seems it can't run via GDB.

So the best I can do at this time is give you the output it generates (redirected to a file).

-------------------------------
internal: unknown instruction
Failed to allocate :
size : 0 bytes
alignment : 256 bytes
domains : 2
Failed to allocate :
size : 0 bytes
alignment : 256 bytes
domains : 2
Failed to allocate :
size : 0 bytes
alignment : 256 bytes
domains : 2
...
...[continues this forever]...
-------------------------------

How do I test GLUT on it's own? I know OpenGL works on my PC, because I can run MSEgui's OpenGL example, and my OpenGL screensavers work.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Unknown author
to Unknown author: On Mon, 15 Aug 2011 18:47:25 +0200, wrote: Hi Graeme, I've tested it on 32bit Linux,…

On Tue, 16 Aug 2011 10:28:55 +0200, wrote:

GLut is a platform
independent context handling toolkit for OpenGL. It's not very good, nor fast but it's widely used and available on all sorts of platforms (see also freeGlut).

The widgets make use of the GSLS shader to render. So perhaps something is going wrong here for you, or it's the textures like I said before.

To get to the bottom of it,could you please check
if:
The program passes line 167 in the example project? This is where the shader is setup, or does it fail at line 175-177, where the textures are setup? In any case does it reach line 189?

Regards, Darius

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110816/15ef3831/attachment.html>

Reply by email

Graeme Geldenhuys
to Unknown author: GLut is a platform independent context handling toolkit for OpenGL. It's not very good,…
To get to the bottom of it,could you please check

OK, comparing your example app to one of the OpenGL examples included with FPC. I tried to see if the API calls are similar.

If I comment the 'doUI' call inside the display() method, then I get a black window, and NO error output to the console.

Further investigation insid doUI() method. I commented the whole body, except for the ui._begin ... ui._end. I then uncommented the body one line at a time.

As soon as I uncommented ui.doCheckButton(), then the errors to the console window started appearing.

I then kept following this "debug method" down to
GLUIPainter.drawCheckButton. If I commented the call to drawBoolFrame(), I actually get to see text on the black window! Minor progress. :) This allowed me to re-enable all lines inside doUI(). I now see two lines of text in the window, and a new error message in the console output.

"Fragment shader compile failed"

No idea if any of this makes sense or if it will help you find the problem. But hopefully it will bring you close to a solution.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Unknown author
to Unknown author: GLut is a platform independent context handling toolkit for OpenGL. It's not very good,…

On Tue, 16 Aug 2011 11:53:07 +0200, wrote:

Ok, so it's not in
the initialization. Could you then put a breakpoint in procedure display, and loop through it, just to see where it fails? If it doesn't reach reach this callback function at all you could try to set breakpoint in other callback functions: mouse, motion, idle, key, special or resize and see if something there makes the code fail.

Alternatively you can comment out the callbackfunctions (line 182 to 188) and only leave the display callback there, which is the bare minimum you need.

TIA, Darius

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110816/c9d13249/attachment.html>

Reply by email

Unknown author
to Unknown author

On Tue, 16 Aug 2011 12:34:53 +0200, wrote:
The error you recieved
indicates that you have a problem with the shader (GLSL). Difficult to tell where this comes from, but it's either the OpenGL library or your graphics card.

For more verbose information you can enable {$define NV_REPORT_COMPILE_ERRORS} in nvShaderUtils and try again.

Can you also
email me the output that you get from glutdemo.pp found in fpc opengl/examples. This example will list quite some GL information to console. We'll probably find a clue there.

Regards, Darius

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110816/f34ee17c/attachment.html>

Reply by email

Unknown author
to Unknown author

On Tue, 16 Aug 2011 12:53:27 +0200, wrote:

I just checked and the
fragent shader code I use is version 1.2. If I'm not mistaking (http://en.wikipedia.org/wiki/GLSL#Versions [1]) this means that you need OpenGL 2.1 or newer to work. Can you check this and possibly update if needed?

Regards, Darius

On Tue, 16 Aug 2011 12:34:53 +0200, wrote:

The error you recieved indicates that you have a problem with the shader (GLSL). Difficult to tell where this comes from, but it's either the OpenGL library or your graphics card.

For more verbose information
you can enable {$define NV_REPORT_COMPILE_ERRORS} in nvShaderUtils and try again.

Can you also email me the output that you get from glutdemo.pp found in fpc opengl/examples. This example will list quite some GL information to console. We'll probably find a clue there.

Regards, Darius

Links:
------
[1]
http://en.wikipedia.org/wiki/GLSL#Versions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110816/0093f1b2/attachment.html>

Reply by email

Graeme Geldenhuys
to Unknown author: The error you recieved indicates that you have a problem with the shader (GLSL).…
indicates that you have a problem with the shader (GLSL). Difficult to tell where this comes from, but it's either the OpenGL library or your graphics card.

As I mentioned, all the opengl demos with FPC works fine here.

My graphics card is:

$ lspci | grep ATI
01:00.0 VGA compatible controller: ATI Technologies Inc RV710 [Radeon HD 4350]
01:00.1 Audio device: ATI Technologies Inc RV710/730

I'm using the open source ATI drivers included with Ubuntu 10.04.

Can you also email me the output that you get from glutdemo.pp found in fpc opengl/examples. This example will list quite some GL information to console. We'll probably find a clue there.

----8<-------------8<-------------8<-------------8<-------------8<---- [examples]$ ./project1

GL info:
Vendor: Advanced Micro Devices, Inc.
Renderer: Mesa DRI R600 (RV710 954F) 20090101 TCL DRI2 Version: 1.5 Mesa 7.7.1
Extensions: GL_EXT_compiled_vertex_array GL_EXT_texture_env_add GL_ARB_depth_texture GL_ARB_depth_clamp GL_ARB_draw_buffers GL_ARB_fragment_program GL_ARB_imaging GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_point_parameters GL_ARB_provoking_vertex GL_ARB_shadow GL_ARB_shadow_ambient 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_crossbar GL_ARB_texture_env_dot3 GL_MESAX_texture_float
GL_ARB_texture_mirrored_repeat GL_ARB_texture_rectangle GL_ARB_transpose_matrix GL_ARB_vertex_array_bgra
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_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_logic_op GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_convolution GL_EXT_copy_texture GL_EXT_draw_range_elements GL_EXT_framebuffer_object GL_EXT_fog_coord GL_EXT_gpu_program_parameters GL_EXT_histogram GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_pixels GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_provoking_vertex 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_subtexture GL_EXT_texture GL_EXT_texture3D GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_vertex_array GL_EXT_vertex_array_bgra GL_APPLE_packed_pixels GL_ATI_blend_equation_separate GL_ATI_texture_env_combine3 GL_ATI_texture_mirror_once GL_ATI_separate_stencil GL_IBM_multimode_draw_arrays GL_IBM_rasterpos_clip GL_IBM_texture_mirrored_repeat GL_INGR_blend_func_separate GL_MESA_pack_invert GL_MESA_ycbcr_texture GL_MESA_window_pos GL_NV_blend_square GL_NV_depth_clamp GL_NV_light_max_exponent GL_NV_packed_depth_stencil GL_NV_texture_rectangle GL_NV_texgen_reflection GL_NV_vertex_program GL_OES_read_format GL_SGI_color_matrix GL_SGI_color_table GL_SGIS_generate_mipmap GL_SGIS_texture_border_clamp GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_SUN_multi_draw_arrays
Starting...
^C

----8<-------------8<-------------8<-------------8<-------------8<----

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Graeme Geldenhuys
to Unknown author: I just checked and the fragent shader code I use is version 1.2. If I'm not mistaking…
(http://en.wikipedia.org/wiki/GLSL#Versions [1]) this means that you need OpenGL 2.1 or newer to work. Can you check this and possibly update if needed?

How do I check what OpenGL version I have under Ubuntu? Does this help...?

$ locate libGL
/usr/lib/libGL.so
/usr/lib/libGLU.a
/usr/lib/libGLU.so
/usr/lib/libGLU.so.1
/usr/lib/libGLU.so.1.3.070701
/usr/lib/mesa/libGL.so
/usr/lib/mesa/libGL.so.1
/usr/lib/mesa/libGL.so.1.2
/usr/lib32/libGL.so
/usr/lib32/libGLU.so
/usr/lib32/libGLU.so.1
/usr/lib32/libGLU.so.1.3.070701
/usr/lib32/mesa/libGL.so.1
/usr/lib32/mesa/libGL.so.1.2

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Unknown author
to Graeme Geldenhuys: As I mentioned, all the opengl demos with FPC works fine here. My graphics card is: $…
Graeme Geldenhuys wrote 8 lines
On 08/16/2011 12:53 PM, wrote: > indicates that you have a problem with the shader (GLSL). Difficult > to > tell where this comes from, but it's either the OpenGL library or > your > graphics card. As I mentioned, all the opengl demos with FPC works fine here.

I understand you, but these widgets make use of "special" features. They use hardware acceleration by using GLSL.

Show quoted text 14 lines
> Can you also > email me the output that you get from glutdemo.pp found in fpc > opengl/examples. This example will list quite some GL information to > console. We'll probably find a clue there. ----8<-------------8<-------------8<-------------8<-------------8<---- [examples]$ ./project1 GL info: Vendor: Advanced Micro Devices, Inc. Renderer: Mesa DRI R600 (RV710 954F) 20090101 TCL DRI2 Version: 1.5 Mesa 7.7.1

This seems to indicate that you use an older version of OpenGL (1.5). AFAIK GLSL was included from OpenGL 2.0. So this suggests you should try to update your libraries.

See also here:
http://stackoverflow.com/questions/5741302/how-to-tell-if-a-computer-supports-opengl-2-0-i-want-to-write-shaders

Regards, Darius

Reply by email

Unknown author
to Graeme Geldenhuys: How do I check what OpenGL version I have under Ubuntu? Does this help...? $ locate libGL…
Graeme Geldenhuys wrote 24 lines
On 08/16/2011 01:01 PM, wrote: > (http://en.wikipedia.org/wiki/GLSL#Versions [1]) this means that you > need OpenGL 2.1 or newer to work. Can you check this and possibly > update > if needed? How do I check what OpenGL version I have under Ubuntu? Does this help...? $ locate libGL /usr/lib/libGL.so /usr/lib/libGLU.a /usr/lib/libGLU.so /usr/lib/libGLU.so.1 /usr/lib/libGLU.so.1.3.070701 /usr/lib/mesa/libGL.so /usr/lib/mesa/libGL.so.1 /usr/lib/mesa/libGL.so.1.2 /usr/lib32/libGL.so /usr/lib32/libGLU.so /usr/lib32/libGLU.so.1 /usr/lib32/libGLU.so.1.3.070701 /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so.1.2

I don't know how to do it by looking at the libs. You could check synaptic to see if newer versions are available. You can check from code by executing glGetString(GL_VERSION), but you already did that in the glutdemo. It returned a version string of OpenGL 1.5. So to me this indicates you should try to update.

Darius

Reply by email

Michalis Kamburelis
to Unknown author: On Tue, 16 Aug 2011 13:08:05 +0200, Graeme Geldenhuys I understand you, but these widgets…
This seems to indicate that you use an older version of OpenGL (1.5). AFAIK GLSL was included from OpenGL 2.0. So this suggests you should try to update your libraries.

GLSL is also available for older OpenGL 1.x, through OpenGL ARB extensions (ARB_shader_objects and friends). But I don't know if nvidia-widgetset uses it.

But in this case, the problem is most likely Mesa. You need the latest Mesa (>= 7.9) to have any chance of GLSL shaders, and they are still quite unstable (for now).

For now, the advised way to get really advanced OpenGL version, with full shader support etc., is to enable proprietary drivers, which can give you OpenGL even > 3 on newer graphic cards. Since you have Ubuntu, this is trivial, just use System->Administration->Hardware Drivers. You can easily enable, and later easily disable (if you feel unclean :) proprietary drivers from there.

HTH,
Michalis

Reply by email

Graeme Geldenhuys
to Michalis Kamburelis
Michalis Kamburelis wrote
full shader support etc., is to enable proprietary drivers, which can give you OpenGL even > 3 on newer graphic cards. Since you have Ubuntu, this is trivial, just use System->Administration->Hardware Drivers.

OK, I switched to the proprietary AMD/ATI driver. I now have OpenGL 3.2 enabled and reported by the FPC OpenGL examples.

The new widgetset example now runs without problems - though I'm not sure what I am supposed to see in the example. I see 2 checkbox. Click the top one, and I see 3 checkboxes. Click the 2nd checkbox and I see a horizontal slider. Clicking the Benchmark button does nothing, but from the code I think that is correct. Changing the Format combobox doesn't do anything either.

I don't see anything resembling "textures" (as referred in previous messages). But than that is probably some OpenGL speak I know nothing about. Same with "shaders" - I have no clue what that is on does. :)

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Unknown author
to Graeme Geldenhuys
Graeme Geldenhuys wrote
The new widgetset example now runs without problems - though I'm not

Good news!

Show quoted text 9 lines
sure what I am supposed to see in the example. I see 2 checkbox. Click the top one, and I see 3 checkboxes. Click the 2nd checkbox and I see a horizontal slider. Clicking the Benchmark button does nothing, but from the code I think that is correct. Changing the Format combobox doesn't do anything either.

The example project is poor, but that's what was originally supplied by the original project. Creating a new and better test project that shows all possibilities of the widgetset would be nice, but I don't have time for it now. If anyone plays with the widgetset and want's to submit his/her test project, I'm fine with that.

I don't see anything resembling "textures" (as referred in previous messages). But than that is probably some OpenGL speak I know nothing about. Same with "shaders" - I have no clue what that is on does. :)

I forgot to commit a fix for the textures. I will fix this later today. Textures are nothing more than in memory bitmaps. In this case we generate one at the beginning of app and paint it each cycle to screen. The shaders are little programs that are executed on your graphics card, this makes them ultra fast of course.

Regards, Darius

Reply by email

Ludo Brands
to Darius Blaszyk
Show quoted text 8 lines
> I forgot to commit a fix for the textures. I will fix this later > today. Fix committed, please update and test. Regards, Darius

Tried the example but it crashes with a segfault at line 31 in nvShaderUtils. It appears that the address of glCreateShader is nil. I tried to break into any of the Load_GL_VERSION_x_y or glext_LoadExtension in glext.pp but no success. When are functions like glCreateShader supposed to be initialised?

Ubuntu 10.04 OpenGL 2.1, shading language version 1.2

Thanks, Ludo

Reply by email

Michalis Kamburelis
to Ludo Brands
Ludo Brands wrote 8 lines
Tried the example but it crashes with a segfault at line 31 in nvShaderUtils. It appears that the address of glCreateShader is nil. I tried to break into any of the Load_GL_VERSION_x_y or glext_LoadExtension in glext.pp but no success. When are functions like glCreateShader supposed to be initialised? Ubuntu 10.04 OpenGL 2.1, shading language version 1.2

glCreateShader is initialized by Load_GL_version_2_0 (also, higher Load_GL_version_x_x call Load_GL_version_2_0).

Darius: nvidia-widgets/src/nvwidgets/nvglutwidgets.pas calls Load_GL_version_2_0, but the result is not checked. You should abort the program (probably it would be nicest to raise an exception) if Load_GL_version_2_0 returns false (meaning that some entry points are not defined). Since the rest of the code seems to assume that GLSL functions are initialized.

Ludo: Are you sure you have OpenGL 2.1? Some OpenGL implementations unfortunately lie, claiming in glGetString(GL_VERSION) that they support higher version than in reality. You can try adding Writeln(Load_GL_version_2_0) into any OpenGL example program, and you will probably see that it answers false. For example, you can add Writeln(Load_GL_version_2_0) inside the FPC demo
packages/opengl/examples/glutdemo.pp, near the other writelns.

Michalis

Reply by email

Ludo Brands
to Michalis Kamburelis
Show quoted text 13 lines
glCreateShader is initialized by Load_GL_version_2_0 (also, higher Load_GL_version_x_x call Load_GL_version_2_0). Ludo: Are you sure you have OpenGL 2.1? Some OpenGL implementations unfortunately lie, claiming in glGetString(GL_VERSION) that they support higher version than in reality. You can try adding Writeln(Load_GL_version_2_0) into any OpenGL example program, and you will probably see that it answers false. For example, you can add Writeln(Load_GL_version_2_0) inside the FPC demo packages/opengl/examples/glutdemo.pp, near the other writelns.

Apparently it is an incomplete 2.1: glBlendEquationSeparate isn't defined and Load_GL_version_2_0 exits immediately. I checked all others up to glCreateShader and they are present (nm -D /usr/lib/mesa/libGL.so.1.2).

I made a local copy of glext.pp and commented the lines that load and check the address of glBlendEquationSeparate and the example runs now. There is a message "fragment shader compile failed" though.

The all or nothing approach in Load_GL_version_X_Y (all functions are present or fail) is simple but has its disadvantages when working with third party libraries. Fe Synapse uses a more elaborate method of loading defines for every function a wrapper that checks if the function pointer is assigned and then calls it or raises a meaningfull exception.

Ludo

Reply by email

Michalis Kamburelis
to Ludo Brands

Ludo Brands write:

Show quoted text 7 lines
The all or nothing approach in Load_GL_version_X_Y (all functions are present or fail) is simple but has its disadvantages when working with third party libraries. Fe Synapse uses a more elaborate method of loading defines for every function a wrapper that checks if the function pointer is assigned and then calls it or raises a meaningfull exception.

When an entry point is nil, the error message is more or less clear if you can read the backtrace :) The real trouble is that defining such "stub" versions for all the functions would be unmaintainable IMHO, as there are a *huge* number of GLExt functions, with various parameters. That's a lot of work, only to deal with inferior OpenGL implementations.

Maybe all the Assigned() checks could be moved lower, so that everything possible is still loaded, even when Load_GL_version_x_x returns false. Although this will still be risky: the programs that want to play safe should just assume that you really don't have (correct) OpenGL 2, and just don't use any of it's functions, if some entry point failed, IMHO.

GLSL shaders are also available through ARB extensions, and this is a good fallback that works in practice, in my experience. (For example, my fglrx lies about OpenGL 2 too, but it has valid ARB_shader_objects and friends.) So using GLSL shaders even with these broken implementations is possible. However nvidia-widgetset doesn't use ARB_shader_xxx. Understandably, nvidia-widgetset assumes a correct OpenGL implementation, and I have indeed never seen nvidia OpenGL lying about it's version (fglrx, and some latest Intel, lie all the time on the other hand..)

Michalis

Reply by email

Darius Blaszyk
to Michalis Kamburelis: glCreateShader is initialized by Load_GL_version_2_0 (also, higher Load_GL_version_x_x…
Michalis Kamburelis wrote 6 lines
Darius: nvidia-widgets/src/nvwidgets/nvglutwidgets.pas calls Load_GL_version_2_0, but the result is not checked. You should abort the program (probably it would be nicest to raise an exception) if Load_GL_version_2_0 returns false (meaning that some entry points are not defined). Since the rest of the code seems to assume that GLSL functions are initialized.

Hi Michalis,

Thanks for the tip. I now check the function result and exit gracefully when the result is false.

Regards, Darius

Reply by email

Michael Schnell
to Unknown author: ZeelandNet Webmail I've ported the nvidia-widgetset to FPC. This widgetset is very…
I've ported the nvidia-widgetset to FPC.

Nice !

This widgetset is very light-weight and has an OpenGL backend (easily extendible).

Could you elaborate on the common aspects and the differences regarding the other maybe upcoming OpenGL-based widget that might some time provide compatibility to Delphi's new "FireMonkey" GUI and would be based on KSDev GLScene ?

Thanks,
-Michael

Reply by email

Graeme Geldenhuys
to Michael Schnell
Michael Schnell wrote
BTW.: My "standard" question on such topics: Does it decently handle TTimer, TThread.synchronize, TApplication..QueueAsyncCall, PostMessage, ... ?

If you looked at the code and the example project, you would have seen in is nothing like VCL or LCL. It is a completely different class design. This thread would probably have been more relevant in a general fpc mailing list (eg: fpc-users), but Darius was also looking for a place to host the code (eg: LLC) - thus asked here.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Graeme Geldenhuys
to Michael Schnell
Michael Schnell wrote
OK. For me a "widget set" in combination with Lazarus always is a "Widget Type" selectable as a project option build mode.

:-)
Don't worry, when I saw the first post, that is what I thought too - LCL got a new "widget type", but that was in fact not the case.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Darius Blaszyk
to Michael Schnell: Nice ! Could you elaborate on the common aspects and the differences regarding the other…
Michael Schnell wrote 6 lines
On 08/15/2011 06:47 PM, wrote: > > I've ported the nvidia-widgetset to FPC. Nice ! > This widgetset is very light-weight and has an OpenGL backend (easily extendible). Could you elaborate on the common aspects and the differences regarding the other maybe upcoming OpenGL-based widget that might some time provide compatibility to Delphi's new "FireMonkey" GUI and would be based on KSDev GLScene ?

Hi Michael,

This widgetset cannot be compared to any "conventional" event-driven widgetset. Instead it's a minimal super lightweight widgetset, which you can easily drop into your OpenGL project. In fact you can easily mix it with another widgetset library.

Darius

Reply by email

Darius Blaszyk
to Michael Schnell: BTW.: My "standard" question on such topics: Does it decently handle TTimer,…
Michael Schnell wrote
On 08/15/2011 06:47 PM, wrote: > > I've ported the nvidia-widgetset to FPC. BTW.: My "standard" question on such topics: Does it decently handle TTimer, TThread.synchronize, TApplication..QueueAsyncCall, PostMessage, ... ?

The widgetset does not know a TApplication. It will not have problems with TTimer or TThread.

(I can provide a testing program for this if you want me to.)

Test programs are happily accepted!

Regards, Darius

Reply by email

Darius Blaszyk
to Graeme Geldenhuys: If you looked at the code and the example project, you would have seen in is nothing like…
Graeme Geldenhuys wrote 11 lines
On 08/17/2011 11:33 AM, Michael Schnell wrote: > BTW.: My "standard" question on such topics: Does it decently handle > TTimer, TThread.synchronize, TApplication..QueueAsyncCall, PostMessage, > ... ? If you looked at the code and the example project, you would have seen in is nothing like VCL or LCL. It is a completely different class design. This thread would probably have been more relevant in a general fpc mailing list (eg: fpc-users), but Darius was also looking for a place to host the code (eg: LLC) - thus asked here.

True, although I think this topic is in between FPC and Lazarus. So this thread seem on-topic to me for both mailinglists, unless the moderator decides otherwise as far as I'm concerned.

Regards, Darius

Reply by email

Michael Schnell
to Darius Blaszyk: The widgetset does not know a TApplication. It will not have problems with TTimer or…
Darius Blaszyk wrote
The widgetset does not know a TApplication. It will not have problems with TTimer or TThread.

I now understand that this widget set does not come with an event mechanism, so my question is irrelevant.

Test programs are happily accepted!

As same tests nothing but the event mechanism, I suppose its irrelevant regarding this issue.

-Michael

Reply by email