简体   繁体   English

在OpenGL ES片段着色器中将图纸细分为纹理FBO

[英]Subrect drawing to texture FBO within OpenGL ES Fragment Shader

I'm trying to draw to a subrect of a texture based FBO, but am having difficulty. 我正在尝试绘制基于纹理的FBO的子区域,但是遇到了困难。 The FBO has dimensions of say 500x500 and I am trying to have the fragment shader only redraw say a 20x20 pixel subrect. FBO的尺寸为500x500,我正在尝试让片段着色器仅重绘20x20像素的subrect。 Modiyfing the full texture works without difficulty. 修改整个纹理很容易。

At first I tried setting glViewport to the needed subrect, but it doesn't look to be that simple. 最初,我尝试将glViewport设置为所需的subrect,但它看起来并不那么简单。 I'm suspecting that the Vertex attributes affecting gl_Position and the varying texture coordinates are involved, but I can't figure out how. 我怀疑涉及到影响gl_Position的顶点属性和变化的纹理坐标,但是我不知道怎么做。

原来,我正在尝试修改纹理坐标属性,但是使用着色器中的glViewport和gl_FlagCoord可以更轻松地修改视口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM