How to use MultiteXture in OpenGL. That is, how to open multiple layers.

zhaozj2021-02-16  97

How to use MultiteXture in OpenGL. That is, how to open multiple layers.

Question: BY XheartBlue1: GLACTIVETEXTURE (GL_TEXTUREN); can control the current texture operation to which TEX_Unit can be used. The n from GL_Texturen from 0 to 31. See Glext.h definitions.

2: GLACTIVETEXTURE is an extension. But already in the core of OpenGL 1.3. So Doc to GLSPEC1.3 to find it.

3: Glmulttexcoord (GL_Texturen, ....); used to specify a Tex_Unit texture coordinate.

4: GlclientActiveTexture (GL_Texturen); Used to control the following functions affect the nth tex_unitglenableclientstate (GL_Texture_Coord_Array); GLTEXCOORDPOINTER

5: EG. Using the second texture code as the following GLACTIVETEXTURE (GL_Texture_2D); GlbindTexture (...): Gltexenv (...): Close the second texture code as the following GLACTIVETEXTURE (GL_Texture1) GLDISABLE (GL_TEXTURE_2D); GLACTIVETEXTURE (GL_Texture0); // Change back to the first. Otherwise, the following operation is for GL_Texture1.

Use two texture channels using two texture channels ïž All to activate them, 44 GlclientActiveTexture (GL_Texture0); GLENABLETATEXTATE (GL_TEXTURE_COORD_ARRAY); GLCLIENTACTIVETEXTURE (GL_Texture1); GLENABLECLIENTSTATE (GL_Texture_Coord_Array)

GlclientActiveTexture (GL_Texture0); gltexcoordpointer (); GlclientactiveTexture (GL_Texture1); gltexcoordpointer ();

........................

GLDRAWARRAYS (....

// After using two channels. All are closed. GlclientActiveTexture (GL_Texture0); GLDISABLECLIENTSTATE (GL_Texture_Coord_Array); GlclientActiveTexture (GL_Texture1); GLDISABLECLIENTATATE (GL_Texture_Coord_Array);

// Close the second texture channel GLACTIVETEXTEXTURE (GL_Texture1); GLDISABLE (GL_Texture_2D); GLACTIVETEXTURE (GL_Texture0); glenable (GL_Texture_2D);

6: Finally, supplement: The belt does not take ARB. Knowing the definition. ARB later turned into the core.

转载请注明原文地址:https://www.9cbs.com/read-10526.html

New Post(0)