在OpenGLES中将图像分割成一个小四边形网格 [英] split the image into a mesh of small quadrangles in OpenGLES

查看:121
本文介绍了在OpenGLES中将图像分割成一个小四边形网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 OpenGLES 中将图像分割成小四边形网格。

How do I split the image into a mesh of small quadrangles in OpenGLES.

我需要拆分小部件中的图像,之后只拉伸图像的一部分,而不是整个图像。

I need to split image in small parts and after that stretch only one part of the image, not the whole image.

是否可以使用 OpenGL ?我是新的 OpenGL

Is it possible using OpenGL? I am new in OpenGL.

在编辑头发图像之前



and after editing hair image like

因此图像从任何一侧以任何方式伸展。

So the image stretches from any side and in any way.

推荐答案

你能解释得更详细吗?你想用什么四边形?它们是简单的矩形还是正方形?或者它们有点像平行四边形,梯形,风筝或菱形那么复杂?

Can you explain more detailed? What quadrangles would you like to use? Are they simple rectangles or squares? Or they are a bit more complicated like parallelogram, trapezoid, kite or rhombus?

无论如何,将图像分割成您想要的任何四边形都很容易。通过告诉OpenGL关于图像坐标,你可以从你的图像得到任何四边形:glTexCoord2f(x,y)

Anyway it's easy to split an image into any quadrangles you want. You can get any quadrangle from your image by telling OpenGL about image coordinates: glTexCoord2f(x, y)

我忘了提到OpenGL中的图像加载了大小(1 .f,1.f)并且你的图片大小无关紧要你可以将它分成你想要的四边形。

I forgot to mention that image in OpenGL is loaded with size (1.f, 1.f) and it doesn't matter what size your picture is you can split it in as many as you want quadrangles.

有一个非常有用有关纹理映射的教程可能会让您的答案更加详细。另外,我建议你留意官方的OpenGL文档。

There is one very useful tutorial about texture mapping maybe there you get your answers more detailed. Also i recommend you to keep an eye on official OpenGL documentation.

祝你好运。

这篇关于在OpenGLES中将图像分割成一个小四边形网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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