Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Updating GLEW to version 2.2.0 for 2020.2 Release (March 2020)
Updating GLEW to version 2.2.0 for 2020.2 Release [message #54664] Sat, 29 August 2020 18:41 Go to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

It seems that there is new glew version (2.2.0 - March 2020). We should updated it before releasing new Upp version. Also, I had discussion today with Xemuth and our current version forces him to use GLAD.

In attachment I attached plugin/glew updated to version 2.2.0. If you want to dowload it by yourself you could do this on Sourceforge.

If you are interested in this plugin. Please test it Especially I would be grateful if Xemuth test this plugin by himself.

Sincerely,
Klugier
  • Attachment: glew.zip
    (Size: 375.17KB, Downloaded 139 times)


U++ - one framework to rule them all.

[Updated on: Sat, 29 August 2020 18:57]

Report message to a moderator

Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54665 is a reply to message #54664] Sat, 29 August 2020 19:25 Go to previous messageGo to next message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
I will test it now. Will be back soon
Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54666 is a reply to message #54664] Sat, 29 August 2020 20:00 Go to previous messageGo to next message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
First I have changed the "uppsrc/plugin/glew" by the glew you provided, then I have launch the example : Reference->OpenGL
Compilation error: C:\Upp\upp\uppsrc\plugin\glew\glew.c (34): fatal error: 'GL/glew.h' file not found

Comparing the glew you provided with the one Upp had, it should be #include "glew.h"
Same for line 53 in glew.c it should be #include "wglew.h" instead of #include <GL/wglew.h>
Same for....
You will find the patch file bellow.

Also, GLCtrl have a strange behavior concerning context (A behavior I changed in my own GLCtrl) :

When ExecuteGL is call, in original version it do this :
void GLCtrl::GLPane::ExecuteGL(HDC hDC, Event<> paint, bool swap_buffers){
    /**** CODE ****/
    wglMakeCurrent(hDC, s_openGLContext); //Hooking the OpenGL Context
   /***** Code / Swap buffer etc .... *****/
   wglMakeCurrent(NULL, NULL); //Releasing the current OpenGL Context
}


This aquisition then releasing is problematique since it prevent you to execute some OpenGL code outside of GLPaint function.
It mean I can't do OpenGL when button is pressed or fenetre resized or even when my application is starting etc... To fix this issue, in my own Ctrl I just changed the fonction like this :

void GLCtrl::GLPane::ExecuteGL(HDC hDC, Event<> paint, bool swap_buffers)
{
	ONCELOCK{
	    wglMakeCurrent(hDC, s_openGLContext); //Creating the context one time
	}
	/**** CODE .... ****/
	//wglMakeCurrent(NULL, NULL); //no release
}

Since I encoutered no problem with my version and I don't see (maybe I'm wrong) any problem with it, I would be happy it become so official behavior of GLCtrl. So I could migrate my surfaceCtrl package to this GLCtrl.

With all this, my application and OpenGL Example (in reference) work perfectly.

Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54667 is a reply to message #54664] Sat, 29 August 2020 20:22 Go to previous messageGo to next message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
I have noticed a big chunk of warning using it :
https://i.imgur.com/mFdo0My.png
Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54668 is a reply to message #54667] Sat, 29 August 2020 21:06 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Xemuth,

Thanks for the feedback. I compiled glew on windows and apply patches + fix the issue with compilation warning. Right now glew is always compile in static mode. I just wonder why "New add remove/flag" options doesn't work (with single GLEW_STATIC option) and I need manually add compiler option -D GLEW_STATIC. Mirek if you read that thread - could you answer to that question.

Xemuth small power tip for you. Keeping commented code on production is treated as code smell. Please avoid this behavior in your future commits. You can read more about this for example here or just search for "commented code" in Google Wink

I would suggest Mirek to test and apply your fixes to OpenGL you posted in this thread (of course without commented code Wink ). Thanks for these improvements!

Sincerely,
Klugier
  • Attachment: glew.zip
    (Size: 376.72KB, Downloaded 136 times)


U++ - one framework to rule them all.

[Updated on: Sat, 29 August 2020 21:13]

Report message to a moderator

Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54669 is a reply to message #54666] Sun, 30 August 2020 19:42 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Xemuth wrote on Sat, 29 August 2020 20:00

Also, GLCtrl have a strange behavior concerning context (A behavior I changed in my own GLCtrl) :

When ExecuteGL is call, in original version it do this :
void GLCtrl::GLPane::ExecuteGL(HDC hDC, Event<> paint, bool swap_buffers){
    /**** CODE ****/
    wglMakeCurrent(hDC, s_openGLContext); //Hooking the OpenGL Context
   /***** Code / Swap buffer etc .... *****/
   wglMakeCurrent(NULL, NULL); //Releasing the current OpenGL Context
}


This aquisition then releasing is problematique since it prevent you to execute some OpenGL code outside of GLPaint function.


This is needed so that you can have multiple GLCtrls in multiple windows. If you need to execute OpenGL code outside of GLPaint function, just use ExecuteGL (it is in fact inteded for that use).

Mirek
Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54670 is a reply to message #54669] Sun, 30 August 2020 22:04 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Mirek,

It seems that we have all information to update glew. Howeverm what about this change proposed by Xemuth:
if (glewIsSupported("GL_VERSION_4_3")) enhanced_mode=true;

instead of
if (glewIsSupported("GL_VERSION_2_1")) enhanced_mode=true;


Do we need it? BTW, This string should be defined in one place to change it more easily. Right now to change it we need to modify two source files (Win & X11). Mire, can we improve this? I do not have access to GLCtrl.

Klugier


U++ - one framework to rule them all.

[Updated on: Sun, 30 August 2020 22:05]

Report message to a moderator

Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54673 is a reply to message #54670] Mon, 31 August 2020 00:01 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Klugier wrote on Sun, 30 August 2020 22:04
Hello Mirek,

It seems that we have all information to update glew.


Updated.

Quote:

if (glewIsSupported("GL_VERSION_4_3")) enhanced_mode=true;

instead of
if (glewIsSupported("GL_VERSION_2_1")) enhanced_mode=true;


Do we need it?


No. Check the code for the real purpose. Above change would be grave mistake.


Quote:

BTW, This string should be defined in one place to change it more easily. Right now to change it we need to modify two source files (Win & X11).


I do not see it in X11. This is win32 specific issue if I remember well...

Mirek

[Updated on: Mon, 31 August 2020 00:01]

Report message to a moderator

Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54674 is a reply to message #54673] Mon, 31 August 2020 00:23 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Mirek,

Thanks for updating this plugin is such short amount of time!

You are right about GL version string it is only used in Windows implementation. About the if you are right too, we will do not execute some enhanced OpenGL initialization when version will be less than 4.3. If this initialization works correctly on 2.1 there is no need to change them.

Klugier


U++ - one framework to rule them all.

[Updated on: Mon, 31 August 2020 00:26]

Report message to a moderator

Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54675 is a reply to message #54669] Mon, 31 August 2020 00:35 Go to previous messageGo to next message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
mirek wrote on Sun, 30 August 2020 19:42
Xemuth wrote on Sat, 29 August 2020 20:00

Also, GLCtrl have a strange behavior concerning context (A behavior I changed in my own GLCtrl) :

When ExecuteGL is call, in original version it do this :
void GLCtrl::GLPane::ExecuteGL(HDC hDC, Event<> paint, bool swap_buffers){
    /**** CODE ****/
    wglMakeCurrent(hDC, s_openGLContext); //Hooking the OpenGL Context
   /***** Code / Swap buffer etc .... *****/
   wglMakeCurrent(NULL, NULL); //Releasing the current OpenGL Context
}


This aquisition then releasing is problematique since it prevent you to execute some OpenGL code outside of GLPaint function.


This is needed so that you can have multiple GLCtrls in multiple windows. If you need to execute OpenGL code outside of GLPaint function, just use ExecuteGL (it is in fact inteded for that use).

Mirek


Indeed it work, thanks for the tips
Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54676 is a reply to message #54664] Mon, 31 August 2020 01:58 Go to previous messageGo to next message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
I moved my package SurfaceCtrl to GLCtrl with the fresh Glew implementation. Everythings worked fine (CLANG / MSVS) in debug mode,
however when trying the Release mode linking error occure:

The MSVS error:
https://i.imgur.com/fCRxDzv.png

The CLANG one :
https://i.imgur.com/WM8DUTv.png

Apparently this problem occure when compilation options GLEW_STATIC is not defined but in the case of plugin/glew it is actually defined so I don't know why it occure
Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54677 is a reply to message #54664] Mon, 31 August 2020 02:28 Go to previous messageGo to next message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
The linking error is fix by adding this define at the top of GLCtrl.h
#define GLEW_STATIC

Just before the glew include.

However I don't understand why it work since it is still defined as compilation option in package configuration of plugin/glew....


Update: After trying to set -D GLEW_STATIC as compiler option in GLCtrl package configuration it worked. Maybe this compiler option should be move from plugin/glew to GLCtrl

[Updated on: Mon, 31 August 2020 02:33]

Report message to a moderator

Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54682 is a reply to message #54677] Mon, 31 August 2020 22:30 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Xemuth,

It seems that Mirek push fix with GLEW_STATIC. Also OepnGL_gald can be removed from bazzar to do not produced unnecessary confusion which GLCtrl should be used. Will you remove it?

plugin/glad also seems unnecessary now. And trust me the less package to maintain the better Smile

Klugier


U++ - one framework to rule them all.

[Updated on: Mon, 31 August 2020 22:36]

Report message to a moderator

Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54684 is a reply to message #54682] Tue, 01 September 2020 02:58 Go to previous messageGo to next message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
Klugier wrote on Mon, 31 August 2020 22:30
Hello Xemuth,

It seems that Mirek push fix with GLEW_STATIC. Also OepnGL_gald can be removed from bazzar to do not produced unnecessary confusion which GLCtrl should be used. Will you remove it?

plugin/glad also seems unnecessary now. And trust me the less package to maintain the better Smile

Klugier


I agree, I will delete all glad package from bazaar

Update: all glad content has been removed

[Updated on: Tue, 01 September 2020 14:55]

Report message to a moderator

Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54698 is a reply to message #54684] Wed, 02 September 2020 01:03 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
Compilation of reference/GLDrawDemo is broken on Linux.
In file included from /home/ssg/.local/soft/bb-worker/worker/l-upp/build/uppsrc/plugin/glew/glew.c:55:
/home/ssg/.local/soft/bb-worker/worker/l-upp/build/uppsrc/plugin/glew/glxew.h:103:12: fatal error: 'GL/glew.h' file not found
#  include <GL/glew.h>
           ^~~~~~~~~~~

It was broken in
plugin/glew: updated to 2.2.0 - March 2020
git-svn-id: svn://ultimatepp.org/upp/trunk@14939 f0d560ea-af0d-0410-9eb7-867de7ffcac7

Before that everything was fine.


Regards,
Novo
Re: Updating GLEW to version 2.2.0 for 2020.2 Release [message #54699 is a reply to message #54698] Wed, 02 September 2020 01:14 Go to previous message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Novo,

Thanks for reporting. I checked this example before creating this message, however I need to have glew library installed on my system. In this case all we need to do is replace in the plugin/glew source code:
#  include <GL/glew.h>


with
#  include "glew.h"


Let's do the same for eglew.h (line 110). Mirek please apply I do not have write permission for plugins...

In case of glew static I just wonder what is the difference between passing argument like "-D GLEW_STATIC" to "-DGLEW_STATIC". I see that plugin/png uses the second notation.

Klugier


U++ - one framework to rule them all.

[Updated on: Wed, 02 September 2020 01:21]

Report message to a moderator

Previous Topic: SSH Exec output truncated
Next Topic: Changing default standard from c++14 to c++17 (2020.2 Release)
Goto Forum:
  


Current Time: Fri Mar 29 01:52:04 CET 2024

Total time taken to generate the page: 0.01582 seconds