如何在Linux中使用C ++创建窗口? [英] How do you create a window in Linux with C++?

查看:860
本文介绍了如何在Linux中使用C ++创建窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待一个类似于Windows API的Linux API。我在Google上看到的所有内容都是Qt和GTK的引用。我真的不需要任何东西,只是一个简单的窗口来绘制OpenGL,所以这些库显得blo肿我的使用。 Qt和GTK在Linux下使用什么来创建窗口?有没有更多的低级?

I was expecting a Linux API similar to the Windows API. All I see on Google is references to Qt and GTK. I really don't need anything more than a simple window to draw on with OpenGL, so these libraries appear bloated for my use. What do Qt and GTK use to create windows under Linux? Is there nothing more low-level?

推荐答案

X窗口系统通常做绘图 - 然后使用一个工具包如Qt或GTK在原始Xlib之上,以提供事件循环,拖放,在mouseclicks和所有其他桌面设备上启动应用程序

The X window system generally does the drawing - you then use a toolkit such as Qt or GTK on top of raw Xlib to provide event loops, drag and drop, starting apps on mouseclicks and all the other 'desktop' stuff

这是相当容易直接工作 Xlib和opengl ,或者如果您只想学习opengl的 glut 提供了显示窗口,处理鼠标/键盘事件等所需的框架。

It's fairly easy to work directly with Xlib and opengl or if you just want to learn opengl the glut provides the framework you need to display a window, handle mouse/keyboard events and so on.

这篇关于如何在Linux中使用C ++创建窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆