Tag Archives: OpenGL

OpenGL configuration file, as well as unable to parse the file solution

Suggest to look at the question first
Do not guarantee that all people can use, to tell the truth, the computer is to need patience and perseverance, I have no talent, with three days.
I refer to “Computer Graphics Learning to Program (Using OpenGL and C ++)” here to talk about my files and problems.
Part of the file: https://github.com/Vnicy/Opengl-pathsetting
There is no GLM here, just go to Baidu GLM and put in the include file. (Too many files to upload)
After downloading and unzipping, open a newly created project.
Project – & gt; Property – & gt;
include directory include
brary directory select lib
a>
then se> linker ->; Add the following content to the input modification attached dependency (L is typed in lib with carriage return or semicolon, not identified by comma)
glew32.lib
glew32s.lib
glfw3.lib
soil2-debug.lib
glfw3dll.lib
OpenGL32.lib


Here are some of the problems I encountered :(I tested the first example in the book, which can also be downloaded, the resource address is listed in # 1)
1. Baidu SOIL2 didn’t make file
the solution: supporting resources in the book there is a complete soil file
resource address: https://www.epubit.com/bookDetails?id=UBb600b5af4598
Unable to resolve _imp_glClear@4 and _imp_glClearColor@16 are linkers -> I forgot to add an additional dependency to the input OpenGL32.lib


ah
4>ble to resolve glew initialization

4
4
:
:
:

OpenGL runtime returned 1283 (stack overflow) error

During the test, it was found that some models would cause OpengL to report 1283 error. The code is as follows:

// check for errors
	m_glErrorCode=glGetError();
	if(m_glErrorCode != GL_NO_ERROR)
	{
		const GLubyte *estring;
		CString mexstr;
// get the error descritption from OGL
		estring = gluErrorString(m_glErrorCode);
// prepare and show a message box
		mexstr.Format(L"GLEnabledView:\n\tAn OpenGL error occurred: %s\n", estring);
		AfxMessageBox(mexstr,MB_OK | MB_ICONEXCLAMATION);
	}

The value of m_glErrorCode for debugging is 1283 and eString is a stack overflow
After talking to friends and Googling, I came to the following conclusion:
The push and POP classes in OpengL don’t match.
The reason for the problem is that after a push, an opengL function made an error running, and then the return dropped, causing the subsequent POP not to run, reporting the error.

After the problem is solved, I find that the previous code will make a judgment on the return value of some OpengL functions. Let’s learn. This will help you find out quickly what the problem is.

	if(!gluUnProject(winx,winy,winz,modelMatrix,projMatrix,viewport,&objx1,&objy1,&objz1))
		return FALSE;

If you want to discuss it, please email me.

OpenGL error getting glgeterror ()

Transfer: http://blog.csdn.net/u010270148/article/details/52934295

An OpenGL Error is caused if the function arguments do not match the current context Settings. It is represented by error code. In the vast majority of cases, the OpenGL functions produces errors and this will not work. A few work.

The
OpenGL Error is stored in a queue until the Error is processed. So, if you don’t check for errors regularly, you won’t know that a function call has triggered an error. Therefore, error detection should be checked periodically to ensure that the details of the error are known.

gets the next OpenGL Error in the queue and removes it from the queue. If GL_NO_ERROR is returned, the team is empty.

GLenum glGetError ()

if all OpenGL errors are obtained

for(GLenum err; (err = glGetError()) ! = GL_NO_ERROR;)

{

//Process/log the error.

}

all return values are:

GL_NO_ERROR
(0) No error value currently

GL_INVALID_ENUM
(1280) Returns GL_INVALID_OPERATION only if an invalid enumeration parameter is used, if the specified environment is used

GL_INVALID_VALUE
(1281) Returns GL_INVALID_OPERATION only if an invalid value parameter is used, if the specified environment is used

GL_INVALID_OPERATION
The :(1282) command’s state set is invalid for the specified argument.

GL_STACK_OVERFLOW
:(1283) a stack push operation exceeds the stack size.

GL_STACK_UNDERFLOW
(1284) The push – out operation reaches the bottom of the stack.

GL_OUT_OF_MEMORY
(1285) cannot allocate enough memory.

GL_INVALID_FRAMEBUFFER_OPERATION
(1286) when the operation is not ready for the true cache.

GL_CONTEXT_LOST
(1287) OpenGL Context is lost due to graphics card reset.