小编Dan*_*ner的帖子

渲染到iOS上的纹理OpenGL ES可以在模拟器上运行,但不能在设备上运行

为了提高我的OpenGL ES应用程序在iPad上的性能,我计划在纹理上绘制一个很少更新但是渲染时重的元素,所以除非必须重新绘制元素,否则我可以使用纹理.但是,虽然纹理在模拟器和设备上都能正确映射,但只有在模拟器上才能实际渲染到纹理中.

以下是我添加到项目中的代码.在设置场景时,我创建了缓冲区和所需的纹理:

int width = 768;
int height = 270;

// Prepare texture for off-screen rendering.
glGenTextures(1, &wTexture);
glBindTexture(GL_TEXTURE_2D, wTexture);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE);
glClearColor(.9f, .3f, .6f, 1.0f); // DEBUG
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,
  GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_2D, 0);

// Depth attachment buffer, always needed.
glGenRenderbuffersOES(1, &wDepth);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, wDepth);
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES,
  width, height);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, 0);

// Create FBO for render-to-texture.
glGenFramebuffersOES(1, &wBuffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, wBuffer);
glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES,
  GL_COLOR_ATTACHMENT0_OES, …
Run Code Online (Sandbox Code Playgroud)

opengl-es render-to-texture ios

9
推荐指数
1
解决办法
5547
查看次数

Visual Studio 2010 C++:如何判断链接器实际尝试链接哪些 LIB 文件?

我正在 Visual Studio 2010 Pro 中处理一个(非托管的)x64 Win32 C++ 应用程序,并且不断收到一个奇怪的链接错误。

此应用程序LoadImage()通过包含windows.h. 虽然应用程序在 Release 配置中编译得很好(并LoadImage()完成了它的工作),但我无法在 Debug 配置中链接可执行文件。我不断收到此错误:

Redacted.obj : error LNK2019: unresolved external symbol __imp_LoadImageW referenced in function "public: int __cdecl Redacted::Redacted::Execute(void)" (?Execute@Redacted@Redacted@@QEAAHXZ)
C:\Users\redacted\Documents\Visual Studio 2010\Projects\Redacted\x64\Debug\Redacted.exe : fatal error LNK1120: 1 unresolved externals
Run Code Online (Sandbox Code Playgroud)

如果我从 Unicode 切换到非多字节字符集,错误消息会相应地从 更改LoadImageW()LoadImageA(),但否则会持续存在。由于我在 Release 和 Debug 配置的属性中找不到任何相关差异,我不知道为什么它会编译为一个,而不是另一个。在两种配置中都User32.lib正确设置为链接器的附加依赖项,并且/MACHINE:X64在两者中也设置了标志。

由于链接器不会抱怨找不到User32.lib,我相信它试图从 Platform SDK 链接错误的版本,即 32 位版本。但是我如何才能找出链接器实际尝试使用的 LIB 文件的确切副本?

linker visual-studio-2010 visual-c++-2010

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