Tag Archives: include

In VS2010, the compiler cannot open the file “GL / glaux. H”: no such file or directory

 
We recently tested an example OpenGL program:
#include < GL/gl.h>
#include < GL/glaux.h>
#include “glos.h”
 
void main(void)
{
auxInitDisplayMode(AUX_SINGLE|AUX_RGBA);
,0,500,500 auxInitPosition (0);
auxInitWindow(“simple”);
 
GlClearColor (0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
GlColor3f (1.0, 0.0, 0.0);
GlRectf (0.5, 0.5, 0.5, 0.5);
 
glFlush();
_sleep(1000);
}
 
It runs normally under VC6.0, but under VS2010 there is a compilation error as follows:
1> D :\elec\mymfctest\vs2010p\openglapps\opengltest\opengltest.cpp(4): fatal error C1083: Could not open included file: “GL/glaux.h” : No such file or directory
It seems that this error can be found in versions VS2008 and above.
Only two Files can be seen in the path C:\Program Files\Microsoft SDKS \Windows\ V7.0 A\Include\gl after VS2010 installation
Gl. h and glu. H instead of glaux. H,
C:\Program Files\Microsoft Visual Studio\VC98\Include\GL
The next one has three files
H, glu. H, and glaux. H, so the relevant header files are not found in VS2010.
The glaux.lib library file is not found in the VC6.0 installation path C:\Program Files\Microsoft SDKS \Windows\ V7.0 A\ lib, but in the VS2010 installation path C:\Program Files\Microsoft SDKS \Windows\ V7.0 A\ lib.
The solution is to copy the glaux. H and glaux. Lib files from their respective folders to the path referenced by default in VS2010 if you have VC6.0 installed. It is possible that the application will also need glaux. DLL support at runtime, which can also be downloaded.

C / C + + error handling (document): unhandled exception: 0xc0000005: access violation while reading location 0x00000000

Environment: VS2005
Code:
#include “stdafx.h”// Add include {
cout< <” argc=”< < argc< < endl;
for(int i=0; i< argc; I++)
{
wcout< <” argv[0]=”< < argv[0]< < endl;
}
cin.get();
return 0;
}
br> <>>
>
Unhandled exception: 0xC0000005: Access conflict occurred while reading position 0x00000000

OpenGL program running prompt glut32.dll missing problem

Today debug OpenGl source program, compiled through, but a running tips, computer lost glut32. DLL files, not depressed, search under the Internet provide most of the practice are more, copying the file to download this file to C: \ WINDOWS \ system in 32, but did so after found that still doesn’t work, after a long afternoon, suddenly realized that may be about my new WINDOWS 7 system, but also for loading is 64 – bit, then, Try to copy this glut32.dll to your SysWOW64 folder in C:\ Windows, and it will all be OK. Here’s a special note to remind everyone who installed Windows 7 and VC ++ 6.0 to pay attention to it.
PS: When you first start to contact OpenGL, you will inevitably encounter some problems, these problems may have nothing to do with the program, just some compile environment Settings and the installation of header files, special sorting, as follows:
PS: When you first start to contact OpenGL, you will inevitably encounter some problems, these problems may have nothing to do with the program, just some compile environment Settings and the installation of header files, special sorting, as follows:
PS
(1) Copy gult32.dll, Glut. DLL to Windows system system32(if Windows 7 is a 64-bit operating system, it is in C:\ Windows SysWOW64 file)
(2) Copy gult32.lib, Glut. lib to VC lib directory
(3) Copy ULT. H to include\GL of VC

Configuring OpenGL in VS

 
VS2010
GLUT Download Address:
http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip
Glut. H – & gt; C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0 A/Include/gl
glut.dll,glut32.dll —> C:/Windows/ SYSWOW64 (Windows 7 64-bit operating system)
– & gt; C:/Windows/System32 (Windows 7 32-bit operating system)
glut.lib,glut32.lib —> C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/lib
!!!!! No!!!!! With # define macros GLUT_DISABLE_ATEXIT_HACK
So a lot of people Glut. h didn’t know where to put it, and they created a new folder, and a lot of people Glut. h said,
To search the GL folder, place Glut. h in the GL folder that contains the two files Glut. h and Glut. h.
Direct copy of the following routine compilation can be passed
Routine as follows
#include < gl/glut.h>
Void myDisplay (void)
{
glClear (GL_COLOR_BUFFER_BIT);
glRectf(-0.5f, -0.5f, 0.5f, 0.5f);
glRectf(-0.5f, -0.5f, 0.5f, 0.5f);
glFlush ();

} int main (int arg c, char * argv [])
{
glutInit (& amp; argc, argv);
glutInitDisplayMode (GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition (100, 100);
glutInitWindowSize (400, 400);
GlutCreateWindow (” First OpenGL program “);
glutDisplayFunc (& amp; myDisplay);
glutMainLoop ();
return 0;
}
VS2008
The first step is to choose a compilation environment
now the mainstream of Windows compiled environment have Visual Studio, Broland c + + Builder, Dev – c + +, etc., they are all support OpenGL.

I chose Visual Studio 2008 and VC6++ as the environments to learn OpenGL.

Second, install the GLUT toolkit

Glutters
Glutters
Glutters
Glutters
Glutters
Glutters
Glutters
Glutters

Windows GLUT download address :(size about 150K)

http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip

cannot be downloaded from the above address, please use the links below:

http://upload.programfan.com/upfile/200607311626279.zip

install GLUT for Windows:

2, Search for “gl.h” in “My Computer” and find the folder in which it is located

If it is VC++6, then Glut.h should be copied in “D:/Program Files/
MicrosoftVisualStudio/VC98/Include/GL folder “). If it’s VisualStudio2008, copy Glut.h to
X :/Program Files/Microsoft/Visual Studio 9.0/VC/include/GL X is the disk symbol that you use to install VS. If you install VC++, there is a GL file in it. Visual Studio 2008 needs to go to it yourself
Create a new one)

3, let the glut of decompression. Lib and glut32 lib on static libraries in the folder (that is, with the include side by side under the lib folder).

4, let the glut of decompression. DLL and glut32 DLL in the operating system directory under the system32 folder. (Typical location: C:/Windows/System32)

Step 3: Set up an OpenGL project

VisualStudio2008 or VC++6:

choose File – & gt; New-> The Project, and then
Select Win32 Console Application, (not Win32 Application). Select a name and press OK. Click Application Settings on the left side of the resulting dialog box, locate the Empty Project, check it, and select Finish. Then add a code file to the project, called “opengl.c”, and note that you end the file with.c.

is done, just like any other project.


include <

#include < GL/glut.h>

#pragma comment(lib, “opengl32.lib”)

#pragma comment(lib, “glu32.lib”)

#pragma comment(lib, “glut32.lib”)


rst OpenGL program

A simple OpenGL program is as follows:
(Note that if you need to compile and run, GLUT needs to be installed correctly, as described above.)

# include & lt; GL/glut.h>

void myDisplay (void)

{

glClear (GL_COLOR_BUFFER_BIT);

glRectf(-0.5f, -0.5f, 0.5f, 0.5f);
glRectf(-0.5f, -0.5f, 0.5f, 0.5f);

glFlush ();

}

int main(int argc, char *argv[])

{

glutInit (& amp; Arg c, argv);

glutInitDisplayMode (GLUT_RGB | GLUT_SINGLE);

glutInitWindowPosition (100, 100);

glutInitWindowSize (400, 400);

GlutCreateWindow (” First OpenGL program “);

glutDisplayFunc (& amp; myDisplay);

glutMainLoop ();

return 0;

}

This program draws a white rectangle in the center of a black window. Each of the statements is explained below.

First, you need to include the header file #include
; GL/glut.h> So this is the header file for GLUT.

GL/gl.h> And & lt; GL/glu.h> , but both files are automatically included in the GLUT header file and do not need to be included again.

then look at the main function.

int main(int argc, char *argv[])
int main(int argc, char *argv[]) Comrades who have not seen it, please read the book more, and then look down when you understand.

Notice that all statements in main begin with GLUT, except for the return at the end.
The functions that begin with GLUT are all functions provided by the GLUT toolkit, and the functions used are described below.

1, glutInit (GLUT) — This function must be called once before another GLUT is used. Glutinit (& Arg C, Arg V.

2, glutInitDisplayMode, set the display mode, including GLUT_RGB said using RGB color, and the matching and GLUT_INDEX (using the index color). GLUT_single means to use a single buffer, as does GLUT_DOUBLE (to use a double buffer). For more information, please Google yourself. Of course, there will be some explanations in future tutorials.

>
>
>
>
>
>
>
>

>
>
>
>

5, GlutCreateWindow, create the window based on the information set above. Parameters will be used as the title of the window. Note: The window is not immediately displayed on the screen after it is created. You need to call glutMainLoop to see the window.

6, glutDisplayFunc, set up a function, when the need for drawing, this function will be invoked. (This statement is not accurate, but the accurate statement may not be easy for beginners to understand, so say for the time being).

(This may not be obvious to beginners, but for now it is enough to know that this function displays a window and waits for the window to close before returning.)

in glutDisplayFunc function, we set up “when need drawing, please call myDisplay function”. So myDisplay function is going to be used to draw the graph. When you look at the three function calls in MyDisplay, you see that they all start with GL.
Functions that start with GL are standard OpenGL functions, and the ones we use are described below.

GL_Color_BUFFER_BIT clears the color, and glClear clears other things, but I won’t cover them here.

2, Glrectf, draw a rectangle. The four parameters represent the horizontal and vertical coordinates of the two points located on the diagonal.

3, Glflush, which ensures that previous OpenGL commands are executed immediately (rather than having them wait in the buffer). It works similarly to fflush(stdout).

 

How to use higher version of OpenGL SDK in windows?

 
 
Now OpenGL has version 3.2, Visual C ++ 2005 comes with OpenGL SDK is version 1.1, want to use the advanced version of OpenGL, go to the OpenGL official website, but that only defines the API standard, there is no implementation, I searched the Internet OpenGL2.0 SDK OpenGL3.0 SDK, but did not find the download address, finally found that is to use the extension library way.
 
Download glew (The OpenGL Extension Wrangler Library), http://glew.sourceforge.net/index.html
 
What’s inside:

├ ─ bin
│ glew32. DLL
│ glewinfo. Exe opengl support is used to view the current system of the graphics card
│ glewinfo. TXT
│ VisualInfo.exe is also used to view some graphics card situation
│ visualinfo. TXT

├ ─ the include
│ └ ─ GL
│ glew. H
│ glxew. H
│ wglew. H

└ ─ lib
Glew32. Lib
Glew32s. Lib
 
 
usage
 
 
1. First refer to the header file
#include < gl/glew.h> // must be put first
#include < gl/glut.h>
 
2. The initialization
// Glew is initialized after glutCreateWindow
GLenum err = glewInit ();
If (GLEW_OK! = err)
{
/* Problem: glewInit failed, something is seriously wrong. */
Fprintf (stderr, “Error: % s/n,” glewGetErrorString (err));
}
Fprintf (stdout, “Status: Using GLEW %s/n”, glewGetString(GLEW_VERSION));
 
 
Note: If you use a graphics card that does not support the advanced version of OpenGL functions, the operation will crash