Setting up OpenGL with C++ and Visual Studio 2008 - c++

Hey I was wondering if there are any good tutorial out there on how to set this up? I have seen the NeHe tutorials from gamedev.net but some of them seem to be out dated... any clues?
thanks

NeHe may be a little old, but it's certainly not outdated. Unlike DirectX, OpenGL gets updated very seldomly. The tutorials there are still perfectly good for modern OpenGL programming. The Visual C++ code for lesson 1 should work in pretty much any non-ancient version of Visual Studio, and the code for most of the samples is available in many, many languages and platforms.

Do you have Visual Studio 2008 Professional or one of the "Express" editions? The express editions require the Windows Platform SDK because they do not come with the OpenGL header files, etc.
Also, if you're going to use GLUT, you need to download that separately. If you need more information let us know!
This is a random site I found with Google explaining how to make it work with the Express edition.
http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studio_Express_2008
Edit: I forgot to mention the obvious counterpoint of all that -- If you have the full VS2008, OpenGL just works -- no setup needed. If you need GLUT, you still have to get it separately.

I think this is a good tutorial, step by step, very clear with the paths for the libraries:
http://ins.nafsadh.com/2009/09/07/opengl-and-glut-in-c-with-ms-visual-studio-2008-msvs9/
Also check my answer to a similar question.

Related

OpenGL in WIndows7

I want to write code in OpenGL using Visual Studio 2010 . Now on opening opengl.org , I am redirected to http://user.xmission.com/~nate/glut.html ; which presumes I am using WindowsXP and Visual Studio 6 . The instructions in this page http://user.xmission.com/~nate/glut/README-win32.txt dates back to 2001 , and not in current context .
Long story short, is there any tutorial which will help me to program with OpenGL in Windows 7 using Visual Studio 2010 .
Thanks in advance for taking the time to answer my question . I am new to this , so please bear with me.
OpenGL development under Window-7 is the very same as it has been for Windows-NT 4, Windows 2k and Windows XP. All the tutorials remain valid.
You do not require a OpenGL SDK. Everything you need ships with your compiler. OpenGL is not a library, but an API implemented by the drivers. So make sure you download and install the most recent drivers directly from your GPU's vendor's homepage (don't use the drivers shipping with Windows, because those have only very limited support for OpenGL).
Since you surely want to use recent OpenGL functionality you should however get the GLEW library, which eases up the loading process for the so called "extensions" by several orders of magnitude; highly recommended. Then instead of the regular OpenGL header you include GL/glew.h and call glewInit() right after an OpenGL context has been made active.
Instead of the old, outdated, no longer maintained GLUT, you should use FreeGLUT or OpenGLUT; if using GLUT at all, because you'll hit its limitations very soon. I recommend using GLFW instead.
First of all, configure your project to link with opengl32.lib etc.:
OpenGL config in Visual Studio 2010.
Look at some NeHe tutorials http://nehe.gamedev.net/.
What about Visual Studio 2010 and Windows 7 - I don't think there is some significant differences in API with previous versions of Visual Studio and Windows (at least for simple examples).
Also look at: OpenGL API Documentation Overview

Learning C++, What's next? Also what's a recommended compiler?

I've been spending my "inbetween" time at the office looking into C++. I'm primarily a flash & web developer, also working on a bunch of flash games, but I thought it was time to have a look at some non-web-based languages and see if I could get some real games going.
I've got the hang of how typing works, arrays, outputting using cout, structs, classes and so on and so on.
I seem to have found myself stuck in terms of what I can do next. Outputting to a DOS window obviously isn't that exciting - how do I get started on doing something graphical? A square moving around on the screen, even. Simple is better in this case.
As for the compiler - I've been using devcpp by Bloodshed; is this adequate or am I missing a more common compiler somehow?
Graphics can be done using DirectX in Windows, or OpenGL on every platform. It's a whole different discussion upon which to choose.
In addition to trying to work with graphics, you could try your hand at developing GUIs. I'd give Qt a shot. Be warned though, Qt is being sold by Nokia, but it's overall a very well known and heavily used framework. Or try direct Win32 (not necessarily something I'd suggest unless you're interested). Or try WinForms (requires .NET experience, and steals from the true C++; C++/CLR is NOT the same C++ you are learning--it adds to it). If you do go the .NET route, avoid "Managed C++" examples, as they that was the first iteration of C++/CLR, and they simply redid it and vastly improved it.
Two most common compilers: gcc (Linux, Mac and Windows) and Visual Studio's for development on Windows', I always use Visual Studio (there is a free version called Visual Studio Express that is a solid product) for Windows development simply because I love the IDE.
For a compiler, my school uses g++, an excellent, free C++ compiler that is compatible with many IDEs for unix-based C++ development. If you're running a windows machine, you'll have to download cygwin (which emulates a linux shell) - you'll have to select which executables you want to download with the cygwin shell, figuring out what items you need may take a little time (basically, download useful looking things for the type of development that you want to do; g++/gcc are very important).
http://cygwin.com/install.html
When you have this, you can easily configure netbeans or eclipse (I've had better experience with netbeans) to compile and run your C++ code through cygwin.
Also, my favorite resource for learning C++ has been cplusplus.com - it has detailed tutorials of all of C/C++'s standard functions.
Hope this helps a little!
Have a look at graphics and windowing libraries. For windowing, as you seem to be on Windows, there's builtin stuff. For more general applicability I suggest having a look at Qt or Gtk.
For graphics, the fancy stuff is usually done in either DirectX (basically Windows only) or OpenGL (more portable).
Compilers: GCC is commonly used in the Unix/Linux world and also available on Windows through Cygwin. In the Windows world you'll also find Microsoft's MSVCC as it comes with their development tools. Btw., there are free dev tools from Microsoft as well, see their Visual Studio Express Editions.
Some tips:
Work through one or more good books. I recommend "Accelerated C++" and "Effective C++". These books will teach you real C++ programming.
If you're on Windows then I think you're better off using Visual Studio. The learning curve for C++ is steep enough already. If you simultaneously need to learn how to work with gcc and makefiles then you are likely to become overwhelmed.
Windows specific: for simple graphics I find WinAPI and GDI+ useful. They are relatively easy to learn and they are immediately available.

Visual packages in c++ for windows (i know i shouldn't use windows =( )

I use visual studio in several of my programming classes for c++, but after extensive searching on line i can't seem to find any decent graphics packages that are compatible with the software. i would hate to need to go out and buy Linux (Gnuplot is amazing i know) and this issue is frustrating. Any feedback would be greatly appreciated. Thanks.
Imagemagick works on Windows, but I am not sure if that is what you are looking for. http://www.imagemagick.org/script/index.php
Graphics can mean a lot of different things. Visual Studio has an addon for business graphics.
http://www.microsoft.com/downloads/details.aspx?familyid=1D69CE13-E1E5-4315-825C-F14D33A303E9&displaylang=en
You can use gnuplot windows just as easily - it also has a c++ interface

Which IDE should I use for this art project?

I have an art project that will require processing a live video feed to use as the basis of a particle system, which will be rendered using OpenGL and projected on a stage. I have a CUDA enabled graphics card, and I was thinking it would be nice to be able to use that for the image and particle system processing. This project only needs to run on my computer.
I am normally a C# asp.net Visual Studio kinda guy, but for this project I plan on using c++. Should I do the work in Eclipse on Ubuntu or Visual Studio in Windows?
I realize this can be fairly arbitrary, but I wondering if one IDE/OS might be better suited for this kind of work than the other
Are you aware of OpenFrameworks? This might just help shortcut to what you need.
As far as the CUDA or OpenGL support is concerned you are fine with either of them. The nVidia examples are also multiplatform.
The real question is if you plan on using any GUI Toolkit as there are a only a few choices that are really portable.
In the end I'd recommend going with what you feel more comfortable with or where you will have the biggest knowledge gain (if learning something is a goal of the project.).
+1 for Visual Studio.
I haven't heard about any IDE especially good for such tasks.
If you already know VS, I see no reason to learn anything else.
While the CUDA toolkit is cross-platform, i recommend Linux in this case:
The debugger is based on gdb and the usability of the gcc toolchain is just much better on *nixes. You also don't seem to have any windows specific dependencies.
Since you're already familiar with Visual Studio you should probably stick with it. In addition, you'll be able to use the Nexus debugger to debug both the OpenGL and CUDA components.

Challenge working with Visual Studio and VC++?

I have started working with C++ recently and am not comfortable with Visual Studio Development Environment and also I do not have proper understanding of MFC, Win32, ATL, COM Terminologies.
From example point of view, I had taken a simple C++ program to see how it works with Visual Studio Environment and I was having some issues to get that code up and running.
I would like to request if someone could point me to some online resources/books where I can get more understanding about Visual Studio Development Environment from C++ perspective and get some knowledge about MFC, Win32, ATL, COM Terminologies than it would be really very helpful to me.
Note: I have checked MSDN library and some related Microsoft sites but when I see HOW DO I kind of video tutorials they are more from .Net/C#/ASP.Net perspective but I am looking for some online resource for C++/VC++ perspective.
www.stackoverflow.com of course will have plenty of resources around if you look # the right tags
https://stackoverflow.com/questions/tagged/mfc
https://stackoverflow.com/questions/tagged/com
etc.
The Code Project is also a good resource for windows / C++ programming, here are a couple areas to start looking #:
http://www.codeproject.com/KB/MFC/
http://www.codeproject.com/KB/atl/
http://www.codeproject.com/KB/COM/comintro.aspx (via Andy in comments)
The classic book about Win32 is presumably Petzold's. Petzold's book is I think (I've never read it) mostly about GUI programming; whereas the other classic/recommended Win32 book, which is Richter's, is about 'system' (non-GUI) programming.
For learning COM, perhaps Essential COM? Some reviewers praise it, but some others reviews say things like "not for beginners"; but it's how I learned COM, and I found it thorough, low-level, and detailed. It assumes you know C++ (not COM) already.
IMO you don't need books about MFC if you already know C++ and the Win32 API, in which case the reference libraries are sufficient. Alternatively, some people recommend an MFC book like Prosise's.
I learned using Visual Studio IDE and MFC using the Scribble Tutorial. It was a step-by-step tutorial creating a simple MFC application. Unfortunately the tutorial was written for Visual Studio 6.0, and in the meantime almost all wizards and menus changed, so it's not applicable anymore.
The tutorial can be found in MSDN, here, though:
http://msdn.microsoft.com/en-us/library/aa716528(VS.60).aspx
The scribble sample source for Visual Studio 2008 can be found here:
http://msdn.microsoft.com/en-us/library/f35t8fts.aspx
Don't bother learning ATL, WTL, MFC or COM for now (or at all, really). Just use standard C++ for starters. If you want to write GUI programs, I recommend Qt, it is much easier and fun to use than any of the former APIs.
If you have trouble compiling Qt for Visual C++ you can download the entire Qt SDK and it comes with a C++ IDE called Qt Creator. It uses MinGW as a backend.