Sunteți pe pagina 1din 27

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

Home About Advertise Make Money Sitemap Top Posts Free LinkBack Thoughts From My Life
Ads by Google Install Visual C++ 6.0 OpenGL Driver OpenGL IDE

Apr 08

OpenGL and Visual Studio Express 2008


Written by Neil Galloway I recently set up Visual C++ 2008 Express Edition and OpenGL on my Windows XP and Windows Vista computers. I had a few issues, but it is working now. I have a step by step tutorial below and also outlined some of the issues I had. This is also a guide on just setting up your development environment on Windows for OpenGL programming. If you are like me, I am starting out doing game programming and want to add OpenGL graphics. The OpenGL tutorials I am using are from NeHe's Website and here is a Visual C++ 2008 and OpenGL Guide I used.
OpenGL Graphics Engine Accelerate your 3D Development Free Evaluation Copy!
www.techsoft3d.com

SCADE Display with OpenGL Model-driven develoment for Open GL Download On-Demand Webinar
www.esterel-technologies.com

Manage Your Software Test Test Management Tool For FogBugz Simple Integration, Try It For Free
www.testuff.com

Break out of your shell NYC trading firm hiring sysadmins with functional prog. experience
janestreet.com

Getting OpenGL to Work With Visual C++ 2008


Follow each step, unless you have already done one of these steps.

1. Install Visual C++ 2008 Express Edition


This is a free C++ IDE from Microsoft that is an excellent tool to start with, if you are interested in programming on a Windows environment. You can find Visual C++ 2008 on the Visual Studio Express download page on Microsoft's site. It only works on Windows XP and up. If you have an older version of windows you might want to find Visual C++ 2005 and then use this Visual C++ 2005 and OpenGL tutorial.

2. Install Windows SDK for Windows Server 2008 and .NET Framework 3.5
This is the equivalent to the Windows Server 2003 SP1 Platform SDK that Visual C++ 2005 users installed. It contains the main OpenGL libraries. You can download the Windows SDK for Windows Server 2008 and .NET Framework from the Microsoft website. The installation will take a little while.

3. Install the GLUT Libraries


These are additional libraries that come in handy down the road. Some code samples you find may use them, so I find it best to just have them around right off the bat. GLUT itself is a bit old, but there is another one called freeglut that is a little more actively maintained. I install both of them. Download freeglut from the freeglut SourceForge page. I download the original GLUT from Nate Robins' site. For both downloads, unzip them and do the following: 1. Copy all the .h files into the C:\Program Files\Microsoft SDKs\Windows\v6.1\Include\GL folder. This should be glut.h, freeglut.h, freeglut_ext.h, and freeglut_std.h. 2. Copy all the .lib files into the C:\Program Files\Microsoft SDKs\Windows\v6.1\Lib folder. This should be freeglut.lib and glut32.lib. 3. Copy all the .dll files into the C:\Windows\system32 folder. This should be freeglut.dll and glut32.dll.

4. Create Your First Project


Create a project in Visual C++ with whatever name you like and set the template as Win32 Project. Click OK. Click Next on the following screen and you will be taken to Application Settings. Check on Empty Project and then click OK. Your new project has been created.

1 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

Declare the dependencies for your project. 1. 2. 3. 4. 5. Click on Project -> [project name] Properties. Expand Configuration Properties. In the Configuration dropdown, select All Configurations. Select Linker -> Input. In the Additional Dependencies field, enter in GlU32.Lib OpenGL32.Lib freeglut.lib glut32.lib. Then click OK.

5. Create Your First Source File


I recommend a .cpp file. I recommned downloading the source code from NeHe's Lesson 2 and copying into the file you just created. Press F7 to compile it and F5 to run it. It should be working at this point. If not, post a comment and I will try and help out.

Problems Setting Up OpenGL and Visual C++ 2008 Express Edition


Character Set Error
When I try to compile the project, I get the following error:

------ Build started: Project: Test, Configuration: Debug Win32 -----Compiling... main.cpp c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(87) : error C2664: 'Messa Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(92) : error C2664: 'Messa Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(99) : error C2664: 'Messa Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(105) : error C2664: 'Mess Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(109) : error C2664: 'Unre Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(111) : error C2664: 'Mess Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(147) : error C2440: '=' : Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(151) : error C2664: 'Mess Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(169) : error C2664: 'Mess Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(176) : error C2664: 'Mess Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(209) : error C2664: 'Crea Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(212) : error C2664: 'Mess Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(241) : error C2664: 'Mess Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(248) : error C2664: 'Mess Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(255) : error C2664: 'Mess Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(262) : error C2664: 'Mess Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(269) : error C2664: 'Mess Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(281) : error C2664: 'Mess Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(358) : error C2664: 'Mess Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Build log was saved at "file://c:\Documents and Settings\Neil Galloway\My Documents\Visual Studio 2008\Projects\Test\Test\Deb Test - 19 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This can be fixed by doing the following: 1. 2. 3. 4. 5. Project -> [projectname] Properties In the Configuration dropdown, pick All Configurations. Expand Configuration Properties. Select General. Change the Character Set to be Use Multi-Byte Character Set.

The errors should go away the next time you compile.

Can't Include glaux.h


The first time I compiled, I received the following error: ------ Build started: Project: Test, Configuration: Debug Win32 -----Compiling... main.cpp c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(12) : fatal error C1083: Cannot open

2 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

include file: 'gl\glaux.h': No such file or directory Build log was saved at "file://c:\Documents and Settings\Neil Galloway\My Documents\Visual Studio 2008\Projects\Test\Test\Debug \BuildLog.htm" Test - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== This is because the glaux.h has not been added to the include folder. You can do this if you want, but the glaux.h library is old and out dated based on most user comments on the internet. A lot of the examples, especially from NeHe, do not even use the code inside it anymore. I can usually just comment out or remove the
#include

from the code and it will be fine.

Set Up Dependencies For The Project


When the dependencies are not there, I received the following error trying to compile:

------ Build started: Project: OpenGLTest, Configuration: Debug Win32 -----Compiling... WinMain.cpp Compiling manifest to resources... Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0 Copyright (C) Microsoft Corporation. All rights reserved. Linking... WinMain.obj : error LNK2019: unresolved external symbol _gluPerspective@32 referenced in function "void __cdecl ReSizeGLScene WinMain.obj : error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function "void __cdecl ReSizeGL WinMain.obj : error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function "void __cdecl ReSizeGLSc WinMain.obj : error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function "void __cdecl ReSizeGLSce WinMain.obj : error LNK2019: unresolved external symbol __imp__glHint@8 referenced in function "int __cdecl InitGL(void)" (?I WinMain.obj : error LNK2019: unresolved external symbol __imp__glDepthFunc@4 referenced in function "int __cdecl InitGL(void) WinMain.obj : error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function "int __cdecl InitGL(void)" ( WinMain.obj : error LNK2019: unresolved external symbol __imp__glClearDepth@8 referenced in function "int __cdecl InitGL(void WinMain.obj : error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function "int __cdecl InitGL(voi WinMain.obj : error LNK2019: unresolved external symbol __imp__glShadeModel@4 referenced in function "int __cdecl InitGL(void WinMain.obj : error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function "int __cdecl DrawGLScene(void)" WinMain.obj : error LNK2019: unresolved external symbol __imp__glVertex3f@12 referenced in function "int __cdecl DrawGLScene( WinMain.obj : error LNK2019: unresolved external symbol __imp__glBegin@4 referenced in function "int __cdecl DrawGLScene(void WinMain.obj : error LNK2019: unresolved external symbol __imp__glTranslatef@12 referenced in function "int __cdecl DrawGLScen WinMain.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "int __cdecl DrawGLScene(void WinMain.obj : error LNK2019: unresolved external symbol __imp__wglDeleteContext@4 referenced in function "void __cdecl KillGL WinMain.obj : error LNK2019: unresolved external symbol __imp__wglMakeCurrent@8 referenced in function "void __cdecl KillGLWi WinMain.obj : error LNK2019: unresolved external symbol __imp__wglCreateContext@4 referenced in function "int __cdecl CreateG MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup C:\devkitPro\projects\OpenGLTest\Debug\OpenGLTest.exe : fatal error LNK1120: 19 unresolved externals Build log was saved at "file://c:\devkitPro\projects\OpenGLTest\Debug\BuildLog.htm" OpenGLTest - 20 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

To set up OpenGL dependencies for a project, refer to the declaring the dependencies section in Create You First Project section above. That should fix the problem, try recompiling now.

Change the Application Type


I have also experienced the following error when I compile:
------ Build started: Project: OpenGLTest, Configuration: Debug Win32 -----Linking... MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup C:\devkitPro\projects\OpenGLTest\Debug\OpenGLTest.exe : fatal error LNK1120: 1 unresolved externals Build log was saved at "file://c:\devkitPro\projects\OpenGLTest\Debug\BuildLog.htm" OpenGLTest - 2 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This was caused by not picking the right application type when I created the project. In this example, I chose Win32 Console Application at the startup. To change it, I did the following: 1. 2. 3. 4. 5. Click on Project -> [project name] Properties. Expand Configuration Properties. In the Configuration dropdown, select All Configurations. Select Linker -> System. Change the Subsystem field to be Windows (in the case it was Console or try the opposite if it already is Windows). Click OK.

If you enjoyed this post, then make sure you subscribe to my RSS feed or subscribe for email updates. Only one email a day and only if there was a new post.

Related Posts Win32 Application and Logging To The Console Time for NDS Homebrew Keep Text Formatting In HTML Using The pre Tag

3 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

Visual Appeal At Trade Exhibits Skin Care


Email this article

Category: Computers

91 Comments
Matt Moen Says:
2008-04-09 01:20:53

Very nice tutorial. You are a better writer than me. As long as you're using OpenGL why not go one step further and make your code portable? Instead of using Windows API look into Simple DirectMedia Layer - it provides basic cross-platform window control, sound, and input. SDL is well maintained and documented with extended libraries for working with compressed image formats, sound mixing, font rendering, network communications, and more. If you're interested, check out my latest tutorial for setting up SDL and OpenGL in Visual C++. Neil Galloway Says:
2008-04-09 08:47:39

I will check that out for sure. I am sticking with OpenGL because I am actually doing a coding project for the Nintendo DS and the libnds library has a base set of OpenGL functions to use. I find it easier to code some parts in a windows environment and then port it over to help in learning it. Christian Mathiesen Says:
2008-05-07 19:20:46

Hey dude thanks a lot man! It freaking gave me such a headache trying to figure out the multi-byte character thing! Keep up the good work! Christian daniel Says:
2008-05-13 08:30:02

thanks for putting up that information, saved me lots of time Trev Says:
2008-05-16 22:41:24

Hey- I really appreciate you taking the time to write this! Saved me time, and headache! Joshua Says:
2008-05-21 05:04:58

Thanks for your tutorial. Unfortunately, I got the following error message: ------ Build started: Project: opengltest2, Configuration: Debug Win32 -----Embedding manifest... .\Debug\opengltest2.exe.intermediate.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified. Build log was saved at "file://c:\Documents and Settings\Joshua\My Documents\Visual Studio 2008\Projects\opengltest2\Debug\BuildLog.htm" opengltest2 - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Anonymous Says:
2008-05-21 17:49:26

thanks Joe Says:


2008-06-05 03:19:22

I'm trying to get this to run on my 64bit Vista Business system. The directories are all different of course. How can I make this work? Allard Says:
2008-06-17 11:01:50

I need freeglut.dll for C# (VCS2008EE) can I use the same file as you used for C++ or where do I find the freeglut.dll file I need? Anonymous Says:
2008-06-20 05:26:31

if you can find some files on step " 3. Install the GLUT Libraries", you can download from link below http://cs.selu.edu/~soconnell/freeglut.zip Anonymous Says:
2008-06-26 11:56:12

Thanks alot, man! I was having alot of trouble with the "MessageBoxW" thing. carox Says:
2008-06-30 07:19:51

4 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

I ran th program : #include // use as needed for your system #include #include #include // *************** mylnitt) ************** void mylnit(void) { glClearColour(1.0,1.0,1.0,0.0); // set white background colour gIColour3f(0.0f,0.0f, 0.0f); // set the drawing colour gIPointSize(4.0); // One 'dot' is a 4 by 4 pixel gIMatrixMode(GL_PROJECTION); glLoadldentity(); gluOrtho2D(0.0,800.0,0.0,600.0); } // *********************** mylrisplayt) *********** void myDisplay(void) { gIClear(GL_COLOUR_BUFFER_BIT); // clear the screen gIBegin(GL_OLYGON); //Draw the polygon with the following vertex point glVertex2i(l00,100); gIVertex2i(lOO,300); gIVertex2i(400,300); gIVertex2i(600,150); glVertex2i(400,100); glEnd() ; glflush(); }// send all output to the display // ****************** main function ******************** void main(int argc, char** argv) { glutInit(&argc, argv) ; // initialise the toolkit glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB); // set display mode glutInitWindowSize(800,600); // set window size glutInitWindowPosition( I00,100); // set window position on your screen glutCreateWindow("OpenGL Window"); // Open the screen window with this name glutDisplayFunc(myDisplay); // register redraw function myInit(); glutMainLoop(); // go into a perpetual loop } But I am getting the following error: 1>------ Build started: Project: p34_filled polygon, Configuration: Debug Win32 -----1>Embedding manifest... 1>Project : error PRJ0003 : Error spawning 'mt.exe'. 1>Build log was saved at "file://c:\Program Files\Microsoft Visual Studio\My Projects\p34_filled polygon\p34_filled polygon\Debug\BuildLog.htm" 1>p34_filled polygon - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== I am not getting the possible error. Can you plz help. Regards, Carox. Joe Piechuck Says:
2008-07-01 22:34:31

Could someone please help me? I can't finish step 3. I cannot find freeglut.lib I downloaded versions 2.2 and 2.4, and I can't find it within either. dOob InaY Says:
2008-07-07 15:49:34

I did all the steps and when I build the solution for the lesson2, it tell me that plenty of functions are not in the opengl32.dll ? (compilation work) Thanks Al Fkaa Says:
2008-08-21 01:36:10

Joe Piechuck: You can find freeglut.lib here: http://users.cs.dal.ca/~sbrooks/csci3161/reference/installingForWindows.NET/index.html Krisite Says:
2008-09-05 22:31:09

Thanks for this page it has helped alot but I am still getting an error 1>Embedding manifest... 1>.\Debug\example glut.exe.intermediate.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified. 1>Build log was saved at "file://c:\Users\Kristie\Documents\Visual Studio 2008\Projects\example glut\example glut\Debug\BuildLog.htm" 1>example glut - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

5 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

What do I do !! Please help!! Anonymous Says:


2008-09-05 22:41:42

I fixed the problem above now it's saying this fatal error C1083: Cannot open include file: 'glut.h': No such file or directory 1>Build log was saved at "file://c:\Users\Kristie\Documents\Visual Studio 2008\Projects\example glut\example glut\Debug\BuildLog.htm" but it is there i put it there Toufic Says:
2008-09-07 19:32:17

Great man, thanks a lot! Joe Says:


2008-09-09 23:35:04

After spending maybe 5 hours trying to get some form of openGL going I found your page and it was the very last tip (changed from window to console) that allowed my sample program to build. Thank you, and google. Dwight Says:
2008-09-19 19:47:51

hi I have this problem. 1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup 1>C:\Users\Dwight Noel\Documents\school\Summer 2008\test\lessons\Debug\lessons.exe : fatal error LNK1120: 1 unresolved externals 1>Build log was saved at "file://c:\Users\Dwight\Documents\school\Summer 2008\test\lessons\Debug\BuildLog.htm" 1>lessons - 2 error(s), 0 warning(s) Anonymous[2] Says:
2008-10-03 15:51:46

Thanks man, ur site is excellent!!! After searching for weeks, I found ur site. It was like light through a dark tunnel Anon Says:
2008-10-06 16:05:37

Great site, man. It's helped a lot. Keep up the good work. SRH Says:
2008-10-13 18:55:22

You've got some good information here... thanks. I'm still having problems though. This is for a computer graphics class, and this is my first time using Visual C++ (I prefer C#). Anyway, I tried copying in the sample code from my professor, and I keep getting the following errors: ------ Build started: Project: CGLab, Configuration: Debug Win32 -----Compiling... triangle.cpp c:\program files\microsoft visual studio 9.0\vc\include\stdlib.h(371) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs d:\program files\microsoft sdks\windows\v6.1\include\gl\glut.h(151) : see declaration of 'exit' c:\program files\microsoft visual studio 9.0\vc\include\stdlib.h(371) : warning C4985: 'exit': attributes not present on previous declaration. d:\program files\microsoft sdks\windows\v6.1\include\gl\glut.h(151) : see declaration of 'exit' Build log was saved at "file://c:\Documents and Settings\Solomon\My Documents\Visual Studio 2008\Projects\CGLab\CGLab\Debug\BuildLog.htm" CGLab - 1 error(s), 1 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I haven't had any luck fixing this. Any help would be greatly appreciated. SRH Says:
2008-10-13 19:15:58

One more thing... I've noticed that putting #include above #include gives me completely different errors: ------ Build started: Project: CGLab, Configuration: Debug Win32 -----Compiling... triangle.cpp Linking... MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup C:\Documents and Settings\Solomon\My Documents\Visual Studio 2008\Projects\CGLab\Debug\CGLab.exe : fatal error LNK1120: 1 unresolved externals Build log was saved at "file://c:\Documents and Settings\Solomon\My Documents\Visual Studio 2008\Projects\CGLab\CGLab\Debug\BuildLog.htm" CGLab - 2 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

6 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

Not sure if that information is helpful... sen Says:


2008-10-17 20:46:48

I'm a newbie in VC++ express 2008, I started it by selecting the step below ; File --> New --> Project --> win 32 project --> enter name then ok --> welcome to win 32 application wizard --> I choose next --> check the empty project --> click finish. After that, I didn't see anything that belong to the text field, I mean only start page so that I couldn't even paste a source code in to the empty project which I've created. What should I do then ? Anonymous Says:
2008-10-17 21:00:35

This is for all guys who stuck in Gl.h, Glu.h, GLAUX.h or else. Get it free all the complete library, dll, and header files in http://www.swiftless.com. This link gave me all. For every body who wants to help me please tell me the way to start my first program. I still couldn't see anything except the start page. sen Says:
2008-10-17 21:06:35

Here it's the complete link http://www.swiftless.com/tutorials/opengl/gldrivers.html This web also contain superior guide. All tutorial is free. Please help, i can't wait for any longer. I didn't see anything that belong to the text field, I mean only start page so that I couldn't even paste a source code in to the empty project which I've created. How to make it rigth ? sen Says:
2008-10-18 21:55:18

I've already solve my first problem about adding new item (ctrl + shift + A). Now I try to test Nehe's lesson 6 project. After I copied and pasted the source code, I compiled it and got the result below; ------ Build started: Project: TugasOpenGl2, Configuration: Debug Win32 -----Compiling... Tugas2.cpp c:\program files\microsoft sdks\windows\v6.0a\include\gl\glaux.h(17) : warning C4068: unknown pragma c:\program files\microsoft sdks\windows\v6.0a\include\gl\glaux.h(374) : warning C4068: unknown pragma c:\documents and settings\satellite\my documents\visual studio 2008\projects\tugasopengl2\tugasopengl2\tugas2.cpp(41) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. c:\program files\microsoft visual studio 9.0\vc\include\stdio.h(237) : see declaration of 'fopen' Linking... Embedding manifest... Build log was saved at "file://c:\Documents and Settings\SATELLITE\My Documents\Visual Studio 2008\Projects\TugasOpenGl2\TugasOpenGl2 \Debug\BuildLog.htm" TugasOpenGl2 - 0 error(s), 3 warning(s) ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== I thought there was no problem, then I press F5 to run it. But the Error Form tell me that the "Initialization Failed" After I closed it, there were messages like this ; 'TugasOpenGl2.exe': Loaded 'C:\Documents and Settings\SATELLITE\My Documents\Visual Studio 2008\Projects\TugasOpenGl2\Debug \TugasOpenGl2.exe', Symbols loaded. 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\user32.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\glu32.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597c3456 \msvcr90d.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\imm32.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\lpk.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\usp10.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\avgrsstx.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\MSCTF.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\version.dll' 'TugasOpenGl2.exe': Unloaded 'C:\WINDOWS\system32\version.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\MSCTFIME.IME' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\ole32.dll'

7 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll' 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\iglicd32.dll', Binary was not built with debug information. 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\igldev32.dll', Binary was not built with debug information. 'TugasOpenGl2.exe': Loaded 'C:\WINDOWS\system32\mcd32.dll' 'TugasOpenGl2.exe': Unloaded 'C:\WINDOWS\system32\mcd32.dll' The program '[3920] TugasOpenGl2.exe: Native' has exited with code 0 (0x0). Please help me ! Aldo Says:
2008-10-26 00:22:22

PROBLEM: 1>MSVCRTD.lib(crtexew.obj) : error LNK2019: smbolo externo _WinMain@16 sin resolver al que se hace referencia en la funcin ___tmainCRTStartup How can I resolve it? please help! Thaks huyfamilykhmer Says:
2008-11-20 17:46:53

PROBLEM: 1>MSVCRTD.lib(crtexew.obj) : error LNK2019: smbolo externo _WinMain@16 sin resolver al que se hace referencia en la funcin ___tmainCRTStartup You have to add the following text to your project property->Configuration Properties-->Linker>Command Line: Additional options: /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup Hope this will help. Cheers. sen Says:
2008-11-21 22:16:36

Hello, it goes wrong again but I don't know where to make it right. Last time the code that should be no wrong coz I builded it successfully just stuck in type conversion. I mean no pragma use or others. It just my fault that just uses the code without make suitable type. Now I make my own project that uses bitmap. Finally, I've build it successfully and the compiled result's shown below. ------ Rebuild All started: Project: KungfuPanda, Configuration: Debug Win32 -----Deleting intermediate and output files for project 'KungfuPanda', configuration 'Debug|Win32' Compiling... PO.cpp c:\program files\microsoft sdks\windows\v6.0a\include\gl\glaux.h(17) : warning C4068: unknown pragma c:\program files\microsoft sdks\windows\v6.0a\include\gl\glaux.h(374) : warning C4068: unknown pragma c:\documents and settings\satellite\my documents\visual studio 2008\projects\vc++ project\kungfupanda\kungfupanda\po.cpp(33) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. c:\program files\microsoft visual studio 9.0\vc\include\stdio.h(237) : see declaration of 'fopen' Compiling manifest to resources... Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0 Copyright (C) Microsoft Corporation. All rights reserved. Linking... LINK : C:\Documents and Settings\SATELLITE\My Documents\Visual Studio 2008\Projects\VC++ PROJECT\KungfuPanda\Debug \KungfuPanda.exe not found or not built by the last incremental link; performing full link Embedding manifest... Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0 Copyright (C) Microsoft Corporation. All rights reserved. Build log was saved at "file://c:\Documents and Settings\SATELLITE\My Documents\Visual Studio 2008\Projects\VC++ PROJECT\KungfuPanda \KungfuPanda\Debug\BuildLog.htm" KungfuPanda - 0 error(s), 3 warning(s) ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ========== This make me very happy, coz this is my first project but something bad appear while I start debuging. It just like before, I mean while the windows form appear "would you like to run in fullscreen mode", wether I choose yes or no, it just start the appearence then disappear in seconds. Maybe in milliseconds. What cause this problem. For every one who knows this case, please tell me. How to prevent the result not to disappear while it just start running ? A comment would be a real help. Please try to compile and run the code to see what's going on. Here's the debugging log 'KungfuPanda.exe': Loaded 'C:\Documents and Settings\SATELLITE\My Documents\Visual Studio 2008\Projects\VC++ PROJECT\KungfuPanda \Debug\KungfuPanda.exe', Symbols loaded. 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\glu32.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll'

8 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\user32.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597c3456 \msvcr90d.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\imm32.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\lpk.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\usp10.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\avgrsstx.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\MSCTF.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\version.dll' 'KungfuPanda.exe': Unloaded 'C:\WINDOWS\system32\version.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\MSCTFIME.IME' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\ole32.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll' 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\iglicd32.dll', Binary was not built with debug information. 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\igldev32.dll', Binary was not built with debug information. 'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\mcd32.dll' 'KungfuPanda.exe': Unloaded 'C:\WINDOWS\system32\mcd32.dll' The program '[896] KungfuPanda.exe: Native' has exited with code 0 (0x0). This is my first project code; If I run it should be a rotating box that contain Po bitmap. #include #include #include #include #include HDC hDC=NULL; HGLRC hRC=NULL; HWND hWnd=NULL; HINSTANCE hInstance; bool keys[256]; bool active=TRUE; bool fullscreen=TRUE; GLfloat xrot; GLfloat yrot; GLfloat zrot; GLuint texture[1]; LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); AUX_RGBImageRec *LoadBMP(char *Filename) { FILE *File=NULL; if (!Filename) { return NULL; } File=fopen(Filename,"r"); if (File) { fclose(File); return auxDIBImageLoad(Filename); } return NULL; } int LoadGLTextures() { int Status=FALSE; AUX_RGBImageRec *TextureImage[1]; memset(TextureImage,0,sizeof(void *)*1);

if (TextureImage[0]=LoadBMP("Data/DragonWarrior.bmp"))

9 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

{ Status=TRUE; glGenTextures(1, &texture[0]);

glBindTexture(GL_TEXTURE_2D, texture[0]); glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); } if (TextureImage[0]) { if (TextureImage[0]->data) { free(TextureImage[0]->data); } free(TextureImage[0]); } return Status; } GLvoid ReSizeGLScene(GLsizei width, GLsizei height) { if (height==0) { height=1; } glViewport(0,0,width,height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Calculate The Aspect Ratio Of The Window gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } int InitGL(GLvoid) { if (!LoadGLTextures()) { return FALSE; } glEnable(GL_TEXTURE_2D); glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.0f, 0.5f); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); return TRUE; } int DrawGLScene(GLvoid) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(0.0f,0.0f,-5.0f); glRotatef(xrot,1.0f,0.0f,0.0f); glRotatef(yrot,0.0f,1.0f,0.0f); glRotatef(zrot,0.0f,0.0f,1.0f); glBindTexture(GL_TEXTURE_2D, texture[0]); glBegin(GL_QUADS); // muka depan

10 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); // muka belakang glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); // muka atas glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); // muka bawah glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // muka kanan glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // muka kiri glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glEnd(); xrot+=0.3f; yrot+=0.2f; zrot+=0.4f; return TRUE; } GLvoid KillGLWindow(GLvoid) { if (fullscreen) { ChangeDisplaySettings(NULL,0); ShowCursor(TRUE); } if (hRC) { if (!wglMakeCurrent(NULL,NULL)) { MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); } if (!wglDeleteContext(hRC)) { MessageBox(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); } hRC=NULL; } if (hDC && !ReleaseDC(hWnd,hDC)) { MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hDC=NULL; } if (hWnd && !DestroyWindow(hWnd)) { MessageBox(NULL,"Could Not Release hWnd.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hWnd=NULL; } if (!UnregisterClass("OpenGL",hInstance)) { MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hInstance=NULL; }

11 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag) { GLuint PixelFormat; WNDCLASS wc; DWORD dwExStyle; DWORD dwStyle; RECT WindowRect; WindowRect.left=(long)0; WindowRect.right=(long)width; WindowRect.top=(long)0; WindowRect.bottom=(long)height; fullscreen=fullscreenflag; hInstance = GetModuleHandle(NULL); wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = (WNDPROC) WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = NULL; wc.lpszMenuName = NULL; wc.lpszClassName = "OpenGL"; if (!RegisterClass(&wc)) { MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; } if (fullscreen) { DEVMODE dmScreenSettings; memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); dmScreenSettings.dmSize=sizeof(dmScreenSettings); dmScreenSettings.dmPelsWidth = width; dmScreenSettings.dmPelsHeight = height; dmScreenSettings.dmBitsPerPel = bits; dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;

if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL) { if (MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?","NeHe GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES) { fullscreen=FALSE; } else { MessageBox(NULL,"Program Will Now Close.","ERROR",MB_OK|MB_ICONSTOP); return FALSE; } } } if (fullscreen) { dwExStyle=WS_EX_APPWINDOW; dwStyle=WS_POPUP; ShowCursor(FALSE); } else { dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; dwStyle=WS_OVERLAPPEDWINDOW; }

12 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); // Create The Window if (!(hWnd=CreateWindowEx( dwExStyle, "OpenGL", title, dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, WindowRect.right-WindowRect.left, WindowRect.bottom-WindowRect.top, NULL, NULL, hInstance, NULL))) { KillGLWindow(); MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; } static PIXELFORMATDESCRIPTOR pfd= { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, bits, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, PFD_MAIN_PLANE, 0, 0, 0, 0 }; if (!(hDC=GetDC(hWnd))) { KillGLWindow(); MessageBox(NULL,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; } if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd))) { KillGLWindow(); MessageBox(NULL,"Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; } if(!SetPixelFormat(hDC,PixelFormat,&pfd)) { KillGLWindow(); MessageBox(NULL,"Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; } if (!(hRC=wglCreateContext(hDC))) { KillGLWindow(); MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; } if(!wglMakeCurrent(hDC,hRC)) { KillGLWindow(); MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);

13 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

return FALSE; } ShowWindow(hWnd,SW_SHOW); SetForegroundWindow(hWnd); SetFocus(hWnd); ReSizeGLScene(width, height); if (!InitGL()) { KillGLWindow(); MessageBox(NULL,"Initialization Failed.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; } return TRUE; } LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_ACTIVATE: { if (!HIWORD(wParam)) { active=TRUE; } else { active=FALSE; } return 0; } case WM_SYSCOMMAND: { switch (wParam) { case SC_SCREENSAVE: case SC_MONITORPOWER: return 0; } break; } case WM_CLOSE: { PostQuitMessage(0); return 0; } case WM_KEYDOWN: { keys[wParam] = TRUE; return 0; } case WM_KEYUP: { keys[wParam] = FALSE; return 0; } case WM_SIZE: { ReSizeGLScene(LOWORD(lParam),HIWORD(lParam)); return 0; } }

14 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

return DefWindowProc(hWnd,uMsg,wParam,lParam); } int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; BOOL done=FALSE;

if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO) { fullscreen=FALSE; }

if (!CreateGLWindow("NeHe's Texture Mapping Tutorial",640,480,16,fullscreen)) { return 0; } while(!done) { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { if (msg.message==WM_QUIT) { done=TRUE; } else { TranslateMessage(&msg); DispatchMessage(&msg); } } else { if ((active && !DrawGLScene()) || keys[VK_ESCAPE]) { done=TRUE; } else { SwapBuffers(hDC); } if (keys[VK_F1]) { keys[VK_F1]=FALSE; KillGLWindow(); fullscreen=!fullscreen; // Recreate Our OpenGL Window if (!CreateGLWindow("NeHe's Texture Mapping Tutorial",640,480,16,fullscreen)) { return 0; } } } } KillGLWindow(); return (msg.wParam); } sen Says:
2008-11-21 22:20:32

Hello everyone, please help me. Anon Says:


2008-12-08 01:16:29

Thank you. You are a life saver. Radu Says:


2008-12-22 05:01:13

15 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

Very important for VISTA 64Bit users: I was trying to set VStudio 2008 on Vista Business 64Bit, and whenever i tried to compile my projects i received an error telling me that glut32.dll was not found. That is because you have to copy it to windows/SysWow64 folder and not to windows/system32 folder !!! aurora Says:
2008-12-28 10:10:28

Radu or anyone else successfully working with Vista 64bit how the heck did you get around the security cookie issues? I managed to somehow get glut apps to work with Express (it was magic as it never popped up) but now that I'm using a full version on VC2008 neither my express nor my full gets around it. This is what I always run into starting from the beginning I'll follow the excellent advise above. Create a new project add my code, lets keep its simple and use the NeHe example 2 glut code. Hit F7 and everything is pretty and wonderful. Now hit F5 and this is what happens. - I get a series of Unhandled exception at 0x00018bac in gluttest.exe: 0xC0000005: Access violation. - I hit break and find myself here in gs_support.c /* * Initialize the global cookie with an unpredictable value which is * different for each module in a process. Combine a number of sources * of randomness. */ GetSystemTimeAsFileTime(&systime.ft_struct); #if defined (_WIN64) cookie = systime.ft_scalar; #else /* defined (_WIN64) */ cookie = systime.ft_struct.dwLowDateTime; cookie ^= systime.ft_struct.dwHighDateTime; #endif /* defined (_WIN64) */ - specifially on this line cookie = systime.ft_struct.dwLowDateTime; - The stack for this is > gluttest.exe!__security_init_cookie() Line 131 C gluttest.exe!mainCRTStartup() Line 398 C kernel32.dll!76d5e3f3() [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] Anyone have any clues PLEASE. I've spent eons searching the web and have found nothing that helps. Aditya Says:
2009-01-10 22:09:13

Thanks a lot !!! I went through a ton of websites but urs was the most helpful noha Says:
2009-01-24 08:42:27

hey! i did all the steps you mentioned about installing glut but it still doesn't work! it says that cannot open "gl/glaux.h" were can i find it? i didn't find the files freeglut.dll/freeglut.dll are these necessary files to add? Iman Says:
2009-01-28 19:56:57

Thanks for your article. I found it very helpful and managed to get it working after digging around for the files. Seter17 Says:
2009-02-01 16:15:09

Sen, you really sure what your's compilation write? yoou miss ")" many times! sitek Says:
2009-02-02 20:21:49

ello sir i was trying to run program as below by using visual c++ express edition 2008. i also had include all the openGL source into include, lib and bin. #include #include void init(); void RenderScene(); void main() { glutInitDisplayMode(GLUT_SINGLE\\GLUT_RGB); glutCreateWindow(\"Simple\"); init();

16 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

glutDisplayFunc(RenderScene); glutMainLoop(); } void init() { glClearColor(0.0f,0.0f,1.0f,1.0f); } void RenderScene() { glClear(GL_COLOR_BUFFER_FIT); glFlush(); } but sir i get this error and i don\'t know how to solve it...i had followed all your instruction..please help me sir...

1>------ Build started: Project: try, Configuration: Debug Win32 -----1>Compiling... 1>try.cpp 1>d:\\test\\try\\try.cpp(2) : fatal error C1083: Cannot open include file: \'GL/glut.h\': No such file or directory 1>Build log was saved at \"file://d:\\test\\try\\Debug\\BuildLog.htm\" 1>try - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Bigtallbill Says:
2009-02-12 06:24:40

Excellent work! this has got me started on openGL and C++ development! Fajar J. Ekaputra Says:
2009-02-14 05:25:43

great article.. thx a lot bro! Raj Thapa Says:


2009-02-14 13:58:39

i am getting these errors plz help me...... 1>------ Build started: Project: project 1, Configuration: Debug Win32 -----1>Compiling... 1>1.cpp 1>c:\users\raj thapa\documents\visual studio 2008\projects\project 1\project 1\1.cpp(8) : error C2006: '#include' : expected a filename, found 'newline' 1>c:\users\raj thapa\documents\visual studio 2008\projects\project 1\project 1\1.cpp(8) : fatal error C1083: Cannot open include file: '': No such file or directory 1>Build log was saved at "file://c:\Users\rAj tHaPa\Documents\Visual Studio 2008\Projects\project 1\project 1\Debug\BuildLog.htm" 1>project 1 - 2 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Delpiero Says:
2009-02-15 22:07:37

Hi i wish you can help me solve my issue i am using visual studio 2008 with opengl and i run after modifying the code using F5 but after a couple of times nothing changes my output no matter what i do to the code and it gives me the output from an old unknown build that i dont remember, and i have to close everything all over again and copy paste what iwas workin on what is the solution to that!! Piotr Robakowski Says:
2009-02-18 07:21:19

Helo everyone! I see that most of you are very gut in this topic. My problem is that I want to create a Windows Forms Application with including OpenGl, but everywere I can olny see haw to create win32 project application. I'm trying to create project using components avilable in Windows Forms in Visual Studio 2008 c++. Pleassssssse help :) Anonymous Says:
2009-02-18 11:01:23

can somebody hepl me please?? Anonymous Says:


2009-02-18 11:06:21

sorry for the previous message;

17 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

i am trying to to all those steps(in order to start to use opengl), but there is no .dll or .lib file for freeglut. and one of the codes for opengl works really good(i did not add any freeglut .h,.lib,.dll) but any other sample program codes give errors. can somebody help me please?? ace_quorthon Says:
2009-02-18 15:07:54

@DelPiero First use F7 to re-build, then F5 to run. doofus Says:


2009-02-21 18:09:51

(Compiled & linked just fine.) I have problems with it running. I get the screen up. But I can't move it anywhere, or resize it. F1 toggles between full screen and back no problem, but that's it. All worked great w/2005 express. (on an hp laptop running Vista. But like I said, when I built it w/2005 and ran it on this machine it worked perfectly.) doofus Says:
2009-02-21 18:45:55

Well, I checked and all my OpenGL apps were locking up or running horribly slow. I rebooted and now everything is working fine. I hate crap like that. Wasted a couple of hours over nothing. Student in Need of Help Says:
2009-02-25 16:42:47

I am getting this error LINK : fatal error LNK1104: cannot open file 'freeglut.lib' Can anyone please help me? vishwas Says:
2009-03-25 10:31:23

im very helpful by this tutorial.but i hav a following error.can anyone find me right. 1>Embedding manifest... 1>mt.exe : general error c10100b1: Failed to load file "..\Debug\vishwas1.exe". The system cannot find the path specified. 1>Build log was saved at "file://c:\Users\VISHWAS\Documents\Visual Studio 2008\Projects\vishwas1\vishwas1\Debug\BuildLog.htm" 1>vishwas1 - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== bharath Says:
2009-04-25 23:50:57

I needed source code for editors.. VEGETA_DTX Says:


2009-05-06 03:16:14

Hey this site ROCKS! thanx very much for this guide and really all props to you... BUT! I just have one life wish...I want to meet these SGI/Microsoft guys and to ask them just ONE thing: "HOW HAAAAARD IS IT!?!?!? HOW HAARRD IS TO PUT EVERYTHING INTO TWO INSTALLATIONS CALLED "Microsoft Visual C++ Installation" and "OpenGL for Microsoft Visual C++ installation" JUST WHAT IS STOPPING YOU FROM DOING THAT?!?!! HOW FREAKING HARD IS IT?!?!?!?!!?!?!?!" I am really sorry people but I am close to a nervous breakdown for having all these problems... First I spent whole day searching for the good tutorial ond setting up OpenGL and finally when I found this BRILLIANT site and did everything according to the instructions I had that "fatal error LNK1120: 1 unresolved externals" error and then after I just simply created a new project file, it is gone BUT then the new one came: 1>d:\programs\microsoft visual studio 2008 express edition\vc\include\stdlib.h(371) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs 1> c:\program files\microsoft sdks\windows\v6.0a\include\gl\glut.h(146) : see declaration of 'exit' 1>d:\programs\microsoft visual studio 2008 express edition\vc\include\stdlib.h(371) : warning C4985: 'exit': attributes not present on previous declaration. 1> c:\program files\microsoft sdks\windows\v6.0a\include\gl\glut.h(146) : see declaration of 'exit' 1>c:\documents and settings\vegeta\my documents\visual studio 2008\projects\strasno\strasno\strasno.cpp(79) : error C3861: 'exit': identifier not found Of course all this time I've been trying to compile that suggested NeHe source code. I would really appreciate any help! Ivan Says:
2009-05-07 04:50:45

Very nice when I use OprnGL on my laptop with Windows XP ! But if I try to run the same program under Windows Vista with NVIDIA GeForce 8600 graphic board all is OK if I work in full screen mode. If I work in window mode I get only a completely trasparent or white window. Why ? Can you help me ? Thank you.

18 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

Anup Says:
2009-05-22 13:22:18

1>------ Build started: Project: Test_vcc, Configuration: Debug Win32 -----1>Compiling... 1>Test_vcc.cpp 1>.\Test_vcc.cpp(1) : warning C4627: '#include ': skipped when looking for precompiled header use 1> Add directive to 'stdafx.h' or rebuild precompiled header 1>.\Test_vcc.cpp(2) : warning C4627: '#include ': skipped when looking for precompiled header use 1> Add directive to 'stdafx.h' or rebuild precompiled header 1>.\Test_vcc.cpp(3) : warning C4627: '#include ': skipped when looking for precompiled header use 1> Add directive to 'stdafx.h' or rebuild precompiled header 1>.\Test_vcc.cpp(9) : error C2146: syntax error : missing ';' before identifier 'v' 1>.\Test_vcc.cpp(9) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>.\Test_vcc.cpp(9) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>.\Test_vcc.cpp(9) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(9) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(9) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(10) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(10) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(10) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(11) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(11) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(11) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(12) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(12) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(12) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(14) : error C2146: syntax error : missing ';' before identifier 'colors' 1>.\Test_vcc.cpp(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>.\Test_vcc.cpp(14) : error C2086: 'int GLfloat' : redefinition 1> .\Test_vcc.cpp(9) : see declaration of 'GLfloat' 1>.\Test_vcc.cpp(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>.\Test_vcc.cpp(14) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(14) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(14) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(15) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(15) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(15) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(16) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(16) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(16) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(17) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(17) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(17) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data 1>.\Test_vcc.cpp(20) : error C2065: 'va' : undeclared identifier 1>.\Test_vcc.cpp(20) : error C2065: 'vb' : undeclared identifier 1>.\Test_vcc.cpp(20) : error C2065: 'vc' : undeclared identifier 1>.\Test_vcc.cpp(21) : error C2448: 'triangle' : function-style initializer appears to be a function definition 1>.\Test_vcc.cpp(26) : error C2065: 'a' : undeclared identifier 1>.\Test_vcc.cpp(26) : error C2065: 'b' : undeclared identifier 1>.\Test_vcc.cpp(26) : error C2065: 'c' : undeclared identifier 1>.\Test_vcc.cpp(26) : error C2065: 'd' : undeclared identifier 1>.\Test_vcc.cpp(27) : error C2448: 'tetra' : function-style initializer appears to be a function definition 1>.\Test_vcc.cpp(37) : error C2065: 'a' : undeclared identifier 1>.\Test_vcc.cpp(37) : error C2065: 'b' : undeclared identifier 1>.\Test_vcc.cpp(37) : error C2065: 'c' : undeclared identifier 1>.\Test_vcc.cpp(37) : error C2065: 'd' : undeclared identifier 1>.\Test_vcc.cpp(37) : error C2062: type 'int' unexpected 1>.\Test_vcc.cpp(38) : error C2143: syntax error : missing ';' before '{' 1>.\Test_vcc.cpp(38) : error C2447: '{' : missing function header (old-style formal list?) 1>.\Test_vcc.cpp(62) : error C2065: 'GL_COLOR_BUFFER_BIT' : undeclared identifier 1>.\Test_vcc.cpp(62) : error C2065: 'GL_DEPTH_BUFFER_BIT' : undeclared identifier 1>.\Test_vcc.cpp(62) : error C3861: 'glClear': identifier not found 1>.\Test_vcc.cpp(63) : error C3861: 'glColor3d': identifier not found 1>.\Test_vcc.cpp(64) : error C2065: 'GL_COLOR_BUFFER_BIT' : undeclared identifier 1>.\Test_vcc.cpp(64) : error C3861: 'glClear': identifier not found 1>.\Test_vcc.cpp(65) : error C2065: 'GL_TRIANGLES' : undeclared identifier 1>.\Test_vcc.cpp(65) : error C3861: 'glBegin': identifier not found 1>.\Test_vcc.cpp(66) : error C3861: 'divide_tetra': identifier not found 1>.\Test_vcc.cpp(67) : error C3861: 'glEnd': identifier not found 1>.\Test_vcc.cpp(68) : error C3861: 'glFlush': identifier not found 1>.\Test_vcc.cpp(72) : error C3861: 'glViewport': identifier not found 1>.\Test_vcc.cpp(73) : error C2065: 'GL_PROJECTION' : undeclared identifier 1>.\Test_vcc.cpp(73) : error C3861: 'glMatrixMode': identifier not found 1>.\Test_vcc.cpp(74) : error C3861: 'glLoadIdentity': identifier not found 1>.\Test_vcc.cpp(76) : error C2146: syntax error : missing ')' before identifier 'h' 1>.\Test_vcc.cpp(77) : error C2059: syntax error : ')'

19 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

1>.\Test_vcc.cpp(79) : error C2146: syntax error : missing ')' before identifier 'w' 1>.\Test_vcc.cpp(80) : error C2059: syntax error : ')' 1>.\Test_vcc.cpp(81) : error C2065: 'GL_MODELVIEW' : undeclared identifier 1>.\Test_vcc.cpp(76) : error C3861: 'glOrtho': identifier not found 1>.\Test_vcc.cpp(79) : error C3861: 'glOrtho': identifier not found 1>.\Test_vcc.cpp(81) : error C3861: 'glMatrixMode': identifier not found 1>.\Test_vcc.cpp(82) : error C3861: 'glutPostRedisplay': identifier not found 1>.\Test_vcc.cpp(87) : error C3861: 'atoi': identifier not found 1>.\Test_vcc.cpp(88) : error C3861: 'glutInit': identifier not found 1>.\Test_vcc.cpp(89) : error C2065: 'GLUT_SINGLE' : undeclared identifier 1>.\Test_vcc.cpp(89) : error C2065: 'GLUT_RGB' : undeclared identifier 1>.\Test_vcc.cpp(89) : error C2065: 'GLUT_DEPTH' : undeclared identifier 1>.\Test_vcc.cpp(89) : error C3861: 'glutInitDisplayMode': identifier not found 1>.\Test_vcc.cpp(90) : error C3861: 'glutInitWindowSize': identifier not found 1>.\Test_vcc.cpp(91) : error C3861: 'glutCreateWindow': identifier not found 1>.\Test_vcc.cpp(92) : error C3861: 'glutReshapeFunc': identifier not found 1>.\Test_vcc.cpp(93) : error C3861: 'glutDisplayFunc': identifier not found 1>.\Test_vcc.cpp(94) : error C2065: 'GL_DEPTH_TEST' : undeclared identifier 1>.\Test_vcc.cpp(94) : error C3861: 'glEnable': identifier not found 1>.\Test_vcc.cpp(95) : error C3861: 'glClearColor': identifier not found 1>.\Test_vcc.cpp(96) : error C3861: 'glutMainLoop': identifier not found 1>Build log was saved at "file://c:\Documents and Settings\Anup\My Documents\Visual Studio 2008\Projects\Test_vcc\Test_vcc\Debug \BuildLog.htm" 1>Test_vcc - 61 error(s), 27 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

i am gettig this error how to get rid of this Thankful Says:


2009-05-27 17:43:13

Wow, Thanks this helped me so much! :) nick Says:


2009-08-17 11:51:34

thanks for the help: ) Ryan Says:


2009-08-19 20:50:42

Hey I got a linker error for Glut32.lib after following the steps above. To fix it, I just put the entire absolute path to the .lib file in quotes under linker input : "C:\Program Files\Microsoft SDKs\Windows\v6.1\Lib\Glut32.lib" checksoft Says:
2009-08-28 02:48:41

really helpful.. many thanks.. eva Says:


2009-09-01 13:38:36

this is the error i got and please help me with this 1>------ Build started: Project: test1, Configuration: Debug Win32 -----1>Linking... 1>LINK : fatal error LNK1104: cannot open file 'C:\Program.obj' 1>Build log was saved at "file://c:\Users\yiwen\Desktop\CourseWork\ComputerGraphic2009Fall\Project\test1\test1\Debug\BuildLog.htm" 1>test1 - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== ARchana Says:
2009-09-10 09:27:10

Here is the error I get: PRJ0014 The job object used to control the spawned process has failed. build cannot continiue

Pleas shed some light on this Thanks, Archana abi Says:


2009-09-11 19:27:31

#include #include #include #include #include #include #include

20 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

#include using namespace std; struct Vertex { double x, y, z; double nx, ny, nz; };vector vertices; struct Face { int v1, v2, v3; }; vector faces; char type; float x, y, z, nx, ny, nz; int vid, fid, v1, v2, v3; void renderScene() { glClear(GL_COLOR_BUFFER_BIT); FILE* f; f = fopen("C:\Users\Keerthana\Documents\Visual Studio 2008\Projects\myproj\bunny.m", "r"); while ((type=fgetc(f)) != EOF) { switch (type) { case 'V': if (fscanf(f,"Vertex%d %f %f%f{normal=(%f %f %f)}\n", &vid, &x, &y, &z, &nx, &ny, &nz) == 7) { Vertex vertex; vertex.x= x; vertex.y= y; vertex.z= z; vertex.nx= nx; vertex.ny= ny; vertex.nz= nz; vertices.push_back(vertex); } break; case 'F':if (fscanf(f, "Face %d %d%d%d\n", &fid, &v1, &v2, &v3) == 4) { Face face; face.v1 = v1-1; face.v2 = v2-1; face.v3 = v3-1;// the index in M is 1-based! faces.push_back(face); } break; default:do { type=fgetc(f); } while (type != EOF && type != '\n'); break; } } fclose(f); /* glBegin(GL_QUADS); glVertex2f(0,0); glVertex2f(1,0); glVertex2f(1,1); glVertex2f(0,1); glEnd();*/ glFlush(); } void main(int argc,char **argv) { glutInit(&argc,argv); glutInitWindowPosition(100,100); glutInitWindowSize(500,500); glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_SINGLE); glutCreateWindow("My Model"); glutDisplayFunc(renderScene); glutMainLoop(); }

21 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

am getting a runtime error " Expression (stream!=NULL)" pls help Peter Says:
2009-09-14 11:11:39

Please help me,, i have this error and dont know how to slove 1>------ Build started: Project: transformation, Configuration: Debug Win32 -----1>Embedding manifest... 1>.\Debug\transformation.exe.intermediate.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified. 1>Build log was saved at "file://c:\Users\Cho Poe\Desktop\visual_exe\transformation\transformation\Debug\BuildLog.htm" 1>transformation - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== nafSadh Says:
2009-09-16 16:36:14

This blog is very nice and of real help to me. I found almost everything i tried from this blog work fine. BIJOY Says:
2009-09-22 20:16:49

Dear Neil Recently I installed Microsoft Visual C++ Express Edition 2008 Version 9.0 with all the recommended pre-requisites on my computer. I wrote C++ programs in global scope window (Notepad was not used)and successfully compiled and run them in "Start without debugging" window. But I failed to run the programms as .exe files in Microsoft Visual Studio command prompt window. Kindly help me how to do this. Thanks BIJOY MarkM Says:
2009-09-23 20:33:29

wow, just wanted to say that this was a very sweet and succinct tutorial. took me no time at all to be running opengl code. setting this up in eclipse, on the other hand, was a real headache. cheers! Michael Vogel Says:
2009-10-01 14:05:31

Thanks for posting this. This helped a lot - I needed to get openGL running for a school programming project. lmc Says:
2009-10-11 08:37:18

#include #include GLfloat ctrlpoints[4][3] = { {-4.0, -4.0, 0.0}, {-2.0, 4.0, 0.0}, {2.0, -4.0, 0.0}, {4.0, 4.0, 0.0}}; void init(void) { glClearColor(0.0, 0.0, 0.0, 0.0); glShadeModel(GL_FLAT); glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, &ctrlpoints[0][0]); glEnable(GL_MAP1_VERTEX_3); } void display(void) { int i; glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glBegin(GL_LINE_STRIP); for (i=0; i<4; i++) glEvalCoord1f((GLfloat) i/30.0); glEnd(); glFlush(); } void reshape(int w, int h) { glViewport(0, 0, (GLsizei)w, (GLsizei)h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); if (w<=h)

22 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

glOrtho(-5.0, 5.0, -5.0*(GLfloat)h/(GLfloat)w, 5.0*(GLfloat)h/(GLfloat)w, -5.0, 5.0); else glOrtho(-5.0*(GLfloat)w/(GLfloat)h, 5.0*(GLfloat)w/(GLfloat)h, -5.0, 5.0, -5.0, 5.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void keyboard(unsigned char key, int x, int y) { switch(key){ case 27: exit(0); break; } } int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow(argv[0]); init(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutMainLoop(); return 0; }

i get the error: 1>------ Build started: Project: msg387, Configuration: Debug Win32 -----1>Compiling... 1>prog3.cpp 1>c:\program files\microsoft visual studio 9.0\vc\include\stdlib.h(371) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs 1> c:\program files\microsoft sdks\windows\v6.0a\include\gl\glut.h(146) : see declaration of 'exit' 1>c:\program files\microsoft visual studio 9.0\vc\include\stdlib.h(371) : warning C4985: 'exit': attributes not present on previous declaration. 1> c:\program files\microsoft sdks\windows\v6.0a\include\gl\glut.h(146) : see declaration of 'exit' 1>c:\users\end user\documents\visual studio 2008\projects\msg387\msg387\prog3.cpp(46) : error C3861: 'exit': identifier not found 1>Build log was saved at "file://c:\Users\End User\Documents\Visual Studio 2008\Projects\msg387\msg387\Debug\BuildLog.htm" 1>msg387 - 2 error(s), 1 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

pls help... what is the problem?... thank you!=> jos Says:


2009-10-28 12:26:30

hello..thanks for the tips,but i stil have a problem i've downloaded only original glut but when trying to run my project,gives me a message saying that glut32.dll not found.. i've copied it in windows/system32 but it seems that doesn't works... can you help me? shams kitz Says:
2009-11-14 20:34:23

Thanks Niel! Step four was all i needed to make this code work: http://msdn.microsoft.com/en-us/library/dd369065(VS.85).aspx using visual studio 2008. starjumper Says:
2009-11-14 21:22:36

thank you so much... it's always painful for me to try to integrate with visual studio and your careful step-by-step description was exactly what I needed! karts Says:
2009-11-21 22:44:03

i have the following errors when i try to build my first program called test1 nothing but nehe lesson2

23 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

1>------ Build started: Project: test1, Configuration: Debug Win32 -----1>Embedding manifest... 1>.\Debug\test1.exe.intermediate.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified. 1>Build log was saved at "file://c:\Karthik\projects\test1\test1\test1\Debug\BuildLog.htm" 1>test1 - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Anastasia Says:
2009-11-28 10:03:05

THANKS!!!!!! :-) xora_kho Says:


2009-12-16 23:44:01

22>LINK : fatal error LNK1104: cannot open file 'libARvideod.lib' abhinav Says:
2009-12-22 13:25:24

All Thanks to u Amazing tutorial Anonymous Says:


2010-01-25 04:11:44

I hate you, I thought you saved me but you didn't!! sukruth Says:
2010-03-03 09:04:09

1>------ Build started: Project: s, Configuration: Debug Win32 -----1>Embedding manifest... 1>.\Debug\s.exe.intermediate.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified. 1>Build log was saved at "file://c:\Users\Sai ram\Documents\Visual Studio 2008\Projects\s\s\Debug\BuildLog.htm" 1>s - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

this is d error im gettin pls forward d soln to the mentioned mail id ill b greatfull 2 u.....im using visual studio 2008....... Anilkumar Says:
2010-04-03 07:17:33

Thanx for the tips man....But i am still gettin same error like c:\open\sddf\sddf\sds.cpp(3) : fatal error C1083: Cannot open include file: 'GL/glut.h': No such file or directory Build log was saved at "file://c:\Open\sddf\sddf\Debug\BuildLog.htm"

Cud u help me out please Frank Says:


2010-04-06 08:26:16

For those of you getting the error on the "exit" function being redefined, it's because you've been using glut.h included with glut, but you need to use the glut.h that's included in freeglut. Since glut hasn't been updated since 2001 or whatever, some of the headers for standard functions (such as exit) have changed. However, freeglut is much better maintained and is compatible with glut, so just use the glut.h included there. Shankar Says:
2010-04-08 00:56:55

Thanks...This article helps a lot to build and troubleshoot the OpenGL application Neil Hughes Says:
2010-04-18 12:53:51

Great tutorial thanks Sigh... Says:


2010-04-25 01:02:23

Thanks for this page, if only I had found it earlier! Also if you are getting the "exit" errors try moving any "#include stdlib.h" lines BEFORE your "#include GL\glut.h" line. As this page was the only reference to an eror I am getting on one of the glut demos, I thought I might ask here.. "glut general error c10100b1: Failed to load file ".\Release\sysview.exe". The system cannot find the file specified." Something to do with manifests or sum such? can't work it out, in fact cant figure out what the program is actually for. ne1? BTW Stay away from VS2010, it's a bloody pain in the bum, not finished, piece of bloated unwashed dog turd IMHO, and why O why did they move

24 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

the directories to property sheets, and 101 other little things designed to piss u off...grrr Eswar Says:
2010-05-05 00:43:02

Hey can u help me out in creating a simple project in opengl using c..?? Jim Digital Designer Says:
2010-05-16 22:59:31

glut32.h does not exist. I presume you mean glut.h (for vcpp 2005 tutorial) Salim Says:
2010-06-27 03:21:10

You are a very nice writer. I have completed all the step but an error occurred. 1>------ Build started: Project: TestGL, Configuration: Debug Win32 -----1>Compiling... 1>testgl.cpp 1>Compiling resources... 1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0 1>Copyright (C) Microsoft Corporation. All rights reserved. 1>Compiling manifest to resources... 1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0 1>Copyright (C) Microsoft Corporation. All rights reserved. 1>Linking... 1>LINK : fatal error LNK1104: cannot open file 'freeglut.lib' 1>Build log was saved at "file://g:\TestGL\TestGL\Debug\BuildLog.htm" 1>TestGL - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== seventh_god Says:
2010-07-22 22:45:29

could anyone help me to use opengl or diretcx in visual basic 2008 ? thanks seventh_god Says:
2010-07-22 22:47:07

if anyone could help me, please sent me a word at joe_coe99@yahoo.com aparna Says:
2010-08-13 10:14:41

help me to solve following error -------------------Configuration: HELLOWIN - Win32 Debug-------------------Linking... MSVCRTD.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main Debug/HELLOWIN.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. HELLOWIN.exe - 2 error(s), 0 warning(s) abey Says:
2010-08-15 01:13:26

can help me... i have a problem. Error 1 fatal error C1083: Cannot open include file: 'GL/wglext.h': No such file or directory d:\file ...\...\window_init.cpp 15 Project how to include header of GL/wglext.h in to openGL. i use microsoft visual studio 2008 thanks ..

9emini Says:
2010-08-18 21:06:37

Cheers Neil - got "NeHe's Lesson 2" to execute using VS2008 under win7 x64. No freeglut, and no win7SDK either (as it's huge and I'm impatient! Do have the directXSDK installed tho' [don't shoot me]!) I wonder if the lack of the win7SDK will come back to bite me on the bum... Add a Comment Note: Comments will be visible after they have been moderated. Name: Email: (Never made public)

25 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

Web Page: (include http:// or https://) Comment:

Verification:

Subscribe for email updates. On-line Store

Recent Articles
Awk - Error - Unterminated String Trade Your Way to Financial Freedom - Book Review Nikon D7000 Announced Measuring Your Financial Progress Pillars of the Earth and World Without End

Categories
Blogging (144) Finance (30) Investing (16) Music (3) Computers (62) General (89) Travel (67) Photography (153) NintendoDS (28) Sponsored (366)

Search Popular Articles


Collecting Aeroplan Points and their Value Collecting Air Miles and their Value Aeroplan Versus Air Miles - Comparing Them Best Nintendo DS Homebrew Connect to Your Windows XP Professional Computer Through a Router Revenue Sources for Thoughts From My Life

Archives
September 2010 (11) August 2010 (25) June 2010 (3) May 2010 (7) April 2010 (6) February 2010 (21) December 2009 (9) November 2009 (11) October 2009 (6) September 2009 (14) August 2009 (12) June 2009 (1) May 2009 (1) April 2009 (7) March 2009 (8) February 2009 (4)

26 of 27

9/27/2010 8:42 PM

OpenGL and Visual Studio Express 2008

http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studi...

January 2009 (12) December 2008 (6) November 2008 (10) October 2008 (15) September 2008 (18) August 2008 (21) July 2008 (4) June 2008 (4) May 2008 (21) April 2008 (24) March 2008 (26) February 2008 (34) January 2008 (56) December 2007 (60) November 2007 (67) October 2007 (73) September 2007 (42) August 2007 (34) July 2007 (12) June 2007 (32) May 2007 (44) April 2007 (51) March 2007 (49) February 2007 (23) January 2007 (31) December 2006 (23) November 2006 (20)

Links
Dress Me Dearly Idea Jar Sarah Vann newthink.net The BenSpark

Extra
Contact Me Login 2009 thoughtsfrommylife.com. Template design by Arcsin

27 of 27

9/27/2010 8:42 PM

S-ar putea să vă placă și