着色器没有运行,如果我绑定帧缓冲mipmap材质 [英] Shader is not running if I bind framebuffer to mipmap texture

查看:193
本文介绍了着色器没有运行,如果我绑定帧缓冲mipmap材质的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Open GL生成高斯Parimid,我创建了一个2D纹理的mipmap,并绑定到FBO,FBO [0]数组 - >纹理基础水平,FBO [1] - > 1级质感等上...

I am using open gl to generate Gaussian Parimid, I create a 2D texture with mipmap, and bind to array of FBO, FBO[0] -> base level of texture, FBO[1] -> level 1 texture and so on ...

平台:Android的OpenGL ES 2.0的

Platform: Android OpenGL ES 2.0

在运行code如下:

gaussV.Use();
glUniform1f(gaussV("mip_level"), 0.0);  //some param to shader
glUniform1f(gaussV("delta"), 1.0f / h);  // some param to shader
glBindFramebuffer(GL_FRAMEBUFFER, filterFBO_IDs[m]);
draw(gaussV("vPosition")); // draw arrays.
gaussV.UnUse();

在m == 0,着色器将被调用,但如果M> 0,则着色器程序将不会被调用。

If m==0, the shader will be called, but if m>0, the shader program will not be called.

推荐答案

从OpenGL的es3.0规范(的 http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf ),我们可以看到新闻的功能列表中,其中一人是:

From opengl es3.0 specification (http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf) , we can see the list of news feature, one of them is:

ability to attach any mipmap level to a framebuffer object

使在OpenGL ES2.0装置,它不支持的渲染到纹理的特定水平。

So that means in opengl es2.0, it doesn't support rendering to specific level of texture.

那么如何解决这个问题,如果你需要渲染到具体的mipmap水平?

So how to solve this if you need render to specific mipmap level?


  • 1)创建更多的纹理渲染的,每一个纹理对应
    一个级别的mipmap,这样会创造出很多的纹理,效率不高。

  • 1)Create more textures to render one, each texture corresponding to one level mipmap, this way will create many textures, not efficient.

2)创建一个大的纹理持有的mipmap的各个层面,它像放
从垂直的金字塔水平。

2) Create a big texture to hold all levels of mipmap, it's like put the pyramid from vertical to horizontal.

这篇关于着色器没有运行,如果我绑定帧缓冲mipmap材质的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆