小编abi*_*bix的帖子

如何在iPhone上的OpenGL ES 2.0中混合使用不同坐标的两个纹理?

当两个纹理覆盖相同的矩形时,我可以在片段着色器中混合使用不同混合模式的两个纹理.但现在我的问题是,一个纹理是一个没有旋转的普通矩形,另一个纹理是另一个具有旋转/缩放和平移的矩形.如何以我想要的方式合并这些纹理?(在图片里)

我知道怎么做......

在此输入图像描述

但不知道该怎么做......

在此输入图像描述

为了在一个矩形(第一个图像)中混合纹理,我使用了以下代码..

目标C代码......

- (void) display {
    [EAGLContext setCurrentContext:context];

    glBindFramebuffer(GL_FRAMEBUFFER, targetFBO);

    glUseProgram(program);

    glActiveTexture(GL_TEXTURE2);
    glBindTexture(GL_TEXTURE_2D, textureTop);

    glActiveTexture(GL_TEXTURE3);
    glBindTexture(GL_TEXTURE_2D, textureBot);

    glUniform1i(inputTextureTop, 2);
    glUniform1i(inputTextureBot, 3);

    glUniform1f(alphaTop, alpha);

    glEnable (GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    glVertexAttribPointer(position, 2, GL_FLOAT, 0, 0, imageVertices);
    glVertexAttribPointer(inputTextureCoordinate, 2, GL_FLOAT, 0, 0, textureCoordinates);

    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT);

    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

    glBindRenderbuffer(GL_RENDERBUFFER, viewRenderbuffer);
    [context presentRenderbuffer:GL_RENDERBUFFER];
}
Run Code Online (Sandbox Code Playgroud)

顶点着色器......

 attribute vec4 position;
 attribute vec4 inputTextureCoordinate;

 varying vec2 textureCoordinate;

 void main()
 {
    gl_Position = position;
    textureCoordinate = inputTextureCoordinate.xy;
 }
Run Code Online (Sandbox Code Playgroud)

片段着色器......

varying highp vec2 textureCoordinate; …
Run Code Online (Sandbox Code Playgroud)

iphone textures opengl-es ios opengl-es-2.0

9
推荐指数
2
解决办法
5045
查看次数

XCode 4.6 组织者不象征我的应用程序崩溃堆栈跟踪

自从我在 XCode 中使用符号化已经有一段时间了,它曾经可以工作。今天当我尝试这个...

  1. 存档我的应​​用程序。
  2. 从 XCode 在我的设备上安装该应用程序。(只需连接设备并在发布模式下运行应用程序)。
  3. 从 Xcode 停止应用程序。
  4. 在我的设备(连接到 Mac)上运行应用程序,当然它崩溃了。
  5. 现在,当我打开管理器并转到设备日志时,它会显示一个新的崩溃日志文件。
  6. 但它无法象征我的应用程序的符号。所有 Apple 图书馆的东西都被象征性地很好。

我搜索了整个网络,似乎没有任何效果。

编辑:在构建设置中,如果我禁用“复制期间剥离调试符号”,即使对于发布版本,一切正常。但是我猜 Xcode 应该能够使用 dSYM 文件进行符号化。我不想分发带有调试符号的应用程序。

提前致谢。

crash xcode organizer symbolicate ios

5
推荐指数
1
解决办法
5307
查看次数

如何为 IWICBitmap 创建 ID2D1DeviceContext?(对于 C++ 中的 Metro 应用程序)

我可以使用以下代码为 IWICBitmap 创建 ID2D1RenderTarget...

    D2D1_FACTORY_OPTIONS options;
    ZeroMemory(&options, sizeof(D2D1_FACTORY_OPTIONS));

#if defined(_DEBUG)
     // If the project is in a debug build, enable Direct2D debugging via SDK Layers
    options.debugLevel = D2D1_DEBUG_LEVEL_INFORMATION;
#endif

    ThrowIfFailed(D2D1CreateFactory(
            D2D1_FACTORY_TYPE_SINGLE_THREADED,
            __uuidof(ID2D1Factory1),
            &options,
            &m_d2dFactory
            ));

    D2D1_RENDER_TARGET_PROPERTIES props;
    props = D2D1::RenderTargetProperties();
    m_d2dFactory->CreateWicBitmapRenderTarget(m_pTheBitmap.Get(), &props, &m_target);
Run Code Online (Sandbox Code Playgroud)

但如果我想将 ID2D1Effect 应用于此位图,只有当我有 ID2D1DeviceContext 时才可以这样做。如何获取 IWICBitmap 的 ID2D1DeviceContext?

c++ direct2d microsoft-metro windows-8

3
推荐指数
1
解决办法
1529
查看次数