OpenGL Function Note
glTexImage2D:
Access Violate when invoke glTexImage2D. This problem may happen when specify a color system which is not correspond to the exact color system.Eg. The texture uploaded is store in RGB color system,but when invoke glTexImage2D, I specify that the texture is in RGBA color system.Then, access violate will happen.
glUseProgram:
This function work like glBind...(eg.glBindVertexArray) .After you call glUseProgram( 0 ), if you call glUniform... to upload some variable to shaders, glUniform don't work, even if you have invoke glGetUniformLocation and specify what variable to be bound to what shaders.So when you want to upload uniform data to shader(matrix, light, texture and so on), make sure that you call glUseProgram( the shader you want to upload data ).
Access Violate when invoke glUseProgram or other gl... functions. This may happen when invoke some gl... functions before init GLEW( invoke function glewInit) because some gl... functions are rely on GLEW as far as I know.So the solution is obviously init the GLEW first.
Notice that access violate at location 00000000 often happens when forgetting to init GLEW library first.
glDrawElement:
If using glDrawElement without creating a element array buffer( index buffer in DirectX ) before,we should pass the index array to this function as his fourth parameter. But if using glDrawElement with a element array buffer created, wh should pass (GLvoid* )0(the start position of the index array in the element array buffer) to this function as his fourth parameter. If we don't specify the correct parameter, we will either fail to compile successfully or compile successfully but draw nothing.
To Be Continued!
If reprint articles, please indicate the source.