-1

I have an opengl program which runs correctly under win32 configuration, but pops up an error when configuring it with x64 in visual studio 2010.

Here are the pictures:

(1) In win32 mode:(correct) enter image description here

enter image description here

2) In X64 mode (colors are wrong, the box frame should always be red, and the cube should always be green, but...enter image description hereenter image description here

When I move the mouse, the color changed into the following: enter image description hereenter image description here

and my program has stopped working with "Windows is checking for a solution to the problem..."

But I can get a good result in win32 mode without any issues. I didn't change any codes. So it should be the configuration problem.

Some tips: (1) I put glut.dll & glut32.dll & glu32.dll & opengl32.dll & freeglut.dll to C:\Windows\SysWOW64 since my os is 64 bit.

(2) For win32 libs such as glut.lib,glut32.lib,glew32.lib,glew32s.lib,freeglut.lib and GLAUX.lib, I put into C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib. For x64 libs like glut.lib, glut64.lib, glew64.lib, freeglut.lib, I put them into C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64.(I didn't include GLAUX.lib in this directory)

Any advice?

New Tip: I got error only in x64 release mode, the x64 debug version works fine.

G_fans
  • 183
  • 1
  • 3
  • 13
  • 1
    Show the code where the crash happens. Show the stacktrace and the exact error message (look in the Windows Eventlog for additional details). – jessehouwing Dec 25 '13 at 16:04
  • "But I can get a good result in win32 mode without any issues. I didn't change any codes. So it should be the configuration problem." That conclusion does not follow. It can be a 64bit issue in your code (which I consider the most likely case). Beeing sloppy with data types usually results in such behavior when switching to a different ABI. – derhass Dec 25 '13 at 16:26
  • @derhass Thanks. I will debug it and focus on the ABI issue. – G_fans Dec 25 '13 at 17:26
  • @jessehouwing Thank you. But The problem is I didn't get any errors in debug model in x64 configurations. I got error only in x64 release mode. It's a little bit weird. – G_fans Dec 25 '13 at 17:36
  • In release mode, you can still attach a debugger. In Release mode you can still get a stacktrace. It won't be as detailed, but the compilation mode doesn't change the facts that much (except the colour of your rederings, obviously...) – jessehouwing Dec 27 '13 at 23:25

2 Answers2

1

Not really an answer (sorry), but a set of comments that doesn't fit to comment char limit.

So, advices:

  • How you suppose to debug it in release mode? Use debugger to spot where error happens. We are programmers and can't debug by pictures. We aren't going either to guess where you have a bug.
  • find what exactly changes when you switching to 64-bit mode:
    • conditional compilation? (#ifdef)
    • integer sizes? (GL expects 4 byte int, but you pass 4 byte in 32-bit and 8 byte in 64 bit?)
    • pointer size? you have heap memory issues that present, but just not showing in 32 bit mode. They showing when pointer size changes
    • data alignment?
    • ... etc etc. Too many options
  • never play with \Microsoft Visual Studio\VC\lib\ folder. Instead of moving files around, set path to your libs in Project options / Makefiles.
  • Despite of 64 number, C:\Windows\SysWOW64 stores 32-bit DLLs. Go to C:\Windows\System32 for 64-bit ones. Yeah it's confusing. ;) By the way, don't play with this folders too. Instead, put your DLLs to a directory where your executable is.
Community
  • 1
  • 1
Ivan Aksamentov - Drop
  • 12,860
  • 3
  • 34
  • 61
  • Thanks, your advices helped me a lot. I'm not a graphics programmer, just want to use opengl for visualizing my simulation data, so was really confused by this error. When I put more objects in this scene, after running for several seconds, it will crash, as you analyzed, probably it's due to the 4 byte/8 byte size issue or pointer size. Well, I will check it out. And thanks for suggesting not playing with default directories. I will follow your advice. – G_fans Dec 25 '13 at 17:13
0

I had exactly the same symptoms as you regarding x64 Release mode.

I was using Qt but calling "raw" opengl calls. I had my triangle disappear in release mode (shader wasn't loading properly) and it ended up being that i wrongly used va_args in a function call. It happened to work in all the Build configs apart from x64.

Go figure!

cgmb
  • 4,284
  • 3
  • 33
  • 60
Tom Kulaga
  • 138
  • 7