简体   繁体   English

编写启用OpenGL的GUI

[英]Writing OpenGL enabled GUI

I am exploring a possibility to write a kind of a notebook analogue that would reproduce the look and feel of using a traditional notebook, but with the added benefit of customizing the page in ways you can't do on paper - ask the program to lay ruled paper here, grid paper there, paste an image, insert a recording from the built-in camera, try to do handwriting recognition on the tablet input, insert some latex for neat formulas and so on. 我正在探索编写一种笔记本模拟物的可能性,该模拟物可以重现使用传统笔记本的外观和感觉,但是具有以您无法在纸上完成的方式自定义页面的额外好处-请让程序进行排版在此处放置格纹纸,在此处放置网格纸,粘贴图像,从内置相机插入记录,尝试在数位板输入上进行手写识别,为纯净配方插入一些乳胶等。 I'm pretty interested in developing it just to see if writing notes on computer can come anywhere close to the comfort plain paper + pencil offer (hard to do IMO) and can always turn it in as a university C++ project, so double gain there. 我对开发它很感兴趣,只是想看看在计算机上书写笔记是否可以接近舒适的普通纸+铅笔报价(很难做到IMO),并且可以始终将其作为大学C ++项目提交,因此在那里倍增。

Coming from the type of project there are certain requirements for the user interface: 根据项目类型,用户界面有一些要求:

  • the user will be able to zoom, move and rotate the notebook as he wishes and I think it's pretty sensible delegate it to OpenGL, so the prospective GUI needs to work well with OGL (preferably being rendered in it) 用户将能够根据自己的意愿缩放,移动和旋转笔记本电脑,我认为将其委托给OpenGL是非常明智的,因此预期的GUI需要与OGL配合使用(最好在其中进行渲染)
  • the interface should be navigable with as little of keyboard input as user wishes (incorporating some sort of gestures maybe) up to limiting the keyboard keys as modifiers to the pen movements and taps; 该界面应可导航,用户输入的键盘输入应尽可能少(可能会包含某种手势),直到将键盘按键限制为笔的移动和点击的修改器为止; this includes tablet and possible multitouch support 这包括平板电脑和可能的多点触控支持
  • the interface should keep out of the way where not needed and come up where needed and be easily layerable 该接口应远离不必要的地方,并在需要的地方出现,并易于分层
  • the notebook sheet itself will be a container for objects representing the notebook blurbs, so it would be nice if the GUI would be able to overlay some frames over the exact parts of the OpenGL-drawn sheet to signify what can be done with given part (like moving, rotating, deleting, copying, editing etc.) and it's extents 笔记本工作表本身将是代表笔记本blurb的对象的容器,因此,如果GUI能够在OpenGL绘制的工作表的确切部分上覆盖一些帧以表示可以用给定部分完成操作,这将是很好的选择(例如移动,旋转,删除,复制,编辑等)及其范围

In terms of interface it's probably going to end up similar to Alias' Sketch Book Pro: picture . 在界面方面,它最终可能会类似于Alias的Sketch Book Pro: picture

As far as toolkits go I'm considering Qt and nui, but I'm not really aware how well would they match up the requirements and how well would they handle such an application. 就工具包而言,我正在考虑Qt和nui,但我真的不知道它们将如何满足需求以及它们将如何处理这样的应用程序。
As far as I know you can somehow coerce Qt into doing widget drawing with OpenGL, but on the other hand I heard voices it's slot-signal framework isn't exactly optimal and requires it's own preprocessor and I don't know how hard would be to do all the custom widgets I would need (say color-wheel, ruler, blurb frames, blurb selection, tablet-targeted pop-up menu etc.) in the constraints of Qt. 据我所知,您可以以某种方式强迫Qt使用OpenGL进行小部件绘制,但是另一方面,我听到声音说它的插槽信号框架并不是完全理想的,并且需要它自己的预处理器,我不知道这样做会有多困难。在Qt约束中完成我需要的所有自定义小部件(例如色轮,标尺,blurb框架,blurb选择,以平板电脑为目标的弹出菜单等)。 Also quite a few Qt programs I've had on my machine seemed really sluggish, but it may be attributed to me having old PC or programmers using Qt suboptimally rather to the framework itself. 同样,我在计算机上安装的许多Qt程序似乎确实很慢,但这可能是由于我的旧PC或程序员次优地使用Qt而不是框架本身造成的。
As for nui ( http://www.libnui.net/ ) I know it's also cross-platform and all of the basic things you would require of a GUI toolkit and what is the biggest plus it is OpenGL-enabled from the start, but I don't know how it is with custom widgets and other facets and it certainly has smaller userbase and less elaborate documentation than Qt. 至于nui( http://www.libnui.net/ ),我知道它也是跨平台的,并且是GUI工具包所需的所有基本功能,最大的优点是从一开始就支持OpenGL,但是我不知道自定义窗口小部件和其他方面的情况如何,并且与Qt相比,它的用户群更小,文档也更少。

The question goes as this: 问题是这样的:

Does any of these toolkits fulfill (preferably all of) the requirements or there is a well fitting toolkit I haven't come across or maybe I should just roll up my sleeves, get SFML (or maybe Clutter would be more suited to this?) and something like FastDelegates or libsigc++ and program the GUI framework from the ground up myself? 这些工具箱中的任何一个是否都能满足(最好是全部)要求,或者有一个我还没有遇到过的合适的工具箱,或者我应该只是袖手旁观,获得SFML(或者Clutter会更适合于此?)以及诸如FastDelegates或libsigc ++之类的东西,然后自己从头开始编写GUI框架?
I would be very glad if anyone had experience with a similar GUI project and can offer some comments on how well these toolkits hold up or is it worthwhile to pursue own GUI toolkit in this case. 如果有人在类似的GUI项目上有过丰富的经验,并且可以就这些工具包的使用情况提出一些意见,或者在这种情况下值得拥有自己的GUI工具包,我将感到非常高兴。

Sorry for longwindedness, duh. 不好意思,老兄。

Have you tried FLTK ? 您尝试过FLTK吗? It is made with 3D graphics programming in mind and has interfaces to OpenGL. 它是根据3D图形编程制作的,并具有OpenGL的接口。 I wrote some FLTK->Scheme bindings and found the API to be real fun to work with . 我写了一些FLTK-> Scheme绑定,发现使用该API非常有趣

OpenGL font support is terrible, in my experience. 以我的经验,OpenGL字体支持非常糟糕。 It sounds like you're going to have to develop all your own custom widgets anyway so don't even bother with a toolkit. 听起来您无论如何都必须开发自己的所有自定义小部件,因此甚至不必为工具包而烦恼。 You'll spend more time learning the toolkit, trying to figure out how to get that toolkit to work with OpenGL, and and trying to figure out how to make your special widgets in that toolkit than you will just rolling your own. 您将花费更多的时间来学习该工具箱,试图弄清楚如何使该工具箱与OpenGL一起使用,并试图弄清如何在该工具箱中制作特殊的小部件,而不仅仅是滚动自己的工具。 I wouldn't give this advice in just any situation but it sounds like your application and your widget set is going to be very unique. 我不会在任何情况下都提供此建议,但听起来您的应用程序和小部件集将非常独特。 Make a superclass for all widgets, define a draw method, even handler methods, etc., for override, and you've already done most of what those frameworks would do for you. 为所有小部件做一个超类,定义一个draw方法,甚至是handler方法等,以进行覆盖,您已经完成了那些框架为您所做的大部分工作。

Also I'm sure you know this but this is an enormous project so you should initially narrow it down to a few simple objectives for a first iteration. 另外,我确定您知道这一点,但这是一个巨大的项目,因此您应该首先将其范围缩小到几个简单的目标,以便进行第一次迭代。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM