当前位置:网站首页>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;
}
边栏推荐
- South China Technology stack cnn+bilstm+attention
- Good blog good material record link
- MySQL combat optimization expert 09 production experience: how to deploy a monitoring system for a database in a production environment?
- MySQL 29 other database tuning strategies
- Preliminary introduction to C miscellaneous lecture document
- Solution to the problem of cross domain inaccessibility of Chrome browser
- Moteur de stockage mysql23
- MySQL real battle optimization expert 08 production experience: how to observe the machine performance 360 degrees without dead angle in the process of database pressure test?
- MySQL25-索引的创建与设计原则
- MySQL28-数据库的设计规范
猜你喜欢
C miscellaneous two-way circular linked list
A necessary soft skill for Software Test Engineers: structured thinking
MySQL26-性能分析工具的使用
Adaptive Bezier curve network for real-time end-to-end text recognition
ZABBIX introduction and installation
该不会还有人不懂用C语言写扫雷游戏吧
如何搭建接口自动化测试框架?
PyTorch RNN 实战案例_MNIST手写字体识别
Mysql36 database backup and recovery
Pytorch RNN actual combat case_ MNIST handwriting font recognition
随机推荐
Advantages and disadvantages of evaluation methods
Solution to the problem of cross domain inaccessibility of Chrome browser
Opencv uses freetype to display Chinese
MySQL实战优化高手11 从数据的增删改开始讲起,回顾一下Buffer Pool在数据库里的地位
Const decorated member function problem
C miscellaneous two-way circular linked list
MySQL实战优化高手05 生产经验:真实生产环境下的数据库机器配置如何规划?
What is the difference between TCP and UDP?
PyTorch RNN 实战案例_MNIST手写字体识别
基于Pytorch的LSTM实战160万条评论情感分类
Security design verification of API interface: ticket, signature, timestamp
MySQL实战优化高手06 生产经验:互联网公司的生产环境数据库是如何进行性能测试的?
What should the redis cluster solution do? What are the plans?
Export virtual machines from esxi 6.7 using OVF tool
MySQL實戰優化高手04 借著更新語句在InnoDB存儲引擎中的執行流程,聊聊binlog是什麼?
pytorch的Dataset的使用
保姆级手把手教你用C语言写三子棋
Time complexity (see which sentence is executed the most times)
Texttext data enhancement method data argument
Not registered via @EnableConfigurationProperties, marked(@ConfigurationProperties的使用)