我期待一个类似于Windows API的Linux API.我在Google上看到的只是对Qt和GTK的引用.我真的不需要用OpenGL绘制一个简单的窗口,所以这些库看起来很臃肿供我使用.Qt和GTK用什么来在Linux下创建窗口?有没有更低级别的?
试图链接我用MinGW构建的静态assimp库.以下是我得到的错误:
H:\ ovgl\ovgl ...\dependencies\Assimp\lib\libassimp.a(BlenderLoader.cpp.obj):BlenderLoader.cpp :(.text + 0xd91):未定义引用
inflateInit2_' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(BlenderLoader.cpp.obj):BlenderLoader.cpp:(.text+0xe06): undefined reference to膨胀'H:\ ovgl\ovgl. ..\dependencies\Assimp\lib\libassimp.a(BlenderLoader.cpp.obj):BlenderLoader.cpp :(.text + 0xf72):未定义引用inflateEnd' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XGLLoader.cpp.obj):XGLLoader.cpp:(.text+0x76c): undefined reference toinflateInit2_'H:\ ovgl\ovgl ...\dependencies\Assimp\lib\libassimp.a(XGLLoader.cpp.obj):XGLLoader.cpp :(.text + 0x7ff):对inflate' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XGLLoader.cpp.obj):XGLLoader.cpp:(.text+0x953): undefined reference toinflateEnd'H:\ ovgl\ovgl ...\dependencies\Assimp\lib\libassimp.a(XFileParser )的未定义引用.cpp.obj):XFileParser.cpp :(.text + 0x9ac):未定义的引用inflateInit2_' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0xd5c): undefined reference to膨胀'H:\ ovgl\ovgl ...\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser .cpp :(.text + 0xed2):对inflateReset' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0xef8): undefined reference toinflateSetDictionary的未定义引用'H:\ ovgl\ovgl ...\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp :(.text + 0xf52):未定义的引用inflateEnd' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x1b4a): undefined reference toinflateInit2_'H:\ ovgl\ovgl ...\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp :(.text + 0x1efa):对inflate' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x2070): undefined reference to …
我觉得我有一个很棒的使用Vim进行C++编程的设置,但我找不到告诉Vim,YCM和Syntastic搜索标题的方法.每当我想在Makefile中存在此信息时想要处理项目时,必须手动设置Vim,YCM和Syntastic的包含路径变量会非常烦人.是否有用于设置全局包含路径的自动化解决方案?
编辑:如果我设置路径,它甚至找不到标题":set path =".,/ usr/include,include,../include,/ home/steven/ovgl/include ,,""
编辑:花了一点时间理解我写的代码后,我仍然不知道它有什么问题.这是我从中派生我的类的基类:
///ContactResultCallback is used to report contact points
struct ContactResultCallback
{
short int m_collisionFilterGroup;
short int m_collisionFilterMask;
ContactResultCallback()
:m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
m_collisionFilterMask(btBroadphaseProxy::AllFilter)
{
}
virtual ~ContactResultCallback()
{
}
virtual bool needsCollision(btBroadphaseProxy* proxy0) const
{
bool collides = (proxy0->m_collisionFilterGroup & m_collisionFilterMask) != 0;
collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
return collides;
}
virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObjectWrapper* colObj0Wrap,int partId0,int index0,const btCollisionObjectWrapper* colObj1Wrap,int partId1,int index1) = 0;
};
Run Code Online (Sandbox Code Playgroud)
现在这是我的派生类:
class DisablePairCollision : public btCollisionWorld::ContactResultCallback
{
public:
virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObject* …Run Code Online (Sandbox Code Playgroud) 我只是想做一个全屏游戏.我知道如何在Windows上更改分辨率,但如何在Linux下更改分辨率?是否有针对此的跨平台QT解决方案?我的GLWidget也有边框.如何使小部件覆盖整个窗口?
我只想发布代码:
#include <QtOpenGL>
class GLWidget : public QGLWidget
{
public:
void initializeGL()
{
glClearColor(0.0f, 0.0f, 1.0f, 0.0f);
glClearDepth(1.0f);
}
void paintGL()
{
glClear(GL_COLOR_BUFFER_BIT);
}
void resizeGL(int width, int height)
{
int side = qMin(width, height);
glViewport((width - side) / 2, (height - side) / 2, side, side);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5f, +0.5f, -0.5f, +0.5f, 4.0f, 15.0f);
glMatrixMode(GL_MODELVIEW);
}
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QDesktopWidget *desktop = app.desktop();
QWidget window;
GLWidget *glWidget = new GLWidget;
QHBoxLayout …Run Code Online (Sandbox Code Playgroud) 我正在使用一个平台/版本之间只有一个区别的库.一个版本调用类btCollisionObject,其他版本调用它btCollisionObjectWrapper.如果我可以使这个类有两个仍然引用该类的名称,那么我的所有问题都将得到解决.我试过了,#define btCollisionObject btCollisionObjectWrapper;但它不起作用.在定义类之后给出类两个名称的正确方法是什么?
我试图将sdl2纹理绑定到glsl着色器,虽然我不完全确定如何?我正在使用一个名为glfx的库来处理glsl着色器,我也一直在帮助开发这个库.我很确定我还有其他正确的东西,但是当我调用SDL_GL_BindTexture时它会崩溃.谁能看到我做错了什么?
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <GL/glew.h>
#include <GL/glfx.h>
#include <SDL2/SDL.h>
#include <FreeImage.h>
int main()
{
SDL_Window *mainwindow;
SDL_Renderer *renderer;
SDL_GLContext maincontext;
SDL_Init( SDL_INIT_VIDEO );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 2 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 24 );
SDL_CreateWindowAndRenderer( 512, 512, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN, &mainwindow, &renderer );
maincontext = SDL_GL_CreateContext( mainwindow );
glewExperimental = GL_TRUE;
glewInit( );
fprintf( stdout, "%s\n", glGetString(GL_VERSION) );
fprintf( stdout, "%s\n", glGetString(GL_SHADING_LANGUAGE_VERSION) );
FIBITMAP* dib …Run Code Online (Sandbox Code Playgroud) 我使用 cpack 创建了一个 deb 包,但它没有保留目标计算机上的原始权限。这导致我的应用程序的用户在安装后无法执行它。
我需要从我的插件目录中复制一个文件,但我不知道如何获取包含插件目录的字符串?我知道我的机器上安装了插件的位置,但我希望该插件可以在其他人的机器上运行,包括Windows.我该怎么做呢?
我对Linux和Linux上的编程都很陌生.我正在尝试在ubuntu上安装OpenAL SDK ...我最好的猜测是我需要从CVS repo下载OpenAL.我找到了一个教程:http://www.edenwaith.com/products/pige/tutorials/openal.php
但是,当我尝试运行终端命令时,会发生以下情况:
steven@ubuntu:~$ cvs -d:pserver:guest@opensource.creative.com:/usr/local/cvs-repository login
Logging in to :pserver:guest@opensource.creative.com:2401/usr/local/cvs-repository
CVS password:
cvs [login aborted]: connect to opensource.creative.com(124.246.64.74):2401 failed: No route to host
Run Code Online (Sandbox Code Playgroud)
有关如何安装OpenAL SDK的任何提示?
我一直在尝试让 OpenGL 3.2 工作时遇到问题,在花了几个小时试图找出问题所在后,我意识到它不支持 glBegin。我在我的引擎中使用该命令大约 50-100 次来绘制全屏四边形和 GUI 元素。那么用 OpenGL 3.2 绘制矩形的简单方法是什么?我真的必须创建一个顶点缓冲区、片段着色器和顶点着色器来做一些如此简单的事情吗?!
我已经尝试了一切让OpenGL 3.2在我的游戏引擎中使用CG着色器进行渲染,但我没有运气.所以我决定做一个简单的小项目,但仍然着色器不起作用.从理论上讲,我的测试项目应该只渲染一个红色三角形,但它是白色的,因为着色器没有做任何事情.
我会在这里发布代码:
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <GL/glew.h>
#include <Cg/cg.h>
#include <Cg/cgGL.h>
#include <SDL2/SDL.h>
int main()
{
SDL_Window *mainwindow;
SDL_GLContext maincontext;
SDL_Init(SDL_INIT_VIDEO);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
mainwindow = SDL_CreateWindow("Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 512, 512, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
maincontext = SDL_GL_CreateContext(mainwindow);
glewExperimental = GL_TRUE;
glewInit();
_CGcontext* cgcontext;
cgcontext = cgCreateContext();
cgGLRegisterStates(cgcontext);
CGerror error;
CGeffect effect;
const char* string;
std::string shader;
shader =
"struct VS_INPUT"
"{"
" float3 pos : ATTR0;"
"};"
"struct FS_INPUT" …Run Code Online (Sandbox Code Playgroud)