- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
所以,我正在尝试从 Qt Creator 中的 HelloWorldRender 片段编译代码。我希望能够做的只是单步执行调试器中的代码并对其进行修改,以便我可以了解如何使用它。
但是,问题是当我尝试构建项目时,出现了大量链接器错误(达到的最大错误计数超过 1400)。我几乎可以肯定原因是指定的库的顺序造成的。
值得一提的要点
对于那些不熟悉 QMake 的人:请注意,GCC 用于编译它; QMake 中指定的链接器顺序与 GCC 是一对一的。
我尝试了各种不同的链接顺序,其中一些甚至涉及重复列表中的某些库...我能够得到的最接近的错误计数约为 150。
HelloWorldSnippet 所需的一个库 (libRenderSnippetCHECKED.a
)(不是 SDK 的一部分)已编译,没有任何问题,并在要链接的库列表中指定。
这个项目的很多信息(要链接的库、定义)实际上都是通过在 Makefile 中搜索此代码片段并破译(显然)自动生成的代码行来获取的。
尽管 PhysX 看起来是一个流行的 API,但它的文档却...稀疏。我还没有找到任何真正描述如何在 Linux 环境中运行它的内容(公平地说,这个版本发布了大约 2 个月)。
使用的发行版是 Ubuntu 13.10。使用 Optimus 设置在 x86_64 架构上进行编译。
除了我的项目文件之外,为了方便起见,我还包含了未修改的 HelloWorld 文件。
.pro 文件
<小时/>TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
INCLUDEPATH += /opt/PhysX/Include \
/opt/PhysX/Include/characterkinematic \
/opt/PhysX/Include/cloth \
/opt/PhysX/Include/common \
/opt/PhysX/Include/cooking \
/opt/PhysX/Include/extensions \
/opt/PhysX/Include/foundation \
/opt/PhysX/Include/geometry \
/opt/PhysX/Include/particles \
/opt/PhysX/Include/physxprofilesdk \
/opt/PhysX/Include/physxvisualdebuggersdk \
/opt/PhysX/Include/pxtask \
/opt/PhysX/Include/vehicle \
/opt/PhysX/pvd \
/opt/PhysX/Snippets/SnippetRender
DEFINES += PHYSX_PROFILE_SDK \
RENDER_SNIPPET \
NDEBUG \
PX_CHECKED \
PX_SUPPORT_VISUAL_DEBUGGER
LIBS += -L/opt/PhysX/Lib/linux64
LIBS += -lPvdRuntimeCHECKED \
-lSimulationControllerCHECKED \
-lSceneQueryCHECKED \
-lLowLevelCHECKED \
-lLowLevelClothCHECKED \
-lSnippetRenderCHECKED \
-lPhysX3CHECKED \
-lPhysX3VehicleCHECKED \
-lPhysX3CookingCHECKED \
-lPhysX3ExtensionsCHECKED \
-lPhysX3CharacterKinematicCHECKED \
-lPhysXProfileSDKCHECKED \
-lPhysXVisualDebuggerSDKCHECKED \
-lPxTaskCHECKED \
-lPhysX3CommonCHECKED \
-lGL \
-lGLU \
-lglut \
-lX11 \
-lrt \
-lpthread
代码片段HelloWorld.cpp
<小时/>// This code contains NVIDIA Confidential Information and is disclosed to you
// under a form of NVIDIA software license agreement provided separately to you.
//
// Notice
// NVIDIA Corporation and its licensors retain all intellectual property and
// proprietary rights in and to this software and related documentation and
// any modifications thereto. Any use, reproduction, disclosure, or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA Corporation is strictly prohibited.
//
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Information and code furnished is believed to be accurate and reliable.
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
// information or for any infringement of patents or other rights of third parties that may
// result from its use. No license is granted by implication or otherwise under any patent
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
// This code supersedes and replaces all information previously supplied.
// NVIDIA Corporation products are not authorized for use as critical
// components in life support devices or systems without express written approval of
// NVIDIA Corporation.
//
// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#define PVD_HOST "127.0.0.1"
// ****************************************************************************
// This snippet illustrates simple use of physx
//
// It creates a number of box stacks on a plane, and if rendering, allows the
// user to create new stacks and fire a ball from the camera position
// ****************************************************************************
#include "PxPhysicsAPI.h"
#include <ctype.h>
#if defined(PX_PS3)
#include "PS3Init.h"
#endif
using namespace physx;
PxDefaultAllocator gAllocator;
PxDefaultErrorCallback gErrorCallback;
PxFoundation* gFoundation = NULL;
PxPhysics* gPhysics = NULL;
PxDefaultCpuDispatcher* gDispatcher = NULL;
PxScene* gScene = NULL;
PxMaterial* gMaterial = NULL;
PxVisualDebuggerConnection*
gConnection = NULL;
PxReal stackZ = 10.0f;
PxRigidDynamic* createDynamic(const PxTransform& t, const PxGeometry& geometry, const PxVec3& velocity=PxVec3(0))
{
PxRigidDynamic* dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, 10.0f);
dynamic->setAngularDamping(0.5f);
dynamic->setLinearVelocity(velocity);
gScene->addActor(*dynamic);
return dynamic;
}
void createStack(const PxTransform& t, PxU32 size, PxReal halfExtent)
{
PxShape* shape = gPhysics->createShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial);
for(PxU32 i=0; i<size;i++)
{
for(PxU32 j=0;j<size-i;j++)
{
PxTransform localTm(PxVec3(PxReal(j*2) - PxReal(size-i), PxReal(i*2+1), 0) * halfExtent);
PxRigidDynamic* body = gPhysics->createRigidDynamic(t.transform(localTm));
body->attachShape(*shape);
PxRigidBodyExt::updateMassAndInertia(*body, 10.0f);
gScene->addActor(*body);
}
}
shape->release();
}
void initPhysics(bool interactive)
{
gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback);
PxProfileZoneManager* profileZoneManager = &PxProfileZoneManager::createProfileZoneManager(gFoundation);
gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(),true,profileZoneManager);
if(gPhysics->getPvdConnectionManager())
{
gPhysics->getVisualDebugger()->setVisualizeConstraints(true);
gPhysics->getVisualDebugger()->setVisualDebuggerFlag(PxVisualDebuggerFlag::eTRANSMIT_CONTACTS, true);
gPhysics->getVisualDebugger()->setVisualDebuggerFlag(PxVisualDebuggerFlag::eTRANSMIT_SCENEQUERIES, true);
gConnection = PxVisualDebuggerExt::createConnection(gPhysics->getPvdConnectionManager(), PVD_HOST, 5425, 10);
}
PxSceneDesc sceneDesc(gPhysics->getTolerancesScale());
sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f);
gDispatcher = PxDefaultCpuDispatcherCreate(2);
sceneDesc.cpuDispatcher = gDispatcher;
sceneDesc.filterShader = PxDefaultSimulationFilterShader;
gScene = gPhysics->createScene(sceneDesc);
gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f);
PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial);
gScene->addActor(*groundPlane);
for(PxU32 i=0;i<5;i++)
createStack(PxTransform(PxVec3(0,0,stackZ-=10.0f)), 10, 2.0f);
if(!interactive)
createDynamic(PxTransform(PxVec3(0,40,100)), PxSphereGeometry(10), PxVec3(0,-50,-100));
}
void stepPhysics(bool interactive)
{
PX_UNUSED(interactive)
gScene->simulate(1.0f/60.0f);
gScene->fetchResults(true);
}
void cleanupPhysics(bool interactive)
{
PX_UNUSED(interactive)
gScene->release();
gDispatcher->release();
PxProfileZoneManager* profileZoneManager = gPhysics->getProfileZoneManager();
if(gConnection != NULL)
gConnection->release();
gPhysics->release();
profileZoneManager->release();
gFoundation->release();
printf("SnippetHelloWorld done.\n");
}
void keyPress(const char key, const PxTransform& camera)
{
switch(toupper(key))
{
case 'B': createStack(PxTransform(PxVec3(0,0,stackZ-=10.0f)), 10, 2.0f); break;
case ' ': createDynamic(camera, PxSphereGeometry(3.0f), camera.rotate(PxVec3(0,0,-1))*200); break;
}
}
#ifdef PX_XBOXONE
int main(Platform::Array<Platform::String^>^)
#else
int main(int, char**)
#endif
{
#ifdef RENDER_SNIPPET
extern void renderLoop();
renderLoop();
#else
static const PxU32 frameCount = 100;
initPhysics(false);
for(PxU32 i=0; i<frameCount; i++)
stepPhysics(false);
cleanupPhysics(false);
#endif
}
代码片段HelloWorldRender.cpp
<小时/>// This code contains NVIDIA Confidential Information and is disclosed to you
// under a form of NVIDIA software license agreement provided separately to you.
//
// Notice
// NVIDIA Corporation and its licensors retain all intellectual property and
// proprietary rights in and to this software and related documentation and
// any modifications thereto. Any use, reproduction, disclosure, or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA Corporation is strictly prohibited.
//
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Information and code furnished is believed to be accurate and reliable.
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
// information or for any infringement of patents or other rights of third parties that may
// result from its use. No license is granted by implication or otherwise under any patent
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
// This code supersedes and replaces all information previously supplied.
// NVIDIA Corporation products are not authorized for use as critical
// components in life support devices or systems without express written approval of
// NVIDIA Corporation.
//
// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifdef RENDER_SNIPPET
#include "PxPhysicsAPI.h"
#ifndef _HAS_EXCEPTIONS
#define _HAS_EXCEPTIONS 0
#endif
#include <vector>
#include "SnippetRender.h"
#include "SnippetCamera.h"
using namespace physx;
extern void initPhysics(bool interactive);
extern void stepPhysics(bool interactive);
extern void cleanupPhysics(bool interactive);
extern void keyPress(const char key, const PxTransform& camera);
namespace
{
Snippets::Camera* sCamera;
void motionCallback(int x, int y)
{
sCamera->handleMotion(x, y);
}
void keyboardCallback(unsigned char key, int x, int y)
{
if(key==27)
exit(0);
if(!sCamera->handleKey(key, x, y))
keyPress(key, sCamera->getTransform());
}
void mouseCallback(int button, int state, int x, int y)
{
sCamera->handleMouse(button, state, x, y);
}
void idleCallback()
{
glutPostRedisplay();
}
void renderCallback()
{
stepPhysics(true);
Snippets::startRender(sCamera->getEye(), sCamera->getDir());
PxScene* scene;
PxGetPhysics().getScenes(&scene,1);
PxU32 nbActors = scene->getNbActors(PxActorTypeSelectionFlag::eRIGID_DYNAMIC | PxActorTypeSelectionFlag::eRIGID_STATIC);
if(nbActors)
{
std::vector<PxRigidActor*> actors(nbActors);
scene->getActors(PxActorTypeSelectionFlag::eRIGID_DYNAMIC | PxActorTypeSelectionFlag::eRIGID_STATIC, (PxActor**)&actors[0], nbActors);
Snippets::renderActors(&actors[0], (PxU32)actors.size(), true);
}
Snippets::finishRender();
}
void exitCallback(void)
{
delete sCamera;
cleanupPhysics(true);
}
}
void renderLoop()
{
sCamera = new Snippets::Camera(PxVec3(50.0f, 50.0f, 50.0f), PxVec3(-0.6f,-0.2f,-0.7f));
Snippets::setupDefaultWindow("PhysX Snippet HelloWorld");
Snippets::setupDefaultRenderState();
glutIdleFunc(idleCallback);
glutDisplayFunc(renderCallback);
glutKeyboardFunc(keyboardCallback);
glutMouseFunc(mouseCallback);
glutMotionFunc(motionCallback);
motionCallback(0,0);
atexit(exitCallback);
initPhysics(true);
glutMainLoop();
}
#endif
最佳答案
由于提供的库是静态的并且具有循环依赖关系,因此您需要告诉链接器解决依赖关系。将 --start-group
和 --end-group
传递给 ld
应该可以解决问题。
LIBS += -Wl,--start-group \
-lPvdRuntimeCHECKED \
-lSimulationControllerCHECKED \
... \
-Wl,--end-group
我还将 NDEBUG
更改为 _DEBUG
,但其他一切看起来都不错。
关于linux - 如何让 Nvidia 的 PhysX 3.3 在 Linux 中链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22742736/
我有一个网站,并且我使用 javascript sdk 添加了“点赞”按钮。 这是代码 (function(d, s, id) { var js, fjs = d.g
我知道 HTML 是逐行读取的。当您链接多个 css 文件(如规范化文件和样式表文件)时,由于 CSS 重要性特异性和源顺序,样式表文件应链接在规范化文件之后。看起来这不会影响链接的 JavaScri
我正在使用官方 Bootstrap site 提供的 CDN 链接在我的网络应用程序中使用面板进行测试 在彻底检查我的代码后,面板没有显示。 但是我在 SO 上看到了类似的帖子并且 CDN 链接不同
这里是编码初学者。我正在尝试为我的移动设备网站设置断点,以便我的网站适合小屏幕。我只是想检查如果我缩小视口(viewport)的宽度,背景颜色是否会改变,但没有发生任何变化。也许我只是对一个简单的错误
举一个我想要的例子,想象一下这个字符串: $text = 'lorem ipsum About us lorem ipsum'; 如果此字符串包含一个 href 以 / 开头的 anchor 链接,则
如何链接到 LaTeX 文档的另一部分或子部分?这种链接的常规范式是什么,像[链接名称]那样写,或者像网页超链接那样写? 最佳答案 链接到另一个部分需要您的部分进行一些额外的标记。要使用的命令是: \
我有一个订单表,其中包含订单号、客户 ID 和代理 ID。然后有一个带有 id 的客户表和一个带有 id 的代理表。 我需要获取所有具有来自代理 ID 'a03' 和代理 ID 'a05' 的订单的客
假设我有: dic = {"z":"zv", "a":"av"} ## Why doesn't the following return a sorted list of keys? keys = d
我在尝试链接到外部库时得到了一些奇怪的结果。如果我从命令行运行以下命令: gcc fftwTest.c -I../extlib/fftw-3.3.5-dll32 -L../extlib/fftw-3.
我认为我没有正确理解 jQuery 链接。我正在遍历一个数组并尝试将 div 元素添加到我的包装器 CSS 类中,每个 div 元素都有一个“click”类和自定义 css top 和 left 属性
HTML 使用超级链接与网络上的另一个文档相连。几乎可以在所有的网页中找到链接。点击链接可以从一张页面跳转到另一张页面。 HTML 超链接(链接) HTML使用标签 a 来设置超文本链接。 超链
这个问题在这里已经有了答案: How do I link to part of a page? (hash?) (7 个答案) Scroll Automatically to the Bottom
我想创建一个 Docker Swarm 集群,运行一个 Elasticsearch 实例、一个 MongoDB 实例和一个 grails 应用程序,每个都在单独的机器上。我正在使用 Docker Ma
我正在尝试将 CakePHP HTML Linker 用于以下代码 Add Cuisine 由于 span 标签需要在 a 标签内。我无法根据需要获得输出。关于如何完成它的任何建议? 最佳答案 禁用链
大家好, 我最近开发了一个应用程序,很快就会提交到 App Store。我想免费提交这个应用程序,并想知道我是否可以实现一个带有 PayPal 捐赠标志的按钮,上面基本上写着“捐赠用于开发”或与此相关
我想尝试在 dlang 中使用 libuv。我下载了这样的 dlang 绑定(bind): git clone git@github.com:tamediadigital/libuv.git 现在我接
我有一个节点(节点 a),各种其他节点(节点 b/c/d/e)与之引用。 我可以创建一个带有参数的 View 作为我正在查看的节点(节点 a),并获取引用该节点的节点列表。 基本上在节点 a 查看节点
我正在尝试建立一个常见问题页面,上面有目录,下面有答案。我想点击目录中的一个问题,并在同一页面上链接到相应的答案。我如何在 CakePHP 中使用 $this->Html->link() 执行此操作方
在 WooCommerce 3.0+ 中,我使用 js 创建了一些选项卡,每个选项卡中包含来自不同类别的产品。我已经设法修改了简单产品的添加到购物车链接,其中点击了 addtocart 按钮它进入下一
Delphi 2007/2009 奇怪的问题在这里: 根据设计时定义的组件属性,是否可以在链接中包含文件或保留文件? 示例:如果我将 SomeProperty 保留为真,则在编译时,单元 SomeUn
我是一名优秀的程序员,十分优秀!