在OpenGL中同时使用可编程和固定管线功能 [英] Using both programmable and fixed pipeline functionality in OpenGL

查看:381
本文介绍了在OpenGL中同时使用可编程和固定管线功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个顶点着色器,可以转换顶点以创建鱼眼效果.可以仅使用顶点着色器,并对片段部分使用固定的流水线.

I have a vertex shader that transforms vertices to create a fisheye affect. Is is possible to just use just the vertex shader and use fixed pipeline for the fragment portion.

所以基本上我有一个不使用着色器的应用程序.我想使用顶点着色器将鱼眼效果应用于所有顶点,然后将其留给应用程序以照亮,纹理化等?

So basically i have an application that doesnt use shaders. I want to apply a fisheye affect using a vertex shader to transform all vertices, and then leave it to the application to take care to lighting, texturing, etc?

如果这不可能,那么弄乱gl back缓冲区的内容是否有可能引起鱼眼效应?

If this is not possible, is it possible to get a fisheye affect by messing with the contents of the gl back buffer?

谢谢

推荐答案

如果您的代码是固定功能的,那么您所描述的就是一个问题-这就是为什么在着色器中使用图形代码的原因:它们使您可以轻松地进行任何更改.记住要在下一个项目中使用它们. :)

If your code is on fixed function, then what you described is a problem - that's why having your graphics code in shaders is good: they let you change anything easily. Remember to use them in your next project. :)

好的,但是对于这个特定的问题,我假设您现在不想从头开始将整个渲染重写为着色器...

OK, but for this particular I assume that you don't want to rewrite your whole rendering from scratch to shaders now...

您提到要具有鱼眼效果".似乎您很幸运,因为我相信您不需要着色器即可!如果我们在谈论相同的效果,那么只需将GL_PROJECTION矩阵从OpenGL的固定函数替换为具有更大视角的透视矩阵,就可以实现.

You mentioned you want to have a "fisheye effect". Seems like you're lucky, because I believe you don't need shaders for that effect! If we're talking about the same effect, then you can achieve it just by replacing the GL_PROJECTION matrix from OpenGL's fixed function to a perspective matrix with a wider angle of vision.

这篇关于在OpenGL中同时使用可编程和固定管线功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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