Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Anasky

Pages: [1] 2
1
General / Re: Upgrading from 2.3.2 to 2.4.2, crashes on glewInit
« on: March 08, 2018, 06:36:18 pm »
m_Window is a pointer member variable ;) I made it a pointer to prevent that from happening. Meaning it won't be done beforehand.

Some googling revealed that glew requires OpenGL to be initialised beforehand. As far as I'm aware, SFML does this already meaning I shouldn't be doing it manually? However, if I'd do this before the new sf::Window(); call, it would be before the OpenGL init right?

2
General / Re: Upgrading from 2.3.2 to 2.4.2, crashes on glewInit
« on: March 08, 2018, 02:37:30 pm »
Moving this part of the code to the top of the function still gives the same error though..
Code: [Select]
glewExperimental = GL_TRUE;
GLenum init = glewInit( );
if (init != GLEW_OK)
{
throw std::runtime_error( std::string( "glewInit failed" ) + (const char*) glewGetErrorString( init ) );
}
if (!glewIsSupported( "GL_VERSION_1_5" ) && !glewIsSupported( "GL_ARB_vertex_buffer_object" ))
{
throw std::runtime_error( "ARB_vertex_buffer_object not supported!" );
}
clsOpenGL::CheckOGLerror( );

Correction: Moving it to the top of the main function doesn't work either. If I do that with 2.3.2, it also doesn't work.

3
General / Upgrading from 2.3.2 to 2.4.2, crashes on glewInit
« on: March 08, 2018, 02:12:29 pm »
Hey all,

I'm currently trying to upgrade from 2.3.2 to 2.4.2, but when I change the static libs of 2.3.2 to the static libs of 2.4.2 and run the application, my code crashes on glewInit returning GLEW_ERROR_NO_GL_VERSION.
I haven't changed any code from the working 2.3 version to the crashing 2.4 version, so I'm assuming it's because of something internally being different.

The code for my init function is below, any help would be greatly appreciated!~
Anasky

Code: [Select]
void clsOpenGLDataHelper::Init( )
{
// Initialize window, ~OpenGL deletes it
m_WindowMode = sf::VideoMode( m_ScreenWidth, m_ScreenHeight );
m_ContextSettings = sf::ContextSettings( 24U, 8U, 4U, 4U, 6U, sf::ContextSettings::Attribute::Default );
m_Style = sf::Style::None;
m_Window = new sf::Window( );
m_Window->setVerticalSyncEnabled( true );
m_Window->create( m_WindowMode, "Client", m_Style, m_ContextSettings );
m_Window->setPosition( sf::Vector2i( ( m_ScreenWidth - m_WindowMode.width ) / 2, ( m_ScreenHeight - m_WindowMode.height ) / 2 ) );
m_Window->setActive( true );
OpenGL.Resize( );
clsOpenGL::CheckOGLerror( );
m_WindowHandle = m_Window->getSystemHandle( );

glewExperimental = GL_TRUE;
GLenum init = glewInit( );
if (init != GLEW_OK)
{
throw std::runtime_error( std::string( "glewInit failed" ) + (const char*) glewGetErrorString( init ) );
}
if (!glewIsSupported( "GL_VERSION_1_5" ) && !glewIsSupported( "GL_ARB_vertex_buffer_object" ))
{
throw std::runtime_error( "ARB_vertex_buffer_object not supported!" );
}
clsOpenGL::CheckOGLerror( );
}

4
Window / Re: Borderless Windowed Fullscreen
« on: October 04, 2017, 03:49:54 pm »
I'm guessing it's an internal error in my update loop which only triggers during fullscreen mode.
The flickering is an indicator to me that it's going fullscreen (or at the very least, isn't staying a window. This seems to be verified by the fact that it doesn't do this if I change the resolution to anything other than 1920x1080).

My GPU is: AMD Radeon R7 M370

5
Window / Re: Borderless Windowed Fullscreen
« on: October 04, 2017, 03:39:03 pm »
The screen flickers when the application starts up, and you can't go back to the screen like you normally could when it's windowed.

6
Window / Borderless Windowed Fullscreen
« on: October 04, 2017, 01:39:23 pm »
Heya all,

I managed to get a borderless window up and running, but the application turns into Fullscreen mode when creating it rather than the intended fullscreen windowed.. How can I set it up so that it becomes fullscreen windowed? I'm on Windows 7, if that matters.

The window is made using the following code:
Code: [Select]
m_ScreenWidth = 1920;
m_ScreenHeight = 1080;
m_WindowMode = sf::VideoMode( m_ScreenWidth, m_ScreenHeight );
m_Title = "Brawler";
m_ContextSettings = sf::ContextSettings( 24U, 8U, 4U, 4U, 0U, sf::ContextSettings::Attribute::Default );
m_Style = sf::Style::None;
m_Window = new sf::Window( );
m_Window->setVerticalSyncEnabled( true );
m_Window->create( m_WindowMode, m_Title, m_Style, m_ContextSettings );
m_Window->setPosition( sf::Vector2i( ( m_ScreenWidth - m_WindowMode.width ) / 2, ( m_ScreenHeight - m_WindowMode.height ) / 2 ) );
m_Window->setActive( true );
Resize( );
clsOpenGL::CheckOGLerror( );
m_WindowHandle = m_Window->getSystemHandle( );

7
Window / Re: delete sf::Window
« on: May 02, 2016, 05:12:37 pm »
When will it be destroyed?

The other SFML objects inside that class will be created as globals, including your map of shaders.

My shader class contains no SFML objects, only GLuint, ints, strings, and ints.
It'll be destroyed at the end of the application, when clsOpenGL's destructor is called, at which point 'delete Window;' is executed, and crashes.

EDIT: Found the issue. I moved the delete function to somewhere inside my own code (instead of the destructor of a global class), and it works.
Thanks hapax :)

8
Window / Re: delete sf::Window
« on: May 02, 2016, 04:49:44 pm »
Don't construct SFML resources at global scope.

Which is why it's a pointer. That way it'll be constructed inside int main(), at the call of Window = new sf::Window();

9
Window / Re: delete sf::Window
« on: May 02, 2016, 04:10:00 pm »
As for creating the OpenGL instance, I haven't even reached that point yet. So far, I'm only trying to create and destroy a window.
By OpenGL instance, I mean the OpenGL instance of your clsOpenGL object - the one on which you call Init.

My bad. It's a global instance.
Header:
extern OpenGLNamespace::clsOpenGL OpenGL;
CPP:
OpenGLNamespace::clsOpenGL OpenGL;

Its constructor only states:
        clsOpenGL::clsOpenGL()
        {
                Window = 0;
        }

10
Window / Re: delete sf::Window
« on: May 02, 2016, 02:54:51 pm »
I must say, I look like a real fool now, lol.
Here is the call stack (crashes on ~Window(void)):
Code: [Select]
> msvcp140d.dll!std::_Debug_message(const wchar_t * message, const wchar_t * file, unsigned int line) Line 17 C++
  BrawlerEngine.exe!std::_Tree_const_iterator<class std::_Tree_val<struct std::_Tree_simple_types<class sf::priv::GlContext *> > >::operator*(void) Unknown
  BrawlerEngine.exe!sf::priv::GlContext::globalCleanup(void) Unknown
  BrawlerEngine.exe!sf::GlResource::~GlResource(void) Unknown
  BrawlerEngine.exe!sf::Window::~Window(void) Unknown
  BrawlerEngine.exe!sf::Window::`vector deleting destructor'(unsigned int) Unknown
  BrawlerEngine.exe!OpenGLNamespace::clsOpenGL::~clsOpenGL() Line 14 C++
  BrawlerEngine.exe!`dynamic atexit destructor for 'OpenGL''() C++
  ucrtbased.dll!__crt_scoped_stack_ptr<char>::__crt_scoped_stack_ptr<char>(struct __crt_scoped_stack_ptr_tag<char>) Unknown
  ucrtbased.dll!__crt_seh_guarded_call<int>::operator()<class <lambda_d22e02de4d14401f49897516b29a2b7c>,class <lambda_e971338317bfa523bb8920b43d823727> &,class <lambda_b0b8599c9027f5b14541fbbd6863d1f1> >(class <lambda_d22e02de4d14401f49897516b29a2b7c> &&,class <lambda_e971338317bfa523bb8920b43d823727> &,class <lambda_b0b8599c9027f5b14541fbbd6863d1f1> &&) Unknown
  ucrtbased.dll!__acrt_lock_and_call<class <lambda_e971338317bfa523bb8920b43d823727> >(enum __acrt_lock_id,class <lambda_e971338317bfa523bb8920b43d823727> &&) Unknown
  ucrtbased.dll!_execute_onexit_table() Unknown
  ucrtbased.dll!__crt_hmodule_traits::close(struct HINSTANCE__ *) Unknown
  ucrtbased.dll!exit() Unknown
  BrawlerEngine.exe!__scrt_common_main_seh() Line 266 C++
  BrawlerEngine.exe!__scrt_common_main() Line 300 C++
  BrawlerEngine.exe!mainCRTStartup() Line 17 C++
  kernel32.dll!BaseThreadInitThunk() Unknown
  ntdll.dll!RtlUserThreadStart() Unknown

If it's still not complete, I'm not sure what else to add. This is all the code that is being called, and the stacktrace is above.

As for creating the OpenGL instance, I haven't even reached that point yet. So far, I'm only trying to create and destroy a window.

11
Window / Re: delete sf::Window
« on: May 02, 2016, 02:02:11 pm »
Sure. Didn't wanna pollute the post with unnecessary data, but apparently I left out critical information.

My class:
Quote
namespace OpenGLNamespace
{
   class clsOpenGL
   {
   public:
      clsOpenGL();
      ~clsOpenGL();
      void Init(int ScreenWidth, int ScreenHeight, std::string Filepath);
      void LoadResources();
      void Resize();
      static void CheckOGLerror();
   public:
      std::string                        Filepath;
      sf::Window*                        Window;
   public:
      int                              m_ScreenWidth;
      int                              m_ScreenHeight;
      std::string                        m_ShaderPath;
      sf::VideoMode                     m_WindowMode;
      std::string                        m_Title;
      sf::ContextSettings                  m_ContextSettings;
      sf::Uint32                        m_Style;
      sf::WindowHandle                  m_WindowHandle;
      std::map<std::string, clsShader*>      m_Shaders;
      RECT                           m_WindowBorder;
      clsCamera*                        m_Camera;
   };
};

Its Init function:
Quote
void clsOpenGL::Init(int a_ScreenWidth, int a_ScreenHeight, std::string a_Filepath)
   {
      m_ScreenWidth = a_ScreenWidth;
      m_ScreenHeight = a_ScreenHeight;
      Filepath = a_Filepath;
      // Initialize window, ~OpenGL deletes it
      m_WindowMode = sf::VideoMode(1024, 768);
      m_Title = "Brawler";
      m_ContextSettings = sf::ContextSettings(24U, 8U, 4U, 3U, 1U, 0U);
      m_Style = sf::Style::None;
      m_Style |= sf::Style::Titlebar;
      m_Style |= sf::Style::Resize;
      m_Style |= sf::Style::Close;
      //m_Style |= sf::Style::Fullscreen;
      Window = new sf::Window();
   }

Its destructor:
Quote
   clsOpenGL::~clsOpenGL()
   {
      delete Window;
   }

And the int main function:
Quote
int main(int argc, char *argv[])
{
   // OpenGL
   OpenGL.Init(Main.m_ScreenResolutionWidth, Main.m_ScreenResolutionHeight, Main.Filepath);

   // Clean up
   return 0;
}

The only map I can see is the m_Shaders, which isn't even being used in the current code.
Hopefully this is enough information to help out :)

Thanks in advance,
Anasky

12
Window / delete sf::Window
« on: May 02, 2016, 02:37:13 am »
Hey all,

For memory purposes I am trying to delete the sf::Window variable I have. However, when I try to do so, I get the following error:

Quote
Debug Assertion Failed!

Program: C:\Windows\system32\MSVCP140D.dll
File: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xtree
Line: 237

Expression: map/set iterator not dereferencable

The code I use is the following:

Quote
int main(int argc, char *argv[]){
m_WindowMode = sf::VideoMode(1024, 768);
m_Title = "Brawler";
m_ContextSettings = sf::ContextSettings(24U, 8U, 4U, 3U, 1U, 0U);
m_Style = sf::Style::None;
m_Style |= sf::Style::Titlebar;
m_Style |= sf::Style::Resize;
m_Style |= sf::Style::Close;
//m_Style |= sf::Style::Fullscreen;
Window = new sf::Window();

delete Window;
return 0;
}

Does anyone happen to know why this is happening, and if there is a solution to it?

Thanks in advance,
Anasky

13
Graphics / Re: Loading in small graphics
« on: December 21, 2014, 01:51:12 pm »
I did step through it, and found that the loadFromFile function is executed, but the values stay 0 (even though they are in fact loaded). This is only the case for textures < 128 pixels height though.

And some computers start programs with \ in the path rather than /. I'm checking on both just to be sure.

14
System / Re: Keyboard input
« on: December 21, 2014, 01:49:30 pm »
Quote
} else if (event.type == sf::Event::TextEntered){
            unsigned char t = event.key.code;
            KeyDown(event.text.unicode);
         } else if (event.type == sf::Event::KeyPressed){
            unsigned int keycode = event.key.code;
            if (keycode == 88){
               if (sf::Keyboard::isKeyPressed(sf::Keyboard::LAlt) || sf::Keyboard::isKeyPressed(sf::Keyboard::RAlt)){
                  Main.StopLooping = true;
                  running = false;
               }
            }
            if (keycode == 27 || keycode == 49 || keycode == 52 || keycode == 57 || (keycode >= 71 && keycode <= 74)){
               SpecialKeyDown(event.key.code);
            }

Yeah, I know :) But as you can see, I have to check for specific keycodes in the KeyPressed for ! etc, but I know that won't work on different keyboards :(

15
Graphics / Re: Loading in small graphics
« on: December 20, 2014, 02:07:33 pm »
I managed to fix it by supplying a Width and Height. This'd mean that the getSize is bugging out, as the image is in fact loading (didn't figure that out until after it stopped trying to divide by Height (= 0)). And no, sorry, I can't really provide an empty environment :(

Anyhow, the issue's solved personally, although it's still a weird workaround.

Pages: [1] 2
anything