Jump to content

  • Log In with Google      Sign In   
  • Create Account


Jan Wassenberg

Member Since 16 Sep 2002
Offline Last Active Aug 01 2014 06:38 AM

Posts I've Made

In Topic: Wonderfully simple OpenGL UI

18 May 2014 - 10:35 AM

Minor rendering update per feedback received (thanks!)..

Radio button+slider larger, more corner rounding, different accent color.


In Topic: Wonderfully simple OpenGL UI

17 May 2014 - 12:29 PM

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();
}

In Topic: Has anyone got a simple cpuid class to share?

14 June 2012 - 04:53 AM

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.

In Topic: Has anyone got a simple cpuid class to share?

12 June 2012 - 06:51 PM

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

In Topic: New Tech for the win!

13 March 2011 - 02:33 PM

Patents are publically available as part of the whole process; you cant patent anything behind closed doors. So give us a few examples, or STFU.

Bullshit. German, UK and US patent laws - and certainly others - provide for `secret' patents/applications under rather loosely defined circumstances. See http://www.ipo.gov.u...ecuritylist.pdf for examples; in Germany, it's basically "whenever the exterior safety of the Federal Republic might be negatively affected".

Rethoric such as yours is of the same type of creepy as talk of 'final solutions'. Except of course that yours is fashionable.

Thank you for proving Godwin right yet again. I don't intend to dignify further ridiculous comments along those lines with a reply.

You know better....

Sadly, it's not apparent he does.

PARTNERS