当前位置:网站首页>API learning of OpenGL (2001) gltexgen
API learning of OpenGL (2001) gltexgen
2022-07-06 10:36:00 【hankern】
Used to calculate texture coordinates .
opengl es 3.2 and opengl 4.5 This function is no longer supported , I don't know from which version it doesn't support .(This article describes legacy OpenGL APIs that have been removed from core OpenGL 3.1 and above (they are only deprecated in OpenGL 3.0). It is recommended that you not use this functionality in your programs. Consider using the OpenGL Shading Language instead. Mathematics of glTexGen - OpenGL Wikihttps://www.khronos.org/opengl/wiki/Mathematics_of_glTexGen)
void glTexGenf(GLenum coord, GLenum pname, GLfloat param);
void glTexGenfv(GLenum coord, GLenum pname, GLfloat *param); The first parameter specifies the texture axis , It can be GL_S,GL_T,GL_R or GL_Q. The second parameter must be GL_TEXTURE_SPHERE,GL_OBJECT_PLANE or GL_EYE_PLANE. The last parameter sets the method or mode of texture generation .glTexGen There are also corresponding GLint and GLdouble Pattern .
Parameters coord Must be GL_S、GL_T、GL_R or GL_Q
pname Parameter is GL_TEXTURE_GEN_MODE、GL_OBJECT_PLANE or GL_EYE_PLANE,
If it is GL_TEXTURE_GEN_MODE,param It's an integer , namely GL_OBJECT_PLANE,GL_EYE_PLANE,GL_SPHERE_MAP,GL_REFLECTION,GL_NORMAL_MAP One of ;
If pname Take other possible values ,param It's a pointer to an array .
GL_OBJECT_LINEAR
g = p1 xo + p2 yo + p3 zo + p4 wo
glTexGen(GL_S, GL_OBJECT_LINEAR, {ps0,ps1,ps2,ps3})
glTexGen(GL_T, GL_OBJECT_LINEAR, {pt0,pt1,pt2,pt3})
And the following are equivalent
vec4 sPlane = vec4(ps0,ps1,ps2,ps3);
vec4 tPlane = vec4(pt0,pt1,pt2,pt3);
kOutBaseTCoord.s = dot(vec4(POSITION, 1.0), sPlane);
kOutBaseTCoord.t = dot(vec4(POSITION, 1.0), tPlane);
GL_EYE_LINEAR
myEyePlane_S = VectorTimesMatrix(myPlane_S, InverseModelviewMatrix);
myEyePlane_T = VectorTimesMatrix(myPlane_T, InverseModelviewMatrix);
// Now that we have myEyePlane_S and myEyePlane_T...
for(i = 0; i < total; i++)
{
myEyeVertex = MatrixTimesVector(ModelviewMatrix, myVertex[i]);
myTexCoord[i].s = dot4D(myEyeVertex, myEyePlane_S);
myTexCoord[i].t = dot4D(myEyeVertex, myEyePlane_T);
}
GL_SPHERE_MAP
for(i = 0; i < total; i++)
{
myEyeVertex = MatrixTimesVector(ModelviewMatrix, myVertex[i]);
myEyeVertex = Normalize(myEyeVertex);
myEyeNormal = VectorTimesMatrix(myNormal[i], InverseModelviewMatrix);
reflectionVector = myEyeVertex - myEyeNormal * 2.0 * dot3D(myEyeVertex, myEyeNormal);
reflectionVector.z += 1.0;
m = 1.0 / (2.0 * sqrt(dot3D(reflectionVector, reflectionVector)));
// I am emphasizing that we write to s and t. Used to sample a 2D texture.
myTexCoord[i].s = reflectionVector.x * m + 0.5;
myTexCoord[i].t = reflectionVector.y * m + 0.5;
}
GL_REFLECTION_MAP
for(i = 0; i < total; i++)
{
myEyeVertex = MatrixTimesVector(ModelviewMatrix, myVertex[i]);
myEyeVertex = Normalize(myEyeVertex);
myEyeNormal = VectorTimesMatrix(myNormal[i], InverseModelviewMatrix);
dotResult = 2.0 * dot3D(myEyeVertex, myEyeNormal);
// I am emphasizing that we write to s and t and r. Used to sample a cubemap.
myTexCoord[i].s = myEyeVertex.x - myEyeNormal.x * dotResult;
myTexCoord[i].t = myEyeVertex.y - myEyeNormal.y * dotResult;
myTexCoord[i].r = myEyeVertex.z - myEyeNormal.z * dotResult;
}
边栏推荐
- MySQL实战优化高手11 从数据的增删改开始讲起,回顾一下Buffer Pool在数据库里的地位
- MySQL33-多版本并发控制
- 15 medical registration system_ [appointment registration]
- 实现以form-data参数发送post请求
- MySQL combat optimization expert 10 production experience: how to deploy visual reporting system for database monitoring system?
- MySQL35-主从复制
- Complete web login process through filter
- Baidu Encyclopedia data crawling and content classification and recognition
- MySQL combat optimization expert 12 what does the memory data structure buffer pool look like?
- Ueeditor internationalization configuration, supporting Chinese and English switching
猜你喜欢

MySQL24-索引的数据结构

Moteur de stockage mysql23

Not registered via @enableconfigurationproperties, marked (@configurationproperties use)

Mysql24 index data structure

MySQL Real Time Optimization Master 04 discute de ce qu'est binlog en mettant à jour le processus d'exécution des déclarations dans le moteur de stockage InnoDB.

MySQL實戰優化高手04 借著更新語句在InnoDB存儲引擎中的執行流程,聊聊binlog是什麼?

Record the first JDBC

Nanny hand-in-hand teaches you to write Gobang in C language

A necessary soft skill for Software Test Engineers: structured thinking

MySQL23-存储引擎
随机推荐
Introduction tutorial of typescript (dark horse programmer of station B)
Pytoch LSTM implementation process (visual version)
MySQL36-数据库备份与恢复
What should the redis cluster solution do? What are the plans?
MySQL34-其他数据库日志
UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xd0 in position 0成功解决
MySQL ERROR 1040: Too many connections
How to build an interface automation testing framework?
Pytorch RNN actual combat case_ MNIST handwriting font recognition
What is the difference between TCP and UDP?
Simple solution to phpjm encryption problem free phpjm decryption tool
Mysql33 multi version concurrency control
Isn't there anyone who doesn't know how to write mine sweeping games in C language
MySQL29-数据库其它调优策略
MySQL26-性能分析工具的使用
Bytetrack: multi object tracking by associating every detection box paper reading notes ()
Software test engineer development planning route
Chrome浏览器端跨域不能访问问题处理办法
百度百科数据爬取及内容分类识别
MySQL实战优化高手02 为了执行SQL语句,你知道MySQL用了什么样的架构设计吗?