54

This question mentions that Unity will use nux as the toolkit.

What exactly is nux?

1 Answer 1

71

Nux is a OpenGL based widget toolkit and canvas used to create user interfaces, similar to GTK+. At a high level, nux is broken down into 3 libraries.

  • NuxCore
  • NuxGraphics
  • Nux

NuxCore is responsible for basic things like a type system, math functions, color definitions, etc. It basically provides all the primitive types for a widget system (color, rectangle, point). Very little logic is present here, this is a foundational library.

NuxGraphics is a thin OpenGL abstraction layer. It provides simplifications of common OpenGL patterns (pushing and popping clipping rectangles, changing render targets, state setting, etc), however it does not directly forbid users from making raw OpenGL calls themselves. NuxGraphics provides abstractions for textures and loading/unloading data.

Nux is a widget library implemented on top of NuxCore and NuxGraphics. Nux contains a duplicate for almost every major widget in the GTK stack as well as several composition widgets (color picker, graphs, 3d views). The Nux widgets are not yet at the same level of complexity as GTK widgets, lacking advanced text rendering (being fixed) and clear theming support.

Rendering inside of nux could be described as “canvas style”. Nux provides a painter to perform basic drawing primitives which can be used in addition to embedding other widgets. So rather than embedding an hbar to create a horizontal line, a widget author may, at their choice, use the painter to draw the bar directly. Images may also be rendered in this fashion, rather the embedding an additional widget simply to render a static non-reactive image. This does not however rule out simply embedding widgets.

In Unity nux is used in what we call “Embedded Mode”. Essentially nux provides a function for painting itself in a foreign open gl context. We call the paint function and nux blits itself onto the backbuffer. We can then continue to paint on top of it if we desire (sometimes we allow compiz to do this). There are functions provided to do opengl state management in embedded mode.

3
  • 1
    very informative, Jason. Thanks. Is there a link to where one can find more information?
    – S B
    Apr 16, 2011 at 21:22
  • Is there any aim to possibly "expand" Nux into a primary toolkit for Ubuntu the way that GTK+ is currently the "primary" toolkit? Aug 21, 2011 at 21:59
  • Ubuntu has been doing Flutter lately, like in the new installer. Nux seems to be used by the Unity team, unrelated to Canonical, AFAIK
    – MegaTux
    Jan 19, 2023 at 13:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .