Jump to content
  • Advertisement

Jan Wassenberg

  • Content count

  • Joined

  • Last visited

Community Reputation

999 Good

About Jan Wassenberg

  • Rank
  1. Jan Wassenberg

    Wonderfully simple OpenGL UI

    Minor rendering update per feedback received (thanks!).. Radio button+slider larger, more corner rounding, different accent color.
  2. Jan Wassenberg

    Wonderfully simple OpenGL UI

    Let's see how far we can get talking about the interface :) Ooh, that's a pretty one. Looks like three different modes - main menu as extruded 3d text, then the oblique view, then the white 2d one for actually entering text. It's easy enough to get something like the second one by rendering the UI output to texture and incorporating that into some other scene. I'm more interested in `serious' apps that don't need fancy presentation, though. Controller button input is easily supported by calling Interaction::OnKeyDown with a real or fake corresponding SDL key code. "other filed"? You mean whether any data files are necessary? The font renderer has a binary blob that's bundled with the executable (on Linux, it'd be a standalone file), same for the shaders. If you want ALL buttons to look different, that's an easy change in Painter::DrawButton and Layout::ButtonSize (if you're also changing the default size). This is probably debatable, but I prefer separating size, presentation and control logic. What's the use case for switching shaders? Here's the code that drives the demo UI. It's simple enough that auto-generation of code is not necessary :D Note the standard IMGUI if (Button()) { it_was_clicked; } pattern. static void DoUI(Interaction& p_Interaction, Canvas& p_Canvas, TextPainter& p_TextPainter) { Layout layout(p_Interaction.windowSize); Painter painter(p_Canvas, p_TextPainter); UI ui(p_Interaction, layout, painter, p_TextPainter); layout.BeginGroup(GROUP_LEFT_DOWNWARDS); static bool showOptions = true; ui.CheckBox(L"Show options", showOptions); if (showOptions) { layout.BeginGroup(GROUP_TOP_RIGHTWARDS | GROUP_NO_MARGIN); static bool enableBlending = true; ui.CheckBox(L"Enable blending", enableBlending); if (enableBlending) { static float value = 4.0f; ui.Slider(1.0f, 16.0f, value); } layout.EndGroup(); std::vector<UString> labels; labels.push_back(L"YCoCg-DXT5"); labels.push_back(L"DXT1"); labels.push_back(L"RGBA"); static int listSelected = 0; ui.ListBox(&labels[0], labels.size(), listSelected); layout.BeginGroup(GROUP_TOP_RIGHTWARDS); ui.Label(L"Format"); static int formatIdx; ui.ComboBox(&labels[0], labels.size(), formatIdx); layout.EndGroup(); } layout.EndGroup(); if (showOptions) { layout.BeginGroup(GROUP_RIGHT_DOWNWARDS); static bool panelUnfold = true; if (ui.BeginPanel(L"Panel", panelUnfold, GROUP_DEFAULT)) { static int selected; ui.RadioButton(L"Radio1", 0, selected); ui.RadioButton(L"Radio2", 1, selected); static bool checked1, checked2; ui.CheckBox(L"Check1", checked1); ui.CheckBox(L"Check2", checked2); ui.EndPanel(); } if (ui.Button(L"Do things")) { SDL_Log("clicked\n"); } static UString buf(L"edit box"); ui.LineEdit(buf); layout.EndGroup(); } p_Canvas.Draw(); }
  3. Here's a brief writeup of a simple (9 KLOC, 340 KB binary) but capable and portable OpenGL GUI: http://wassenberg.dreamhosters.com/blog/2014-05-17/wonderfully-simple-gui/   Obligatory screenshot: [attachment=21585:ui.png]   Header files are attached: [attachment=21584:ui_headers.zip]   I'd love to get a discussion going on any perceived shortcomings of this approach, missing features, alternative libraries that didn't show up in my search, and your thoughts in general.
  4. Yes, those cases (as well as restricted process affinity) would be detected - if a core/logical processor isn't running/available, its APIC ID will not be counted. Unfortunately I don't remember which of the Windows functions returned inaccurate information. I would advise against the use of GetLogicalProcessorInformation, though - its interface is just about as complex as digging through the APIC IDs and it cannot be relied upon to differentiate logical processors vs cores.
  5. Unfortunately I've even seen the OS (Windows, not sure which version) lie about this. I believe any code that does not look at the APIC IDs (this apparently including libcpuid, after a quick browse) is completely broken in that respect. Intel has long said APIC IDs are not necessarily contiguous (0..#enabled-1). However, even the package/core/logical fields extracted with their recommended algorithm are not contiguous - you might see coreID = {0,1,6,7}. Here's my best attempt at getting it right, successfully tested on some interesting hardware (up to 64 processors) - http://trac.wildfire...64/topology.cpp
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!