简体   繁体   English

OpenGL纹理转换

[英]OpenGL texture transformations

I'm a beginner to OpenGL and I'd like a simple introduction to using textures. 我是OpenGL的初学者,我想对使用纹理进行简单介绍。 For my application, I have no need of geometry, just some texture manipulation. 对于我的应用程序,我不需要几何图形,只需要进行一些纹理处理即可。 I want to be able to scale, rotate, and translate textures, blend textures together (mixing R,G,B components), and display textures on the screen. 我希望能够缩放,旋转和转换纹理,将纹理混合在一起(混合R,G,B组件)并在屏幕上显示纹理。 If you could also tell me how to draw a solid filled rectangle, that would be good. 如果您还可以告诉我如何绘制一个实心填充矩形,那将是很好的。

I'm also fuzzy on shaders. 我对着色器也很模糊。 Could I use GLSL to transform the color at every point on a texture by a formula? 我可以使用GLSL通过公式转换纹理上每个点的颜色吗?

Examples or explanations in C would be preferred. C语言中的示例或解释将是首选。

You have asked a lot of questions... 你问了很多问题...

If you want to play with textures and do some 2d effects here is a little pseudocode that could help: 如果您想玩纹理并做一些2d效果,这里有一些伪代码可以帮助您:

render() {
    glClear(...)
    glUseProgram(shader_program);

    bind_textures();
    setup_shader_params();

    draw_fullscreen_quad();
    glUseProgram(0);

    // rest of opengl...
 }

read more on: 阅读更多内容:

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

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