View Full Version : GLEW in Visual Studio 2010 C++

08-28-2012, 03:31 PM
After struggling with C# wrappers, I've decided to move to Visual C++ in Visual Studio 2010 Express. Since the stock Microsoft GL libraries only give me OpenGL 1.1, and my laptop (Dell Inspiron, 64-bit, Intel HD 3000 graphics) can handle up to 3.1, I went ahead and downloaded GLEW. However, I'm clueless as to how to install it and get it working in a Windows Forms project. I've looked a couple tutorials, notably this one (http://www.opengl.org/wiki/Tutorial:_OpenGL_3.1_The_First_Triangle_(C%2B%2B/Win)) and this one (http://openglbook.com/setting-up-opengl-glew-and-freeglut-in-visual-c/)(ignoring the parts about freeGLUT; I just want to get OpenGL 3.1 working before I try anything else). The second seems to tell me to code in C rather than C++. Both give me a bunch (thousands) of build errors. At this point I'm lost; the tutorials just go right on without saying much about errors, while google searches give generic MSDN descriptions of the error codes (for example, C4394). Is there any more straightforward way to set up GLEW for Visual Studio 2010? Also, what's the difference between glew.h, wglew.h, and glxew.h? Which do I need?

Alfonse Reinheart
08-28-2012, 04:18 PM
I'm clueless as to how to install it and get it working in a Windows Forms project

You don't. Not without a .NET tool for creating OpenGL windows like OpenTK.

Windows Forms is not accessible from C++; it's only directly accessible from a .NET CLR language like C#, VB, etc. So you can't make a Windows Forms application from C++.

If you're struggling with understanding how C or C++ work, adding issues of understanding how OpenGL works on top of that won't help. Learn C or C++ first; once you have a reasonable grasp of that (including project linking and so forth), then you can start OpenGL and graphics programming.

08-28-2012, 04:30 PM
If I can't make a Windows Forms application, does that mean I have to manually draw everything (buttons, menus, etc.) with OpenGL and set up the entire GUI myself, with event handlers and file loading and saving and everything? I can't use anything I learned from .NET programming?

On the bright side, maybe there was nothing wrong with the way I installed glew and everything, just that I'm trying to use it where it's not supposed to be used. :)

08-29-2012, 04:46 AM
You can make a pane on which you have windows buttons and sliders and such. You can also do it with OpenGL just like SoftImage and Blender do. You can look at CEGUI which is a GL based GUI system. File reading and writing is done with WinAPI such as CreateFile or the older C functions like fopen and fwrite and such. There are many ways to do it.

GLEW isn't something that you install. It is just a header file, a lib file and dll file, just like all other libraries out there. No need for an installer.