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

Author Topic: Weird glew behaviour.  (Read 1747 times)

0 Members and 1 Guest are viewing this topic.

con

  • Newbie
  • *
  • Posts: 12
    • View Profile
Weird glew behaviour.
« on: February 06, 2014, 08:43:37 pm »
Hi all, I have managed to setup a SFML application with opengl and glew and all working fine. One thing though is very odd.

This makes the application work fine.
GLenum glewStatus = glewInit();

But this however makes the application crash.
glewInit();

Currently I am using QT Creator with mingw on windows, I think I remember by using codeblocks (couple of weeks ago) that there was not such problem.

Any ideas about what it is?

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Weird glew behaviour.
« Reply #1 on: February 06, 2014, 09:01:21 pm »
Whether you store the return value or not really shouldn't make a difference. It certainly shouldn't cause a crash.
Are you sure you are linking with the correct debug/release versions of libraries?
Does it make a difference if you build with/without optimizations?
Have you tried running the programme in a debugger? What does it say about where/why it crashes?

SLC

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Weird glew behaviour.
« Reply #2 on: February 06, 2014, 09:12:13 pm »
Happened to me to. And what I did was to download the latest version from the official site and compile it manually using the same compiler I use for SFML. I build it as a static library and made sure to define GLEW_STATIC in both the Glew project and the projects where I link to Glew. I replaced the the default libglew.a from the extlibs directory of SFML and compiled SFML again. When I linked the libraries to my project I made sure I first link to SFML's libraries and then the Glew library. Then I compiled my project again and voila, it worked :) NOTE: I was using Code::Blocks and MinGW GCC 4.8.1 and SFML was built as static. Building it as static decreased my total executable size :) If you build SFML as static, make sure to add the following libraries on your project (-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32) So that you won't get "Undefined reference.." But before you do all that make sure you have GLEW_STATIC in your project if the Glew library that you use is a static library and check to see if that helps or SFML_STATIC if you have static SFML libraries.
« Last Edit: February 06, 2014, 09:14:25 pm by SLC »

con

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Weird glew behaviour.
« Reply #3 on: February 08, 2014, 09:31:42 pm »
Thanks for the suggestions I will try them again to see how it goes.  ;)

 

anything