青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

逛奔的蝸牛

我不聰明,但我會很努力

   ::  :: 新隨筆 ::  ::  :: 管理 ::

OpenGL: Texture Mapping: When we apply image to a geometric primitive, we call this texture or texture mapping.

Load texture image: glTexImage /glTexSubImage

Map textures to geometry: glTexCoord

Change the texture environment: glTexEnv

Set texture mapping parameters: glTexparameter

Generate mipmaps: gluBuildMipmaps

Manage multiple textures: glBindTexture


dramatic differnece: 戲劇性的.

richness: 豐富.

stark contrast: 對比.

texel: the individual elements in a texture.

pixel: the individual elements in a pixmap.

A one-to-one correspondence seldom exists between texels and pixels on the screen.

shrink: 收縮.

bias: 誤差, 偏差.


Step on applying a texture map to geometry: 

First: Load the texture into memory: 

void glTexImage2D(GLenum target, GLint level, 

GLint internalformat, 

GLsizei width, GLsizei height, 

GLint border, GLenum format, 

GLenum type, void *data); 

target: GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D

level: specifies the mipmap level being loaded, for non-mipmaped texutres always to set this to 0. 

internalformat: how many color components you want to store per texel.

format: e.g. GL_RGB, GL_RGBA

type: e.g. GL_UNSIGNED_BYTE, GL_BYTE, GL_FLOAT, 

data: picture data.


You should also be aware that OpenGL copies the texture information from data when you call one of these functions(after loading, delete the data array, the wanted data is copied into the memory). Loaded textures are not applied to geometry unless the appropriate texture state is enabled.


Second: specify texture coordinates.

glTexCoord2f(s, t);




Texture matrix: glMatrixMode(GL_TEXTURE)

texture coordinates can also be transformated, rotated, and even scaled.


coordinate wrapping, texture filters, and the texture environment.

glTexImage2D(GL_TEXTURE_2D, 0, iComponents, iWidth, iHeight, 0, eFormat, GL_UNSIGNED_BYTE, pBytes); 

free(pBytes); 


glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 


glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 

glEnable(GL_TEXTURE_2D); 


Texture environment: How OpenGL combines the colors from texels and the color of the underlying geometry.

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 


GL_MODULATE: The modulate environment mode multiplies the texel color by the geometry color (after lighting calculations).

GL_REPLACE: Simply replace the color of the underlying geometry.

GL_BLEND: If the texture has an alpha channel, you can enable blending. Otherwise GL_BLEND behavors the same way as GL_REPLACE.

Textures can also be blended with a constant blending color using the GL_BLENDtexture 

environment. If you set this environment mode, you must also set the texture environ- 

ment color: 

GLfloat fColor[4] = { 1.0f, 0.0f, 0.0f, 0.0f }; 

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND); 

glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, fColor); 

GL_ADD: Simply add the texel color values to the color of the underlying fragment.



Texture Parameters:

GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER

GL_NEAREST, GL_LINE

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);



Texture Wrap(s, t):

Normally, you specify texture coordinates between 0.0 and 1.0 to map out the texels in a texture map. If texture coordinates fall out side this range, OpenGL handles them according to the current texture wrapping mode. You can set the wrap mode for each coordinate individually by calling glTexParameteri with GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, or GL_TEXTURE_WRAP_R as the parameter name. The wrap mode can then be set to one of the following values: GL_REPEAT, GL_CLAMP, GL_CLAMP_TO_EDGE, or GL_CLAMP_TO_BORDER. The GL_REPEAT wrap mode simply causes the texture to repeat in the direction in which the texture coordinate has exceeded 1.0. The texture repeats again for every integer texture coordinate. This mode is very useful for applying a small tiled texture to large geometric surfaces


Toon-shading, which is often refered to cell-shading, idea:

The basic idea is to use a surface normal from the geometry and a vector to the light source to find the intensity of the light striking the surface of the model. The dot product of these two vectors gives a value between 0.0 and 1.0 and is used as a one dimensional texture coordinate.



Mipmapping(many things in a small space):

Mipmappingis a powerful texturing technique that can improve both the rendering performance and the visual quality of a scene.

In essence, you load not a single image into the texture state, but a whole series of images from lagerest to smallest into a single "mipmapped" texture state. OpenGL use a new set of filter modes to choose the best-fitting texture or textures for given geometry.

Using a square set of mipmapps requires about one-third more memory than not using mipmapps.

Each one half the size of the previous image.


自動生成的, 質量比較差的Mipmaps:

gluBuild2DMipmaps: it automatically creates the scaled images for you and loads them appropriately with glTexImage.

int gluBuild2DMipmaps(GLenum target, GLint internalFormat, 

GLint width, GLint height, 

GLenum format, GLenum type, const void *data); 

You should also be aware that using these functions may not produce mip level images with the same quality you can obtain with other tools such as Photoshop. 


自動生成的, 質量比較好的Mipmaps:

With newer versions of the GLU library, you can also obtain a finer-grained control over which mip levels are loaded with these functions:

int gluBuild2DMipmapLevels(GLenum target, GLint internalFormat, 

GLint width, GLint height, 

GLenum format, GLenum type, GLint level, 

GLint base, GLint max, const void *data); 

With these functions, level is the mip level specified by the data parameter. This texture data is used to build mip levels base through max


使用硬件加速生成Mipmaps(對于整個場境都使用mipmaps):

Hardware Generation of Mipmaps: 

If you know beforehand that you want all mip levels loaded, you can also use OpenGL hardware acceleration to quickly generate all the necessary mip levels. You do so by setting the texture parameter GL_GENERATE_MIPMAP to GL_TRUE

glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); 

When this parameter is set, all calls to glTexImage or glTexSubImage that update the base texture map (mip level 0) automatically update all the lower mip levels. By making use of the graphics hardware, this feature is substantially faster than using gluBuildMipmaps. However, you should be aware that this feature was originally an extension and was promoted to the OpenGL core API only as of version 1.4. This is definitely the fastest and easiest way to build mipmaps on-the-fly. 


Texture Objects:

Loading and maintaining the texture state occupies a considerable portion of many texture-heavy OpenGL applications (games in particular). 

Texture objects allow you to load up more than one texture state at a time.


texture對象分配內存:

You allocate a number of texture objects with the following function: 

void glGenTextures(GLsizei n, GLuint *textures); 

With this function, you specify the number of texture objects and a pointer to an array of unsigned integers that will be populated with the texture object identifiers


指定texture對象(用一個整數來標志一個紋理對象):

void glBindTexture(GLenum target, GLuint texture); 

The target parameter needs to specify GL_TEXTURE_1D, GL_TEXTURE_2D, or GL_TEXTURE_3D, and textureis the specific texture object to bind to. Hereafter, all texture loads and texture parameter settings affect only the currently bound texture object. 

每一個texture都要設置自己的parameter, 因為每個parameter只對某個綁定的texture有效.


刪除texture對象的內存空間, 釋放內存:

To delete texture objects, you call the following function: 

void glDeleteTextures(GLsizei n, GLuint *textures); 

Calling glDeleteTextures multiple times may incur some delay, but only because you are deallocating possibly large amounts of texture memory.


測試是否有效的texture, 如被刪除后:

You can test texture object names (or handles) to see whether they are valid by using the following function: 

GLboolean glIsTexture(GLuint texture); 

This function returns GL_TRUE if the integer is a previously allocated texture object name or GL_FALSE if not.

posted on 2009-06-01 13:52 逛奔的蝸牛 閱讀(3575) 評論(0)  編輯 收藏 引用 所屬分類: OpenGL
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            在线不卡视频| 亚洲午夜影视影院在线观看| 久久激情视频免费观看| 性久久久久久久久久久久| 国产精品久久久久久久久动漫| 亚洲精品国产精品国自产观看| 亚洲国产婷婷香蕉久久久久久99| 久久综合久久美利坚合众国| 亚洲第一狼人社区| 欧美成人在线免费观看| 欧美激情第9页| 亚洲免费视频在线观看| 亚洲女同同性videoxma| 国产一区二区三区久久久久久久久| 久久久www免费人成黑人精品 | 午夜精品久久久久| 国产日韩欧美制服另类| 久久久人成影片一区二区三区 | 欧美一区日本一区韩国一区| 黑人极品videos精品欧美裸| 男男成人高潮片免费网站| 欧美精品一区二区三| 午夜日韩在线| 久久久国产91| 亚洲特色特黄| 久久米奇亚洲| 亚洲视频网站在线观看| 午夜天堂精品久久久久| 亚洲国产日韩欧美在线99| 一区二区久久| 激情丁香综合| 一本综合久久| 在线观看成人网| 亚洲午夜在线观看| 亚洲国产一区视频| 亚洲一区在线看| 亚洲国产电影| 午夜欧美大片免费观看| 亚洲日韩中文字幕在线播放| 亚洲欧美日韩一区| 一本一道久久综合狠狠老精东影业| 亚洲欧美精品伊人久久| 99这里有精品| 久久影院午夜论| 午夜久久资源| 欧美日韩123| 免费观看一级特黄欧美大片| 国产精品久久久久aaaa樱花| 欧美激情在线免费观看| 国产日韩欧美综合| 亚洲午夜电影网| 亚洲精品一区二区三区婷婷月| 香蕉成人伊视频在线观看| 中文亚洲视频在线| 欧美a级片一区| 美女精品在线观看| 国产麻豆午夜三级精品| 一区二区三区四区精品| 日韩一区二区久久| 欧美成人一区二区三区在线观看 | 久久亚洲国产精品日日av夜夜| 国产精品久久国产三级国电话系列 | 亚洲欧美日韩系列| 欧美日韩第一区日日骚| 欧美激情一区二区三区高清视频 | 国产精品久久久久久久久久直播| 亚洲激情一区二区三区| 亚洲欧洲视频| 欧美成人黄色小视频| 免播放器亚洲一区| 在线精品一区二区| 久久激情一区| 免费的成人av| 亚洲欧洲一级| 欧美国产日韩一区二区| 亚洲日本无吗高清不卡| 这里只有视频精品| 欧美午夜精品理论片a级大开眼界| 91久久在线播放| 夜夜精品视频| 欧美三级第一页| 亚洲一区二区三区四区五区午夜| 亚洲一区二区在线播放| 国产伦精品一区二区三区视频黑人| 中日韩美女免费视频网址在线观看 | 亚洲国产精品黑人久久久| 亚洲人成人一区二区在线观看| 免费一级欧美片在线观看| 91久久线看在观草草青青| 一区电影在线观看| 国产精品国色综合久久| 午夜在线一区| 欧美国产日韩视频| aa成人免费视频| 国产欧美高清| 蜜臀91精品一区二区三区| 亚洲国产精品一区二区第一页| 一本大道久久a久久精二百| 国产精品国产三级国产专播精品人| 亚洲欧美国产精品va在线观看| 久久三级福利| 亚洲作爱视频| 国产欧美一区二区三区沐欲| 久久久久网址| 宅男噜噜噜66一区二区| 久久九九久精品国产免费直播| 91久久国产精品91久久性色| 欧美日韩伊人| 久久先锋资源| 中日韩美女免费视频网址在线观看| 久久精品视频播放| 一区二区三区四区蜜桃| 国内久久精品视频| 欧美色网一区二区| 久久久欧美精品| 一区二区三区高清| 亚洲电影免费观看高清完整版在线| 亚洲午夜高清视频| 亚洲国产高清aⅴ视频| 国产精品九九| 欧美日本国产视频| 久久男人av资源网站| 亚洲欧美日韩精品一区二区| 亚洲日韩欧美视频| 欧美激情aaaa| 久久久夜精品| 欧美一区二区私人影院日本| 日韩视频免费观看高清完整版| 国产一区二三区| 国产欧美高清| 欧美性大战xxxxx久久久| 欧美二区不卡| 久久天天躁狠狠躁夜夜爽蜜月| 亚洲女人av| 在线一区视频| 日韩一级视频免费观看在线| 欧美激情第五页| 裸体一区二区三区| 久久电影一区| 午夜亚洲视频| 亚洲欧美一区二区视频| 亚洲午夜高清视频| 亚洲永久精品国产| 亚洲视频精品在线| 亚洲一区二区三区中文字幕在线| 亚洲精品乱码视频| 亚洲精品日韩综合观看成人91| 在线观看欧美一区| 亚洲国产日韩欧美在线动漫| 在线看不卡av| 亚洲人成亚洲人成在线观看图片| 亚洲国产合集| 亚洲高清在线播放| 亚洲精品久久| aaa亚洲精品一二三区| 夜夜嗨av一区二区三区四区| aⅴ色国产欧美| 亚洲中无吗在线| 香蕉久久夜色精品| 久久久噜噜噜久久| 美女亚洲精品| 亚洲韩国精品一区| 亚洲美女免费精品视频在线观看| 亚洲六月丁香色婷婷综合久久| 在线亚洲欧美视频| 性刺激综合网| 欧美 日韩 国产在线| 欧美日韩一二三区| 国产日韩精品一区二区三区| 精久久久久久久久久久| 亚洲日本国产| 午夜精品久久久久久久白皮肤| 欧美在线日韩精品| 乱码第一页成人| 日韩小视频在线观看专区| 亚洲一区二区三区777| 久久精品日韩一区二区三区| 欧美成人一区二区在线| 国产精品美女一区二区在线观看 | 欧美色欧美亚洲另类七区| 国产精品美女午夜av| 国产精品中文字幕在线观看| 国外成人网址| 亚洲国产日韩欧美综合久久| 亚洲视屏在线播放| 久久国产精品久久久久久久久久| 午夜精品福利在线| 欧美激情精品久久久| 一区二区高清| 欧美中文字幕在线播放| 欧美日韩dvd在线观看| 国产伦一区二区三区色一情| 在线精品国产欧美| 亚洲欧美日韩国产成人| 蜜桃av一区二区三区| 日韩手机在线导航| 久久网站免费| 国产精品白丝av嫩草影院 | 久久riav二区三区| 欧美日韩国产一区精品一区|