Lately I've gotten the feeling that OpenGL is really going mainstream, including in KDE. We already have quite a few apps that are using it and it looks like more are coming.
However ATM many of those apps are reinventing the wheel by writing same generic code such as a texture class over and over again.
So I got the idea of creating some kind of KDE OpenGL library. It would have Qt-style API that KDE developers would be familiar with and would provide some common building blocks that would ease development of OpenGL apps. Right now I'm thinking texture and shader classes, maybe a camera class, some common functions, vector library (Eigen should be great for that) and perhaps an extension library (GLEW could be used). I don't want too many things though, it should still stay lightweight instead of becoming yet another fully featured 3d engine.
And it should be extensible. If your app needs e.g. cubemap textures, you should be able to write a CubemapTexture class that inherits from Texture class and provides necessary functionality. Such extensions could even be put into a common place so that other apps could copy them into their own source tree and use them without bloating the library.
The library probably needn't depend on KDE itself, just on Qt. This might make it interesting for pure Qt apps as well.
What do you think of that idea? Would you use such a library? Or know someone/something that might? Add your comments here.
Subscribe to:
Post Comments (Atom)
16 comments:
With the new openGL 3 !
http://www.opengl.org/
It's a good idea. It will work great wit kde-games!
Well, QGL allows the embedding of any OpenGL version and helper library afaik, so you can use QGL with OpenScenegraph, Irrlich, Ogre, CrystalSpace.
I'm not telling you your idea is bad. Your idea is great, but maybe it would be nice if you checked:
What's your library's purpose;
What KDE people are using (talk to kwin people of kwin-composite fame);
If there's already some library that fits the need and has an acceptable license to be linked to KDE.
Defining these steps is a good start. ;)
Thanks for mentioning Eigen. OpenGL apps are exactly the main target audience of Eigen, and we've been happy with Eigen in the Avogadro project. Since you mention the need for a Camera class, let me add that in avogadro we have a Eigen-based Camera class, most of which is general-purpose and could be extracted.
See the files here:
camera.h
camera.cpp
For an example of usage of Eigen and of the above Camera class, see the source code of Avogadro's navigation functions here.
taupter: I am one of the KWin people and that's how this idea got started :-)
In KWin we have our own texture and shader classes plus means of checking for OpenGL version and extensions.
About what KDE-people are already using - KWin and Krita are using their own custom stuff (although Krita is using GLEW for extensions). Amarok is using it's own stuff (they seem to only be getting started using GL but nonetheless). Kalzium/Avogadro are using Eigen but most of their GL code seems to be custom as well.
If there already is a nice library, I'd like to know but so far I haven't seen anything...
And QGL (if you mean Qt's OpenGL module) is far too limited. There are a few nice things but it's still to limited and not very extensible if you want more advanced stuff.
benoit: Thanks for the tip. About camera, I'm thinking rather something like
camera.setPosition(myPositionVector);
camera.setLookAt(myLookAtVector);
(similar to what you give to gluLookAt()), but I might use some of your code, e.g. the projection stuff looks interesting.
I definitely appreciate your work here, but I have to point out that KDELibs is in feature freeze. The reason for that is basically that developers should focus on fixing bugs and polishing already existing stuff.
You know, the things that people expect from KDE Apps :)
I may be completely misunderstanding you (hope so!), but I have to ask if you plan on helping the rest of the community getting 4.0 out the door as best we can?
Thanks!
Dear Rivo,
I was going to propose something like that for kdegameslib... team will probably kill me though :D But, if you will make such library I guess kdegames can benefit immensely. And, I'm sure, the rest of KDE projects as well.
it-s
I know about the freeze and _if_ this thing will go into kdelibs then it certainly wouldn't happen before 4.1.
I'm still continuing my work on polishing KWin for the 4.0 release, but I also want to start planning this thing and gathering ideas and opinions.
I would love to see something like coreaudio in mac os x. Its a wonderful tool.
I meant to say coreanimation, not coreaudio
Calc: iirc Trolltech is working at something like CoreAnimation for Qt 4.4. Slowly all pieces are coming together (QTimeLine being one of them).
You can have a look at QGLViewer http://artis.imag.fr/Software/QGLViewer/ which partially deals with what you mentioned (cameras, vectors, ....). This is really a great lib.
Would it be a low level library (some kind of wrapper to qt-ish API that feels like OpenGL) or it would have some greater abstraction (think of the Java3D API)?
In both cases, it would be something that is interesting for me to help making... Cheers!
QGLViewer doesn't seem to be quite what I'm looking for either. It looks like it has a different purpose and it doesn't have texture/shader classes either.
ivan: it wouldn't be very low-level. It would be object-oriented wrapper with a different (Qt-style) api, so you'd call it's methods instead of gl functions to manage textures/shaders/etc. Something like:
canera.setPosition(posVector);
camera.setLookAt(lookAtVector);
Texture tex("myfile.jpg");
tex.setFilter(GL_LINEAR);
tex.bind();
Shader shader("shader.vert", "shader.frag");
shader.bind();
shader.setUniform("frame", 0);
// do some rendering here
shader.unbind();
tex.unbind();
I'm not really familiar with Java 3d, so I can't compare.
And if you're interested, I'll let you know when the real development begins (probably not that soon though) :-)
Sorry, -1 this time.
I'd like to see a more complete
kwin-composite before, with plugins
"on-pair" with those of compitz, like
cube or the various animation.
Obviously this is just my $0.02
Ok, I'll send you my address by mail...
mat: as said before, I don't intend to sacrifice my KWin development time for this.
And if you want more KWin effects, why not try writing one yourself. We have a decent api for effects and if you run into problems you can ask for help in the kwin mailing list.
Post a Comment