To say that graphics is not incomprehensible, but does not have systematic learning and review. So far, it is still a treasure. If you want to write something casually, you must have a book on the side.
Another trip to the Tiger Hill is to round out the dream this year and get something out of it.
> OpenGL diagnosis Tool
When developing WebService, I felt that the packet capture tool had a lot of benefits. Therefore, graph development started from the diagnosis tool, and this time it was very quick:
In a gldrawrangeelements contact, it was not compiled. It was not supported in Windows by OpenGL extensions viewer and dependency viewer.
Http://www.realtech-vr.com/glview/
For Nb, this guy is also available on Apple appstore and Mac appstore.
We can see that the OpenGL function gldrawrangeelements is not supported. You can use dependency Walker to view the result:
In fact, there is something like gdebugger, which is too advanced.
> OpenGL Information Query Method
void queryGlInfomationGLInfo(HDC hdc)
{
char* str = 0;
int colorBits[4]; // (r,g,b,a)
int depthBits;
int stencilBits;
int maxTextureSize;
int maxLights;
int maxAttribStacks;
int maxModelViewStacks;
int maxProjectionStacks;
int maxClipPlanes;
int maxTextureStacks;
int pixelFormat;
// get vendor string
str = (char*)glGetString(GL_VENDOR);
// get renderer string
str = (char*)glGetString(GL_RENDERER);
// get version string
str = (char*)glGetString(GL_VERSION);
// get all extensions as a string
str = (char*)glGetString(GL_EXTENSIONS);
// get number of color bits
glGetIntegerv(GL_RED_BITS, &colorBits[0]);
glGetIntegerv(GL_GREEN_BITS, &colorBits[1]);
glGetIntegerv(GL_BLUE_BITS, &colorBits[2]);
glGetIntegerv(GL_ALPHA_BITS, &colorBits[3]);
// get depth bits
glGetIntegerv(GL_DEPTH_BITS, &depthBits);
// get stecil bits
glGetIntegerv(GL_STENCIL_BITS, &stencilBits);
// get max number of lights allowed
glGetIntegerv(GL_MAX_LIGHTS, &maxLights);
// get max texture resolution
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
// get max number of clipping planes
glGetIntegerv(GL_MAX_CLIP_PLANES, &maxClipPlanes);
// get max modelview and projection matrix stacks
glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, &maxModelViewStacks);
glGetIntegerv(GL_MAX_PROJECTION_STACK_DEPTH, &maxProjectionStacks);
glGetIntegerv(GL_MAX_ATTRIB_STACK_DEPTH, &AttribStacks);
// get max texture stacks
glGetIntegerv(GL_MAX_TEXTURE_STACK_DEPTH, &info.maxTextureStacks);
// get the current pixel format
pixelFormat = GetPixelFormat(hdc);
}
> Cross-platform OpenGL library
The lack of a gldrawrangeelement makes it very useful for me to learn a well-encapsulated OpenGL library. Google found something like glext and glew.
Take gldrawrangeelements in glew as an example:
// Header
// States
#define GL_TRIANGLES 0x0004
#define GL_TRIANGLE_STRIP 0x0005
#define GL_TRIANGLE_FAN 0x0006
#define GL_QUADS 0x0007
#define GL_QUAD_STRIP 0x0008
// Function Pointer
typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
#define glDrawRangeElements GLEW_GET_FUN(__glewDrawRangeElements)
GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements;
// Implementation:
PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements = NULL;
glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElements"))
In this way, you can directly use gldrawrangeelements. Of course, the premise is to export the gldrawrangeelements function. Otherwise, it would be hard for a clever man to have no problem.
In fact, Company A's O Library also has such a set of things.
> Glut
Http://www.xmission.com /~ Nate/glu.html