OpenGL display size.

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Tonyx97
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Sat Sep 12, 2015 20:13

OpenGL display size.

Postby Tonyx97 » Sun Sep 20, 2015 13:41

Hello guys, I realized after integrating CEGUI to my engine that I can't use fullscreen mode, when I try to use fullscreen happens this: https://gyazo.com/d8b13ab160d1beec1d82730443a9c73a and this is the normal aspect https://gyazo.com/ccaae785f7db9ee882aa68705a613a1b how can I update the CEGUI OpenGL renderer to new size? I tried with codes but I can't find the correct function. Thanks in advance.

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: OpenGL display size.

Postby YaronCT » Sun Sep 20, 2015 20:15

Well, from looking at how the CEGUI sample framework does it, this seems to be the way:

Code: Select all

CEGUI::System::getSingleton().
notifyDisplaySizeChanged(
  CEGUI::Sizef(newWindowWidth, newWindowHeight)));


Perhaps u also need to call "glViewport" with the new size, I dunno.

Tonyx97
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Sat Sep 12, 2015 20:13

Re: OpenGL display size.

Postby Tonyx97 » Sun Sep 20, 2015 20:48

It crashes when I press Fullscreen toggle key:

Code: Select all


            GUI.Initialized = false; ///DISABLE GUI RENDERING WHILE CHANGING SCREEN SIZE
            glutReshapeWindow(1920, 1080);
            GL.Perspective(1920, 1080);
            CEGUI::System::getSingleton().notifyDisplaySizeChanged(CEGUI::Sizef(1920, 1080));
            glutFullScreen();
            GUI.Initialized = true; ///ENABLE GUI RENDERING


Crash details:

Code: Select all

First-chance exception at 0x693B8C36 (nvoglv32.dll) in Classic Engine.exe: 0xC0000005: Access violation reading location 0x000016BC.

Code: Select all

>   nvoglv32.dll!693b8c36()   Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for nvoglv32.dll]   
    CEGUIBase-0.dll!77cde2e6()   Unknown
    CEGUIBase-0.dll!77ca26b1()   Unknown
    CEGUIBase-0.dll!77ca62ee()   Unknown
    CEGUIBase-0.dll!77d12f9e()   Unknown
    CEGUIBase-0.dll!77ca6142()   Unknown
    CEGUIBase-0.dll!77dbbea0()   Unknown
    CEGUIBase-0.dll!77dcee1c()   Unknown
    CEGUIBase-0.dll!77d105b4()   Unknown
    CEGUIBase-0.dll!77d115f9()   Unknown
    CEGUIBase-0.dll!77d125f7()   Unknown
    CEGUIBase-0.dll!77dbbd92()   Unknown
    CEGUIBase-0.dll!77dce619()   Unknown
    CEGUIBase-0.dll!77d203f8()   Unknown
    CEGUIBase-0.dll!77d0f690()   Unknown
    CEGUIBase-0.dll!77ca91e2()   Unknown
    CEGUIBase-0.dll!77caa814()   Unknown
    CEGUIBase-0.dll!77cb8f5e()   Unknown
    CEGUIBase-0.dll!77caa7cf()   Unknown
    CEGUIBase-0.dll!77cb0269()   Unknown
    CEGUIBase-0.dll!77cb0211()   Unknown
    CEGUIBase-0.dll!77cb19d1()   Unknown
    CEGUIBase-0.dll!77cfcc0b()   Unknown
    [External Code]   


lucebac
Just can't stay away
Just can't stay away
Posts: 193
Joined: Sat May 24, 2014 21:55

Re: OpenGL display size.

Postby lucebac » Sun Sep 20, 2015 22:17

There's no need to disable gui rendering. You can do it on-the-fly:
https://bitbucket.org/lucebac/cegui/src ... L2.cpp-285
EDIT: wrong link

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: OpenGL display size.

Postby YaronCT » Mon Sep 21, 2015 06:32

Tonyx97: The backtrace would be more helpful with file names and lines and functions names in it. Perhaps you've built cegui in "Release" configuration rather then "Debug"?

Tonyx97
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Sat Sep 12, 2015 20:13

Re: OpenGL display size.

Postby Tonyx97 » Mon Sep 21, 2015 13:54

Yes I'm using Release but is there only way to get my engine works... When I compile my project as Debug it crashes when the GLUT Windows opens. The exception it throws is

Code: Select all

First-chance exception at 0x76F4C42D in Classic Engine.exe: Microsoft C++ exception: std::length_error at memory location 0x0018DFBC.


And the callstack:

Code: Select all

    KernelBase.dll!_RaiseException@16()   Unknown
    [External Code]   
    CEGUIBase-0.dll!5f40c24d()   Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for CEGUIBase-0.dll]   
    CEGUIBase-0.dll!5f34ee87()   Unknown
    CEGUIBase-0.dll!5f347159()   Unknown
>   Classic Engine.exe!ToString(float value, std::basic_string<char,std::char_traits<char>,std::allocator<char> > type) Line 11   C++
    Classic Engine.exe!Label::CLabel(CEGUI::String text, float x, float y, float sx, float sy, Color color, CEGUI::String font, CEGUI::String horzAlign, CEGUI::String vertAlign, CEGUI::Window * parent) Line 127   C++
    Classic Engine.exe!InitGUI() Line 43   C++
    Classic Engine.exe!initGL() Line 213   C++
    Classic Engine.exe!main(int argc, char * * argv) Line 78   C++
    [External Code]   



I already tried to fix this crash but I didn't success.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: OpenGL display size.

Postby Ident » Mon Sep 21, 2015 17:45

Why are the symbols not loaded in your Debug build? You should fix this and post a proper callstack.
CrazyEddie: "I don't like GUIs"

Tonyx97
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Sat Sep 12, 2015 20:13

Re: OpenGL display size.

Postby Tonyx97 » Mon Sep 21, 2015 18:40

I think I loaded all symbols but I'm still getting errors with the crash.

Code: Select all

    KernelBase.dll!_RaiseException@16()   Unknown
    [External Code]   
>   CEGUIBase-0.dll!CEGUI::String::grow(unsigned int new_size) Line 63   C++
    CEGUIBase-0.dll!CEGUI::String::assign(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & std_str, unsigned int str_idx, unsigned int str_num) Line 1352   C++
    CEGUIBase-0.dll!CEGUI::String::String(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & std_str) Line 418   C++
    Test.exe!ToString(float value, std::basic_string<char,std::char_traits<char>,std::allocator<char> > type) Line 11   C++
    Test.exe!Label::CLabel(CEGUI::String text, float x, float y, float sx, float sy, Color color, CEGUI::String font, CEGUI::String horzAlign, CEGUI::String vertAlign, CEGUI::Window * parent) Line 127   C++
    Test.exe!InitGUI() Line 43   C++
    Test.exe!initGL() Line 213   C++
    Test.exe!main(int argc, char * * argv) Line 78   C++
    [External Code]   



Code: Select all

Unhandled exception at 0x76F4C42D in Test.exe: Microsoft C++ exception: std::length_error at memory location 0x0095D83C.


And there is another interesting thing I found 1 dll is not loading and it's this:

Code: Select all

   nvoglv32.dll   C:\Windows\SysWOW64\nvoglv32.dll   N/A   Yes   Cannot find or open the PDB file.      53   10.18.13.5560   07/08/2015 5:14   689C0000-69B91000   [6984] Test.exe      
Maybe is this the main problem? I don't know where to find pdb file for this file and it's not generated by VS.

lucebac
Just can't stay away
Just can't stay away
Posts: 193
Joined: Sat May 24, 2014 21:55

Re: OpenGL display size.

Postby lucebac » Mon Sep 21, 2015 18:52

You cannot find PDB files for any nv*.dll files since these are NVIDIA's graphic driver files.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: OpenGL display size.

Postby Ident » Mon Sep 21, 2015 18:55

Tony, look up what a pdb file is before making assertions please. We are not a C++ teaching forum so don't ask us general C++ or static/dynamic linkage related questions. Maybe someone else has the time to help you with this but the CEGUI developer team definitely does not have the resources for that, sorry.


The information you get now is quite clear. In the grow function an length related exception is thrown. Would you mind to post the exact argument you send to CEGUI::String::String from Test.exe!ToString(...) before the exception is thrown? Use the callstack to retrieve what was passed in each step. This should make it quite obvious what happened. Post all the info here.
We probably can continue from there on.
CrazyEddie: "I don't like GUIs"

Tonyx97
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Sat Sep 12, 2015 20:13

Re: OpenGL display size.

Postby Tonyx97 » Wed Sep 23, 2015 12:37

There are 2 function which maybe you want to check it out:

Code: Select all

CEGUI::String ToString(float value, string type)
{
   if (type == "float") return to_string(value);
   else if (type == "int") return to_string((int)value);
}

CEGUI::String ToHex(int value)
{
   ostringstream stream;
   stream << std::hex << value;
   if (value < 16) return "0" + stream.str();
   return stream.str();
}


When I call them is when I create 1 new GUI element like this:

Code: Select all

CEGUI::Window* GUI_t::CWindow(CEGUI::String text, float x, float y, float sx, float sy, Color color, CEGUI::String font, CEGUI::Window* parent /* NULL = Root*/)
{
   CEGUI::Window* window = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/FrameWindow", "Window_" + ToString(TWindows, "int") + "");
   if (parent != NULL)
   {
      parent->addChild(window);
      window->setPosition(CEGUI::UVector2(CEGUI::UDim(x / (parent->getSize().d_width.d_scale * 1300), 0.0f), CEGUI::UDim(y / (parent->getSize().d_height.d_scale * 900), 0.0f)));
      window->setSize(CEGUI::USize(CEGUI::UDim(sx / (parent->getSize().d_width.d_scale * 1300), 0.0f), CEGUI::UDim(sy / (parent->getSize().d_height.d_scale * 900), 0.0f)));
   }
   else
   {
      Root->addChild(window);
      window->setPosition(CEGUI::UVector2(CEGUI::UDim(x / 1300, 0.0f), CEGUI::UDim(y / 900, 0.0f)));
      window->setSize(CEGUI::USize(CEGUI::UDim(sx / 1300, 0.0f), CEGUI::UDim(sy / 900, 0.0f)));
   }
   window->setText(text);
   window->setFont(font);
   Windows[TWindows] = window;
   TWindows++;
   return window;
}



As you can see in the first line I use ToString to convert a int into string, if you check the ToString function you'll know why I use the second argument. TWindows it's a int which increases everytime I create new WINDOW. In case of ToHex, there is a example:

Code: Select all

   button->setProperty("NormalTextColour", ToHex(color.a) + ToHex(color.r) + ToHex(color.g) + ToHex(color.b));  ///ARGB

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: OpenGL display size.

Postby Ident » Wed Sep 23, 2015 12:46

Tony, I didn't ask why you do things the way you do them, I asked what the value that is passed actually is in the case of the exception so we can determine the cause of the problem. Use the debugger and the callstack to find out what value causes the issue and tell us. It should not be difficult if you have worked with Visual Studio before.
CrazyEddie: "I don't like GUIs"

Tonyx97
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Sat Sep 12, 2015 20:13

Re: OpenGL display size.

Postby Tonyx97 » Wed Sep 23, 2015 13:28

I don't use to check callstacks and similar debug stuff. The value is passed it's 0. I've fixed ToString function, now the problem is on ToHex:

Code: Select all

CEGUI::String ToHex(int value)
{
   if (value == 0) return "FAIL";
   ostringstream stream;
   stream << std::hex << value;
   if (value < 16) return "0" + stream.str();
   cout << "hex: " << stream.str() << endl;
   return stream.str();
}


I pass the value 255 which is "ff" in hex, when the function try to return "ff" it crashes.

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: OpenGL display size.

Postby YaronCT » Wed Sep 23, 2015 14:53

Tony: I don't c why the function should crash, and indeed when I try to call it with "255" it doesn't crash. I'm on Linux, though.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: OpenGL display size.

Postby Ident » Wed Sep 23, 2015 18:30

I dont know why you go all the way out of your way to conver to hex from float, if you can simply construct a CEGUI::Colour based on the float r,g,b and a value and convert it to String using PropertyHelper as done everywhere in CEGUI code and the samples.

Regarding your code: I still cannot tell what problem there is based on the information given.

You say "now the problem is on ToHex:" but you don't specify. I am losing interest in helping, you are making this a huge struggle :|
CrazyEddie: "I don't like GUIs"


Return to “Help”

Who is online

Users browsing this forum: No registered users and 17 guests