English 中文(简体)
毫无丝质的纹质
原标题:Texture with nothing aroud

我画成一个纹理, 与框架缓冲绑在一起。 然后我用它来画一个矩形, 在那里可以移动它来查看纹理的特定区域 。

当我在画图的纹理之外时,我只想要一个颜色

我在 GL_TEXTURE_WRAP_S/GL_TEXTURE_WRAP_L 上尝试过

GL_MIRRORED_REPEAT 

GL_REPEAT \gt; 我纹理周围有颜色, 但重复的纹理太近了

GL_CLAMP_TO_EGDE

但它不是我想要的结果。

能帮我个忙吗?

xx(xx).(xx).(xx).(xx).(xx).(xx).).(xx(x).).(xx(x).).(xx(x).).).(x(x).).(x(x).).(x(x).).(x(x).).(x(x).).(x(x).).(x(x).).(x.).(x(x).).(x(x.).(x.).(x.).(x.).(x.).(x(x.).(x.).(x.).(x(x)。

最佳回答

我不是 IOS 开发者, 但您列出的边缘模式( 重覆、 镜像和夹子) 都是我所知道的关于支持的图形硬件, 所以我猜iPhone/ iPad GPUs 将会相似 。

如果可以的话, 使每个边框的纹理 1 像素更大( 例如, 使用 126x126 位图并将其粘贴到透明 128x128 纹理的中间), 并使用夹子作为边缘模式 。 但这不会导致尖锐的边缘, 因为双线内插仍然会发生 。

否则,你就得自己算算, 意思是,如果你的观察矩形 到达纹理的边框, 你必须调整四面形的坐标, 而不是仅仅调整它的纹理坐标,例如。

upperLeftQuad.U = viewRectangle.X / textureWidth;
if(upperLeftQuad.U < 0) {
  upperLeftQuad.X += -(upperLeftQuad.U * textureWidth);
  upperLeftQuad.U = 0;
}

upperRightQuad.U = (viewRectangle.X + viewRectangle.Width) / textureWidth
if(upperLeftQuad.U > 1) {
  upperLeftQuad.X -= (upperLeftQuad.U * textureWidth);
  upperLeftQuad.U = 1;
}
问题回答

暂无回答




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签