How to use multiple pasters of OpenGL in Windows

Source: Internet
Author: User
Tags types of extensions

If you want to use OpenGL for development in Windows, you will encounter a problem. The OpenGL version provided by Microsoft is 1.1, and the later version is not provided. (why? Because people want to promote their own Dx and despise him !), If you want to use some advanced functions, you can only use OpenGL extensions. There are many types of extensions. OpenGL has a big advantage, that is, its scalability and glext. H and glew. h pay attention to the reference sequence when referencing the two header files, glext. The declaration of H should be behind glut. h, and the declaration of glew. H should be behind glut. H. We need to initialize it when using glew. h.

 

Glenum err = glewinit ();
If (glew_ OK! = ERR)

{
Messageboxa (null, "error", "my window", 1 );

}

Maybe we are very confused. Why can't the examples of multi-layer textures in OpenGL redbooks be used? Why can't they use the code written in windows? When I add glext. H: The header file is. It is found that glactivetexturearb and glmultitexcoord2farb are not defined. Check the nehe code and find the problem. The windows program does not find the entry addresses of the two functions. First declare the function pointer.

Pfnglactivetexturearbproc glactivetexturearb = NULL;
Pfnglmultitexcoord2farbproc glmultitexcoord2farb = NULL;

Then initialize it in our init function.

Glmultitexcoord2farb = (pfnglmultitexcoord2farbproc) wglgetprocaddress ("glmultitexcoord2farb ");
Glactivetexturearb = (pfnglactivetexturearbproc) wglgetprocaddress ("glactivetexturearb ");

Then compile it. OK. No problem.

However, we found that the result is very dark, because the texture environment we set is gltexenvi (gl_texture_env, gl_texture_env_mode, gl_modulate) glmodulate. I believe everyone understands what this parameter means, to change his practical effects, we have to work on it ......

 

 

It's not because we didn't do it ......, It is easy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.