Category Archives: How to Fix

The first day of OpenGL [vs2017 + OpenGL environment configuration]

The OpenGL environment has been configured several times without success.
Today, I finally tried it, so I shared it, so that others can avoid detours.
My tool is VS2017
1. Method (download various library files)
Download the required files for OpenGL
http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip
Then you get five files:
Glut.dll Glut.dll Glut.Lib Glut.h
Find the directory.. \VC\Tools\MSVC\14.10.25017\include\gl So let’s put Glut.H in there.
 

Find the directory.. \VC\Tools\MSVC\14.10.25017\lib\x86 Glut. lib, Glut32.lib

Finally, the
Glut. DLL and glut32.dll go in

C: \ Windows \ system32 folder (32-bit system) or ‪ C: \ Windows \ SysWOW64 (64 – bit systems).

 
2. Methods (using VS plug-ins)
Open VS and create a C++ project (Win32 Console – Blank Project)
Then click Project – Manage the NuGet package
Then click Browse – type Nupengl in the search bar
Then install (two if you have two)
——————————————————
One final test:
 

(plain)
The view plain
copy

 

The

    # include & lt; GL/glut.h> Void the Show () {glClear (GL_COLOR_BUFFER_BIT); GlRectf (0.5-0.1 f to 0.1 f, f, 0.5 f); GlFlush (); } int main (int arg c, char * argv []) {glutInit (& amp; Arg c, argv); GlutInitDisplayMode (GLUT_RGB | GLUT_SINGLE); GlutInitWindowPosition (100, 100); GlutInitWindowSize (400, 400); OpenGL glutCreateWindow (” “); GlutDisplayFunc (Show); GlutMainLoop (); Return 0; }

     
    Run it and you’ll see a white square

    If there are no errors, the configuration is successful!
    (if you try and succeed, remember thumb up ah )

(64 bit) OpenGL configuration + vs2017 + glew + glfw

Note: **** native OpenGL version must be higher than Glew library version
native OpenGL version

enGL version string: 4.5.0 – Build 25.20.100.6323
<>>

OpenGL version string: 4.5.0 – Build 25.20.100.6323

OpenGL version string: 4.5.0 – Build 25.20.100.6323
Download:
1. glew:http://glew.sourceforge.net/ find corresponding native OpenGL version of glew
2. GLFW: glfw.org click on the top right corner of the download
3. VS2017:https://visualstudio.microsoft.com/zh-hans/vs/
Glew:
: glew
: glew
: glew
: glew
: glew
: glew
: glew
: glew
: glew
: glew
: glew
: glew
: glew
Select VC10 (or V12 or later) in the Build folder to open the glew.sln solution.
2. You will be prompted to upgrade Glew projects created by a lower version of VS. Click “OK” to upgrade the VC++ compiler and libraries to support compilation of VS 2017.


br>

include\GL

5, Return to glew-1.10.0 root and copy glew32.lib from “lib\Release\Win32” to “lib\x86”, such as E:\vs2017\VC\Tools\MSVC\14.16.27023\lib\x86
6, Return to glew-1.10.0 root directory, copy glew32.lib from lib\Release\x64 to lib\x64 of VS installation directory, such as E:\vs2017\VC\Tools\MSVC\14.16.27023\lib\x64
(This is not very safe, because it is difficult to manage and easy to lose, the preferred way is to create a new directory containing all the third party libraries and header files. And specify these folders in your IDE or compiler.
7, Copy glew32.dll from bin\Release\Win32 to C:\Windows\System32, then return to glew-1.10.0 root
8, Go back to glew-1.10.0 root and copy glew32.dll from bin\Release\x64 to C:\ WindowsSYSWOW64
At this point, the configuration of the Glew library is complete!


mpile Source code
<>>

Compile Source code


Compile Source code


Compile Source code

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).

 

Vs2017 installing OpenGL

The project name – & gt; Manage NUGET packages ->; Browse – & gt; Search Nupengl, download and install it. Reference blog:

https://blog.csdn.net/HY_JT/article/details/79482556 can also refer to the blog: https://blog.csdn.net/yinglang19941010/article/details/50166343

#include <cstdio>
#include <GL/glew.h>
#include <GL/freeglut.h>

#pragma comment(lib, "glew32.lib")

void displayFunction()
{
	glClear(GL_COLOR_BUFFER_BIT);
	glRectf(-0.5, -0.5, 0.5, 0.5);
	glColor3f(0.0, 1.0, 0.0);
	glFlush();
};

int main(int argc, char *argv[])
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
	glutInitWindowSize(600, 600);
	glutCreateWindow("The first OpenGL Application");

	glewExperimental = true;
	glewInit();

	printf("OpenGL version: (%s) \n", glGetString(GL_VERSION));
	glutDisplayFunc(&displayFunction);
	glutMainLoop();

	return 0;
}

The experience of installing OpenGL in vs2017 under win7 system

because these two days the teacher let use C ++ to do the Voronoi diagram generation experiment, was forced to install the OpenGL library (with Voronoi function), do not look at the process is tedious, in fact, after installing the feeling is nothing, just keep adding path is very annoying, the other is to download, install. The procedure is as follows:
1. Install cmake
Make sure (cmake directory)\bin has been added to the system path. If it is not there, you need to add it yourself.




2. Install Boost dependencies
Boost_1_66_0, set the two environment variables, because CMAKE needs to find and connect to the CGAL project when it generates the CGAL project. You need to use these two environment variables, which are configured according to the location where you install the Boost.

the pictures to “(the boost installation location) \ lib32 – MSVC – xx. 0” add to the PATH.
3. The installation of Qt
Also to download Qt, time is long, can go to download over the wall first, then the

4. Install and compile the CGAL
I am in making https://github.com/CGAL/cgal/releases/tag/releases%2FCGAL-4.14-beta1 to download the setup. The exe file, also download faster over the wall, first download can not change the installation directory,
normal install to C:/dev /.


only boost before installation is no problem, to be successful by compiling oh, if cannot compile CGAL normally check before add path address is correct.
Configure the environment variable and PATH add according to your installed CGAL version.

How to connect and share printer under win7

1. Make sure the Spooler service is up and running first

2. Find a random place to add a printer. I found it in the Control Panel

3. Click “Add printer” and select “Add network printer” (Generally, you can not find the printer you want to connect), then click “The printer I want to connect is no longer in the list”, click “Select a printer by sharing” and then. Click “Browse” (usually we still can’t find the printer we want to connect to), as shown below:

4. Enter the printer IP and printer name you want to connect to :\\59.74.111.59\hpLaserJ2, as shown below:

Then click select, the next step, the next step on the line, when the password input password…

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
 
 

Solution of OpenGL initialization failure after upgrading motherboard and CPU

Some time ago, the motherboard and CPU were replaced, and the graphics card was displayed as the CPU core. Because there were a lot of programs, there was no new installation system, but under the old system. The previous programs were completely retained and patched again, and everything looked perfect.
It was not until I played Angry Birds that I found that OpenGL was not working. I suspected that it was a driver problem. Updating the graphics card driver to the latest version still failed. Google has tried countless solutions, but they don’t work. Using the GPU CAPS Viewer, the OpenGL driver was not found.
Occasionally see an article that logout users, with another account login can use OpenGL, remember there is an account, immediately logout after using another account login system, found that OpenGL is really available.
What’s the problem?This must be because the user’s configuration is different, so we export the HKCU in the two users’ registries into reg files, compare the two files with TotalCommander, search OpenGL, and find that there are more in the new registry
[HKEY_CURRENT_USER\Software\Intel\Display\CUICOM], another active reg file does not have it, so try to remove it altogether.
Start the GPU CAPS Viewer again and see that the OpenGL driver is correct, version 3.1. The problem that had troubled us for several days was finally solved.

Conclusion: After the replacement of the graphics card, the old registry key is not deleted. There are two Intel graphics card configurations in HKCU. It is concluded that the system uses the first one to initialize OpenGL, which of course fails.

Solution to the error of win7 & win10 shared printer 0x000000709

The printer installation is normal and the sharing is normal. However, when adding the sharing via // IP/printer name, the 709 error occurred. At first, I thought it was the problem of PrintSpooler service, but it still failed.
Finally found the problem is that the server computer name is too long ———-!!!!!!!!!!!!!!!!
Modify the computer named compliance length, restart the server, and the client directly adds the shared printer. Successfully.

Reproduced in: https://blog.51cto.com/lancatsky/2054715

OpenGL application cannot start normally

About this problem, there are a lot of people on the Internet also encountered, but basically using other people’s solutions can not solve their own problems. The reason for this is that the dependent library fails, and the dependent library that everyone fails on is different. Here’s what happened to you:

First of all, my computer is 64-bit Win7 system, using VS2012, Win32 compiler . Run on your computer is no problem, but transplanted to the friend’s computer, a lack of “msvcp110d. DLL” began to appear, “msvcr110d. DLL” these two libraries, then I am wrong “D: \ visual studio 2012 VC \ \ lib” inside the library for a friend, actually should be to “ C: \ Windows \ SysWOW64 ” the inside of the library.

Also, at first I thought I was going to change the OpenGL dependency library to 64-bit, and then found out that the current OpenGL library is only 32-bit and is compiled and run with VS Win32 regardless of whether the machine is 64 or 32.

If the appeal method does not resolve the problem, please check your program’s dependent libraries, or re-do all the libraries.

     

MSVCP110D.dll MSVCR110D.dll Download link password: yx07

Vs under the execution of OpenGL program can run successfully, but do not show things

There are possible reasons

1, the graphics card does not support the current version of OpenGL, download Everest Ultimate Edition, then click the display device> after installing and running. OpenGL, to see whether support and other relevant information, if not can only replace the graphics card or to support the OpenGL version of the solution

2, The video driver is not supported, update the video driver