IOS OpenGLES,在横向模式下剪切视频
我的应用程序(ios8.0)是使用Opengl es在GLKViewController中渲染流媒体视频 我有一个问题,视频是削减时,横向模式 问题捕获: 也许。。我需要缩放纹理,使用顶点着色器IOS OpenGLES,在横向模式下剪切视频,ios,opengl-es,opengl-es-2.0,scaling,landscape,Ios,Opengl Es,Opengl Es 2.0,Scaling,Landscape,我的应用程序(ios8.0)是使用Opengl es在GLKViewController中渲染流媒体视频 我有一个问题,视频是削减时,横向模式 问题捕获: 也许。。我需要缩放纹理,使用顶点着色器 typedef struct { float Position[3]; float Color[4]; float TexCoordp[2]; } Vertex; const Vertex Vertices[] = { {{1, -1, 0}, {1, 1, 1, 1}
typedef struct {
float Position[3];
float Color[4];
float TexCoordp[2];
} Vertex;
const Vertex Vertices[] = {
{{1, -1, 0}, {1, 1, 1, 1}, {1, 1}},
{{1, 1, 0}, {1, 1, 1, 1}, {1, 0}},
{{-1, 1, 0}, {1, 1, 1, 1}, {0, 0}},
{{-1, -1, 0}, {1, 1, 1, 1}, {0, 1}}
};
const GLubyte Indices[] = {
0, 1, 2,
2, 3, 0
};
#pragma mark - shaders
#define STRINGIZE(x) #x
#define STRINGIZE2(x) STRINGIZE(x)
#define SHADER_STRING(text) @ STRINGIZE2(text)
NSString *const vertexShaderString = SHADER_STRING
(
attribute vec4 Position; // 1
attribute vec4 SourceColor; // 2
varying vec4 DestinationColor; // 3
attribute vec2 TexCoordIn;
varying vec2 TexCoordOut;
void main(void) { // 4
DestinationColor = SourceColor; // 5
gl_Position = Position; // 6
TexCoordOut = TexCoordIn; // New
}
);
设置总帐代码
- (void)setupGL
{
[EAGLContext setCurrentContext:self.context];
glGenBuffers(1, &_vertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
glGenBuffers(1, &_indexBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices), Indices, GL_STATIC_DRAW);
// init the update render semaphore
_textureUpdateRenderSemaphore = dispatch_semaphore_create((long)1);
}
也许我需要更改“顶点”,但我找不到任何线索
非常感谢您的帮助i success scaling!!!!,但视频还是被剪掉了。也许“GLKView”无法更改横向模式。为什么不能改变GLKView…?令人惊讶的是,你仍然在与之抗争。你为什么不按照我告诉你的方式去做呢?这是最简单的方法:)在顶点着色器中放置一个矩阵,无需更改任何包装OpenGL viewi成功缩放的视图的方向!!!!,但视频还是被剪掉了。也许“GLKView”无法更改横向模式。为什么不能改变GLKView…?令人惊讶的是,你仍然在与之抗争。你为什么不按照我告诉你的方式去做呢?这是最简单的方法:)在顶点着色器中放置一个矩阵,无需更改任何包装OpenGL视图的视图的方向