QtCreator Autocomplete Not Showing Arguments For OpenGL Functions?
-
Updated again, I'd pointed wrong branch first. Thanks for patience.
-
[quote author="sergey-shambir" date="1364597789"]Updated again, I'd pointed wrong branch first. Thanks for patience.[/quote]
Thanks, but I still get the latter problem, where it says "Project ERROR: Unknown module(s) in QT: script" when compiling. I think it's because it's trying to use QT5 and the code is in QT4 or vice versa.
-
Hi, I added another comment to the AUR, which is the solution to the problem, could you please update it again? It's still compiling as we speak so I didn't get to test it yet.
EDIT: So it compiled, but when I opened it and tried to autocomplete the macro, (example: glBindBuffer), it still didn't give me argument completion.
EDIT2: Can you see if it works on your side? A simple application would be this:
@#include <GL/glew.h>
#include <GL/glfw.h>int main() {
glfwInit();
glfwOpenWindow(1024, 768, 0, 0, 0, 0, 0, 0, GLFW_WINDOW);glewExperimental = GL_TRUE; glewInit(); // Try auto completing a function here (ex: glBindBuffer, or glGenBuffers)
}@
-
ClangCodeModel plugin marked as experimental and disabled by default. Open Help->"About Plugins", find C++/ClangCodeModel and enable it.
-
Just tried enabling it, and restarting QtCreator, it doesn't work. I tried restarting several times and have no better results :/ I actually tried using clang in vim to give me auto complete and it doesn't work. I made a thread about this on StackOverflow too and the only solution was either #define GL_GLEXT_PROTOTYPES, or use OpenGL Loader Generator and use OpenGL in a namespace, which gave me argument completion. But the code was this: gl::BindBuffer(arg1, arg2), etc, and there was some exceptions such as GL_TRUE which was gl::TRUE_.
However I dislike this solution because when somebody else comes by and sees my code, it won't be in the format of how they did it. I want to be able to use the C syntax of OpenGL somehow and get argument completion.
The SO threads are here:
http://stackoverflow.com/questions/15260891/vim-clang-complete-doesnt-see-some-functions-of-opengl
and
Is there really no other choice but to live with having to #define GL_GLEXT_PROTOTYPES or using OpenGL in a C++ namespace? Using Visual Studio is an option, but that would mean that I would have to install Windows and use it from there, and then I would have to install a vim plugin to emulate vim keybindings. (It's just that using windows and it not being compatible with linux is what's holding me back, since I want things to be cross-platform, etc. I'm using cmake to build and compile my projects, but I want to program in vim and in linux or at least just in linux)
-
There are no such bug report in clang tracker, so your can add new wish :)
http://llvm.org/bugs/buglist.cgi?quicksearch=completion&list_id=36022
Does Visual Studio really resolves this trick correctly? If it does, methion this fact in your wish. Btw, using GL_GLEXT_PROTOTYPES is quite good solution.
-
[quote author="sergey-shambir" date="1364668473"]There are no such bug report in clang tracker, so your can add new wish :)
http://llvm.org/bugs/buglist.cgi?quicksearch=completion&list_id=36022
Does Visual Studio really resolves this trick correctly? If it does, methion this fact in your wish. Btw, using GL_GLEXT_PROTOTYPES is quite good solution.[/quote]
I don't really know if Visual Studio does, but many people seem to claim that it does. Also, I heard that GL_GLEXT_PROTOTYPES is a bad option compared to using GLEW, since when I go cross-platform and compile, it might not even compile on Mac OSX. And then I would have to create my own function pointers, etc. Also, apparently it won't work for anything past 1.1.
I guess I could live with defining GL_GLEXT_PROTOTYPES. I just need more info on it before I can decide on using it though.
Thanks.
-
How about to include glew.h and then include gl.h with conditional GL_GLEXT_PROTOTYPES on linux?
-
[quote author="sergey-shambir" date="1364673430"]How about to include glew.h and then include gl.h with conditional GL_GLEXT_PROTOTYPES on linux?[/quote]
Just tried it this:
@#include <GL/glew.h>
#ifdef unix
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include <GL/glext.h>
#endif@And it doesn't work, I still get no argument completion. However, if I do this:
@#ifdef unix
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include <GL/glext.h>
#endif#include <GL/glew.h>@
Then I do get argument completion, but obviously, this gives me errors. When I compile, it says this:
/usr/include/GL/glew.h:84:2: error: #error gl.h included before glew.h
/usr/include/GL/glew.h:90:2: error: #error glext.h included before glew.h -
my current solution is:
@
#ifndef COUNTER//qt creator cannot parse this
#define GL_GLEXT_PROTOTYPES
#include <GL/glcorearb.h>//never compile this
#endif
@change the gl-file to your header in use, e. g. »gl.h«
-
I've used the solution from darklighter to create a little header file.
You can include it instead of glew.h to get argument completion together with glew in qtCreator.@//include glew.h (argument completion only in linux qtcreator)
#ifndef COUNTER
#ifdef unix
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glew.h>
#endif
#else
#include <GL/glew.h>
#endif@This works fine for me. :)