OpenGL in WIndows7 - opengl

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

Related

Why d3dx is deprecated?

I'm very new to DirectX, and learning it only for a week. A collection of powerful lessons I found and learn from is braynzarsoft d3d12 lessons. It's very difficult, there is a lot of information, but this is what I like.
The lessons seems to be unfinished, and I decided to search through the Internet on how to make a sphere, maybe there is ready vertices matrix, or some algorithm that will describe the sphere's vertices. I found this question, where one person says that what I am doing is actually deprecated and now I should program using the DirectX Tool Kit.
I am really confused - I am doing really well, yet all my code works perfectly, and as far as I want.
Can somebody, who has experience in DirectX programming, explain to me why what I am doing is deprecated, what I should do in general, and where I can get sphere vertices?
Currently, I wrote simple vertex and pixel shaders, initialized a d3d12 device, swap chain, command list, described vertices for a quad, and wrote a class that can add, move, rotate and scale cubes, which I do in an Update() call, before UpdatePipeline().
My try
In DirectxTK there is a function D3DXCreateSphere that has LPD3DXMESH *ppMesh and LPD3DXBUFFER *ppAdjacency interfaces as the output arguments. Perhaps, I can get vertex array I need from them. But anyway, I don’t will it be possible to combine DirectxTK code with my.
The short answer is that as part of the development effort for the Windows 8 SDK (circa 2011), the "DirectX SDK" was migrated into the Windows SDK. The DirectX libraries, headers, and tools were moved into the Windows SDK and the "DirectX SDK" was declared deprecated (i.e. the DirectX SDK June 2010 release was the last one ever made).
Microsoft moved samples online for Windows 8, so the majority of the samples in the DirectX SDK were abandoned in favor of Windows Store/UWP samples. As a personal project, I've put a bunch of the Direct3D 11 samples up on GitHub updated so they only use the Windows SDK.
A number of technologies were left behind in this migration as noted on the Microsoft Docs page.
Direct3D 9 development is considered legacy, and the primary reason for still using it was Windows XP support. The Windows 8 SDK doesn't support Windows XP development--Visual Studio 2012-2017 support Windows XP development by using the Windows 7.1A SDK. If you want to target Direct3D 9, you are basically stuck with using the legacy DirectX SDK--although some engines have enough of their own helper code that they don't really need D3DX9.
Direct3D 10 development is considered legacy. Direct3D 11 is a strict super-set of Direct3D 10, is supported by the same versions of Windows, and the Feature Level mechanism means Direct3D 11 works on more hardware than Direct3D 10 ever did. As such, the helper library D3DX10 is deprecated.
The XACT library was not carried forward. It was created primarily for Xbox 360, so it's been deprecated.
Managed DirectX 1.1 has been deprecated for ages (~2005)
See The Zombie DirectX SDK and Where is the DirectX SDK?
As for what you are supposed to use instead, I have created a number of libraries to replace what was in D3DX9/D3DX10/D3DX11. See Living Without D3DX
For DirectX 12 development, the legacy DirectX SDK never supported it. Samples are on GitHub, and otherwise you are supposed to just use the Windows 10 SDK. I have a version of DirectX Tool Kit for DirectX 12 as well on GitHub. That said, if you are new to DirectX you should really consider starting with DirectX 11.
There is such a thing as D3DX12, but it's not quite the same thing as the older D3DX11 library. D3DX11 had code for loading textures, doing BC compression, etc. and required both a header and a runtime DLL. The only way to ship that DLL with your game was to use the legacy DirectX Setup.
D3DX12 is just a header of some helper functions. There is no DLL and no REDIST. It typically gets copied into a project when you create a DirectX 12 Visual Studio template, and you can download it from GitHub. For more information on D3DX12, see this blog post.
DirectX Tool Kit for DX11 and DX12, DirectXTex, DirectXMesh, DirectXMath, and UVAtlas provide much of what D3DX9, D3DX10, and D3DX11 did but supports both DirectX 11 and DirectX 12. They are all open source, so there's no DLL or REDIST: you just build it yourself from source. They are not "drop-in" replacements, but they provide the same functionality in a more Modern C++ form. They support any C++ program written for classic "Win32" development, Universal Windows Platform (UWP) apps, or Xbox One.
Really this is the primary topic I've been covering in my blog for the past decade. Lots of details there if you want more information on what's been happening.
UPDATE: While using the open source replacements for D3DX9/D3DX10/D3DX11 are still recommended, and easy to adopt for Direct3D 11 or Direct3D 12, there are of course lots of existing tutorials and codebases that use D3DX. To support these scenarios without the messy quirks of trying to use the legacy DirectX SDK with modern Windows SDKs, you can make use of the Microsoft.DXSDK.D3DX NuGet package. Using this package, I was able to republish all of the Direct3D 9 and Direct3D 10 legacy DirectX SDK samples to GitHub.

OpenGL, freeGLut, and GLEW on Surface Pro

I am currently taking a college course in Computer Graphics and we are using Visual Studio 2012.
I am trying to get it set up to use freeGLUT and GLEW, but am currently not having any progress.
I have searched everywhere, but have not had any luck finding anything on using a Surface Pro to do this. My professor managed to get it to work on a desktop with Windows 8, but has not tried with a Surface Pro.
I currently do not have any other system to do this on or else I would use one, nor do I have the funds to purchase something else. The Surface Pro has been great for everything else so far, just not this.
UPDATE
I have had some better luck so far using GLEE and freeGLUT. I am now getting this error.
1>C:\Program Files (x86)\Windows Kits\8.0\Include\um\GL/gl.h(1157): error C2054: expected '(' to follow 'WINGDIAPI'
I included windows.h and now it is saying there are syntax errors in my gl.h
UPDATE 2
Program works now. the dll files are with the project files. I also had to reinstall Visual Studio 2012. Good news is IT WORKS! Thanks for those who showed interest and tried to help.
Like as always when it comes to OpenGL, Microsoft makes it not easy, because for some reason (we can only speculate about) they don't like OpenGL. Hence ever since Windows Vista they ship their products with no, or only limited OpenGL support.
The first step is, to go to Intel.com and download the latest OpenGL drivers for the GPU the Surface Pro uses.
This should give you proper OpenGL support, though the Intel drivers for Windows are only mediocre.

directx 9 with visual studio 2012 express

I decided to learn directx on my old laptop that has an ATI Radeon X1200 card.
Using the program GPU-Z.0.7.2 I found that my card support directx 9 /SM2.0 and has shadrers of 4 Pixel / 2 Vertex.
Using dxdiag on my windows 7 I found that directx version is directx 11. Then I downloaded visual studio 2012 express but I did not install it yet.
Since my card supports only directx 9 im going to read the book Introduction to 3D Game Programming with DirectX 9.
Now what version of the direct SDK do I have to download ? and after downloading the SDK what should I install first the SDK or visual studio 2012 express ? Is the book ok ? I mean there are other editions of the book but they supprt directx 9c , directx 10 and directx 11.
Thank u so much.
Using dxdiag on my windows 7 I found that directx version is directx
11.
This is the DirectX runtime version, not SDK version. so it does not matter which version of SDK you use to develop your program.
As others said, the installation order does not matter.
The book you mentioned is good for new starters. but I recommend you to start from the shader version, since fixed pipeline functionalities such as transforming and lighting was abandoned start from DirectX 10, they all moved to shaders, there is a shader version of that book.
there are lots of materials and resources to learn DirectX, I paste some pages for your reference.
http://www.directxtutorial.com/LessonList.aspx?listid=9
http://www.braynzarsoft.net/index.php?p=DX11Lessons
http://www.rastertek.com/tutindex.html
DirectX SDK examples are also very good choice.
You should be able to use Direct3D 11 whilst still targeting a Direct3D 9 device via the D3D_FEATURE_LEVEL enum, which you can specify in your D3D11CreateDeviceAndSwapChain.
The Microsoft DirectX SDK (June 2010) contains both DirectX 11 and DirectX 9 headers and documentation. The install order doesn't really matter (I've used the SDK in Code::Blocks before installing Visual Studio and it worked fine) since it's really just a collection of header files and debug dlls, plus a bunch of stuff to get you started.
Personally I don't use books when learning a library - I look at the documentation, which is a firsthand explanation of the material, or search up a tutorial (though you should take anything you read in a tutorial with a grain of salt). There are also several websites and videos that explain the graphics pipeline really well. I can't really comment on the book otherwise.
If you not targeting Windows XP or earlier OS, throw DirectX 9 book, forget it (same with DirectX 10 if you not targeting Vista without Service packs), and take DirectX 11 one
Luna's books are great, but, IMO, online tutorials that zdd mentioned are better. And free. But still, to write something cool, you will need to read much more than one book or one series of tutorials. Take the best parts and mix it!
You can develop with DirectX 11 API (for Windows Vista SP2 and later OSes), but still targeting DirectX 9 hardware (feature level 9.3). Shaders is a must. Love them!
When you installing Visual Studio 2012 or higher, you also get a copy of Windows SDK. Do not install standalone DirectX SDK, because it is obsolete. Since Windows 8, DirectX SDK is a part of Windows SDK. Install standalone DirectX SDK only if you really-really need that old stuff, such as D3D11X or effects framework (for Luna books).
Happy coding!

Where to get an up-to-date OpenGL32.lib?

this one drives me crazy. I've been searching for two days but cant find any answer.
I want to develop some things with OpenGL 3 (or newer) with Visual Studio 2010 / C++.
The header and libraries provided by Microsoft are way too old to support OpenGL 3, so I'm trying to find newer versions. I easily found the header file in the OpenGL registry (http://www.opengl.org/registry/) but I cant find the OpenGL32.lib anywhere. How am I supposed to link a program without it?
There isn't a newer OpenGL library for windows, and there won't be. They decided to stop at OpenGL 1.1 and even call it a legacy graphics.
However, you can use load opengl function, and that is how people get access to the latest opengl features.
You can also use GLEW library to get access to the opengl functions.

how to link OpenGL with VC++

I am developing one game where I want to add OpenGL framework with VC++ 2005 express edition. But I dont know how to add OpenGL framework with VC++. So can any one guide me for this.
Please explain me in detail.
Thanks in advance
You must link with opengl32.lib and potentially glu32.lib. The headers should already be provided with the Platform SDK (which needs to be downloaded separately, if you don't already have it).
If possible, you should consider upgrading to VS2008 Express, since it's free.
You need to have a windowing toolkit before you can use opengl. GLUT is the easiest to learn/use for begining with opengl. Here is a guide to download GLUT and how to create an opengl project.
http://www.cecs.csulb.edu/~pnguyen/Using%20OpenGL%20in%20Visual%20Studio%202005.htm
You should have all of the opengl libs and headers already so you should only need to download glut.