1 / 89

418382 สภาพแวดล้อมการทำงานคอมพิวเตอร์กราฟิกส์ การบรรยายครั้งที่ 5

418382 สภาพแวดล้อมการทำงานคอมพิวเตอร์กราฟิกส์ การบรรยายครั้งที่ 5. ประมุข ขันเงิน pramook@gmail.com. TEXTURE MAPPING. Textures. Texture Object An OpenGL data type that keeps textures resident in memory and provides identifiers to easily access them

aricin
Download Presentation

418382 สภาพแวดล้อมการทำงานคอมพิวเตอร์กราฟิกส์ การบรรยายครั้งที่ 5

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 418382 สภาพแวดล้อมการทำงานคอมพิวเตอร์กราฟิกส์การบรรยายครั้งที่ 5 ประมุข ขันเงิน pramook@gmail.com

  2. TEXTURE MAPPING

  3. Textures • Texture Object • An OpenGL data type that keeps textures resident in memory and provides identifiers to easily access them • Provides efficiency gains over having to repeatedly load and reload a texture • You can prioritize textures to keep in memory • OpenGL uses least recently used (LRU) if no priority is assigned

  4. Step 1 – create Texture Objects • glGenTextures(1, &texture[texture_num]); • First argument tells GL how many Texture Objects to create • Second argument is a pointer to the place where OpenGL will store the names (unsigned integers) of the Texture Objects it creates • texture[ ] is of type GLuint

  5. Step 2 – Specify which texture object is about to be defined • Tell OpenGL that you are going to define the specifics of the Texture Object it created • glBindTexture(GL_TEXTURE_2D, texture[texture_num]); • Textures can be 1D and 3D as well

  6. Step 3 – Begin defining texture • glTexParameter() • Sets various parameters that control how a texture is treated as it’s applied to a fragment or stored in a texture object • // scale linearly when image bigger than texture glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); • // scale linearly when image smaller than texture glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);

  7. Step 4 – Assign image data • glTexImage2D();

  8. glTexImage2D – Arg 1 • GLenum target • GL_TEXTURE_{1|2|3}D • GL_PROXY_TEXTURE_2D • Provides queries for texture resources • Proceed with hypothetical texture use (GL won’t apply the texture) • After query, call GLGetTexLevelParamter to verify presence of required system components • Doesn’t check possibility of multiple texture interference

More Related