在窗口的特定区域中创建GLX上下文 [英] Create GLX context in specific region of a window

查看:69
本文介绍了在窗口的特定区域中创建GLX上下文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在窗口内使用GLX创建OpenGL上下文.但是,我不希望它跨越整个窗口区域.相反,它应该只覆盖一个子区域.

I would like to create an OpenGL context with GLX inside a window. However, I do not want it to span over the whole window region. Instead, it should only cover a subregion.

例如,GLUT为此功能提供了一个功能.同样,诸如GTK +或QT之类的主要工具包也提供了GL小部件,它们只是X窗口的子区域.但是我需要低级工作.

For example, GLUT provides a function for this behaviour. Also major toolkits like GTK+ or QT provide GL widgets, which are only subregions of X windows. However I need to work low-level.

glXMakeCurrent()接受X Drawable标识符.是否可以将Drawable定义为窗口的子区域?还是有其他方法将上下文绑定到窗口区域?

glXMakeCurrent() accepts a X Drawable identifier. Is it possible to define a Drawable as being a subregion of a window? Or are there other ways to bind the context to a window region?

GLX参考(蓝皮书)

添加了超棒的赏金!

推荐答案

我在 BSD联机帮助页:

在几乎所有对您而言重要的方面,子窗口都像一个顶层窗口.它有一个窗口ID.它有自己的事件回调集;您可以渲染它;通知您其创建;...

In almost every regard that is important to you, a subwindow is like a top-level window. It has a window id; it has its own set of event callbacks; you can render to it; you are notified of its creation; ...

子窗口位于其他窗口(可能是顶层窗口,可能还有另一个子窗口)内.因此,它通常仅与您自己创建的其他窗口交互,因此不受窗口管理器的影响.这是与顶级窗口不同的主要来源:

A subwindow lives inside of some other window (possibly a top-level window, possibly another subwindow). Because of this, it generally only interacts with other windows of your own creation, hence it is not subjected to a window manager. This is the primary source for its differences from a top-level window:

因此,我假设流行的工具箱中的GL小部件实际上也充当了一个单独的(子)窗口.有趣的是,这对窗口管理器和用户都是透明的.

So I assume that GL widgets in popular toolkits also act in fact as a distinct (sub)window. The interesting part is that this is transparent to the window manager, and therefore the user.

这篇关于在窗口的特定区域中创建GLX上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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