投影纹理与最小细节层级的混合应用
来源:互联网 发布:如何恢复u盘数据 编辑:程序博客网 时间:2024/06/04 19:04
void Basic::genfloorTex(){ m_sourceImage = NvImage::CreateFromDDSFile("textures/flower1024.dds"); GLint w = m_sourceImage->getWidth(); GLint h = m_sourceImage->getHeight(); GLint intFormat = m_sourceImage->getInternalFormat(); GLint format = m_sourceImage->getFormat(); GLint type = m_sourceImage->getType(); // Image must be immutable in order to be used with glBindImageTexture // So we copy the mutable texture to an immutable texture glGenTextures(1, &m_sourceTexture); glBindTexture(GL_TEXTURE_2D, m_sourceTexture); glTexStorage2D(GL_TEXTURE_2D, 1, intFormat, w, h); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, format, type, m_sourceImage->getLevel(0)); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glBindTexture(GL_TEXTURE_2D, 0);}//vertex shader#version 100attribute highp vec2 aPosition;attribute highp vec2 aTexcoord;uniform mediump mat4 uViewProjMatrix;varying lowp vec4 vColor;varying lowp vec2 vs_fs_texCoord;varying lowp vec4 vs_fs_projtexCoord;void main(void){ gl_Position = uViewProjMatrix * vec4(aPosition.x, aPosition.y, 0.0, 1.0); vs_fs_texCoord = aTexcoord; vs_fs_projtexCoord = mat4(0.5,0.0,0.0,0.0, 0.0,0.5,0.0,0.0, 0.0,0.0,0.5,0.0, 0.5,0.5,0.5,1.0)*uViewProjMatrix * vec4(aPosition.x+0.4, aPosition.y, 0.0, 1.0);}//frag shader#version 430precision highp float;in lowp vec2 vs_fs_texCoord;in lowp vec4 vs_fs_projtexCoord;layout (binding = 0) uniform sampler2D mipmapTex;layout (binding = 1) uniform sampler2D projTex;layout (location = 0) out vec4 outcolor0;void main(void){ //outcolor0 = texture(mipmapTex, vs_fs_texCoord); //outcolor0 = textureLod(mipmapTex,vs_fs_texCoord,6.0f); outcolor0 = texture(mipmapTex, vs_fs_texCoord); outcolor0+= textureProj(projTex,vs_fs_projtexCoord);}
阅读全文
0 0
- 投影纹理与最小细节层级的混合应用
- 多重纹理的混合
- 游戏的纹理混合
- 投影纹理
- 我对【纹理颜色混合】与【ALPHA混合】的理解
- 我对【纹理颜色混合】与【ALPHA混合】的理解
- 我对【纹理颜色混合】与【ALPHA混合】的理解
- 投影矩阵与最小二乘的背后联系
- GL和DX中关于纹理操作(包括多重纹理)与混合的问题
- 【寒江雪】纹理混合的实现
- 连续细节层级地形的初步实现
- 连续细节层级地形的优化
- 纹理混合
- 投影矩阵与最小二乘
- 【线性代数】最小二乘与投影矩阵
- 投影矩阵与最小二乘
- 投影矩阵与最小二乘
- 投影矩阵与最小二乘
- JS实现带有logo的二维码
- 使用 CodeMirror 打造属于自己的在线代码编辑器
- python3 内置核心数据类型
- django项目开发模拟auth的做一个登录验证(一)
- SpringBoot事务的使用
- 投影纹理与最小细节层级的混合应用
- Java集合框架--MapTest
- LDA主题模型三连击-入门/理论/代码
- django项目开发模拟auth的做一个登录验证(二)
- JAVA包装类及其拆箱装箱及Integer类拆装箱的细节
- 现代操作系统之多处理机系统(中)
- 策略模式
- 回文树 学习小记
- django-web开发使用图片验证码