Giter Club home page Giter Club logo

nanogui-sdl's People

Contributors

adamdharrison avatar akuskis avatar areascout avatar crystalline avatar dalerank avatar dangroom avatar evg503 avatar iysheng avatar jlblancoc avatar nhthn avatar siredmar avatar soldy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nanogui-sdl's Issues

CPU and memory leak

example1 eats about 10M/s real memory and about 700M/s Virtual
and and CPU busy >110%

How to compile and use this library if I clone it into a subdirectory?

I have this simple SDL application, with snippets of example2.cpp thrown in:

#include "SDL.h"
#include <SDL_opengl.h>
#include <nanogui/screen.h>
#include <nanogui/window.h>
#include <nanogui/layout.h>
#include <nanogui/label.h>
#include <nanogui/checkbox.h>
#include <nanogui/button.h>
#include <nanogui/toolbutton.h>
#include <nanogui/popupbutton.h>
#include <nanogui/combobox.h>
#include <nanogui/progressbar.h>
#include <nanogui/entypo.h>
#include <nanogui/messagedialog.h>
#include <nanogui/textbox.h>
#include <nanogui/slider.h>
#include <nanogui/imagepanel.h>
#include <nanogui/imageview.h>
#include <nanogui/vscrollpanel.h>
#include <nanogui/colorwheel.h>
#include <nanogui/graph.h>
#include <nanogui/formhelper.h>
#include <iostream>

using namespace nanogui;


enum test_enum {
    Item1 = 0,
    Item2,
    Item3
};

int main(int, char**)
{
    SDL_Window* window = SDL_CreateWindow("test",  SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_SHOWN);
   SDL_Renderer* render = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
    SDL_Event* event = new SDL_Event();
    bool quit = false;

    bool bvar = true;
    int ivar = 12345678;
    double dvar = 3.1415926;
    float fvar = (float)dvar;
    std::string strval = "A string";
    test_enum enumval = Item2;
    Color colval(0.5f, 0.5f, 0.7f, 1.f);
    int winWidth = 1024;
    int winHeight = 768;

    Screen *screen = new Screen( window, Vector2i(winWidth, winHeight), "NanoGUI test");

    bool enabled = true;
    FormHelper *gui = new FormHelper(screen);
    ref<Window> rwindow = gui->addWindow(Eigen::Vector2i(10, 10), "Form helper example");
    gui->addGroup("Basic types");
    gui->addVariable("bool", bvar);
    gui->addVariable("string", strval);
    gui->addGroup("Validating fields");
    gui->addVariable("int", ivar);
    gui->addVariable("float", fvar);
    gui->addVariable("double", dvar);
    gui->addGroup("Complex types");
    gui->addVariable("Enumeration", enumval, enabled)
       ->setItems({"Item 1", "Item 2", "Item 3"});
    gui->addVariable("Color", colval);
    gui->addGroup("Other widgets");
    gui->addButton("A button", [](){ std::cout << "Button pressed." << std::endl; });
    screen->setVisible(true);
    screen->performLayout();
    rwindow->center();

    while(!quit && event->type != SDL_QUIT) {
        SDL_PollEvent(event);
        SDL_RenderClear(render);

        if (event->type == SDL_KEYDOWN) {
            switch(event->key.keysym.sym) {
                case SDLK_ESCAPE:
                    quit = true;
                    break;
                default:
                    break;
            }
        }

        SDL_RenderPresent(render);
    }

    return 0;
}

My folder structure is:

app/
    test2.cpp
    libs/
        nanogui-sdl/

What's the correct g++ command to compile and run test2.cpp? I tried many things but they all error.

Screen overlapping issues

Please see this gist i've prepared fore a minimalistic code example that shows the bahaviour: https://gist.github.com/siredmar/bbdc71084cd7b33e0d14a9bf51244e2e

I want to create an application that sits directly on a SDL2 window. Currently i don't want to make this windows thing within the SDL2 window. Basically what i need is to place widgets directly on the screen.
This works pretty good, however i have a problem switching nanogui screen contexts.

The minimalistic example above shows basically what i wish to do.

This is screen1 in action:

image

Pressing on screen1 at Button 1 opens screen2.

image

Then pressing on screen2 at Back button closes screen2 and opens back screen1.
image

However, the controls on screen1 don't react to anything.
This is my problem.

core dump when clicking on number fields

In either example1 or example2, if I click on any number field, the core dumps with the error:
Caught exception in event handler: regex_error

I compiled this using gcc (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4

BTW: the same thing happens with the original nanogui code and that code compiles without warnings or errors

Also, I had to add the following include to picogui.h to get it to compile:

include .

Otherwise I got this error:

nanogui-sdl/src/picogui.cpp:2854:1: error: ‘map’ in namespace ‘std’ does not name a type
std::map<SDL_Window *, Screen *> __nanogui_screens;

Rendering of existing SDL_Surface

If one might intergrate this into an existing application which does currently render to a SDL_Surface, is there a way to render this existing SDL_Surface within nanogui-sdl?
Or in other words: does currently any widget support putting an existing SDL_Surface onto it?

example1 fails with GLSL 3.30 is not supported

I compiled the project and then ran ./example1, but it errors out with:

Error while compiling vertex shader "ImageViewShader":
#version 330
        uniform vec2 scaleFactor;
        uniform vec2 position;
        in vec2 vertex;
        out vec2 uv;
        void main() {
            uv = vertex;
            vec2 scaledVertex = (vertex * scaleFactor) + position;
            gl_Position  = vec4(2.0*scaledVertex.x - 1.0,
                                1.0 - 2.0*scaledVertex.y,
                                0.0, 1.0);

        }

Error: 
0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES

terminate called after throwing an instance of 'std::runtime_error'
  what():  Shader compilation failed!
Aborted

Compiling for Mac OSX

While trying to use nanogui-sdl in Mac OSX Sierra, Eigen gives me the following error:

/usr/local/include/eigen3/Eigen/src/Core/DenseStorage.h:277: error: no member named 'move' in namespace 'std'; did you mean 'modf'?
      : m_data(std::move(other.m_data))
               ~~~~~^~~~
                    modf

Can't compile ColorWheel.cpp.

Followed cloning instructions however compiling gets stuck at...

Building CXX object CMakeFiles/nanogui.dir/src/colorwheel.cpp.o

No messages shown. Restarted so many times.
Any pointers?

Status?

Hi, I really appreciate this fork of nanogui.
I prefer using SDL for my OpenGL development and this library is absolutely beautiful and suit my needs.

Is this fork still active? There is a commit from yesterday after a few years of inactivity...

Also, I tried to build it today from source, on Windows. It generally has many problems:

  • Need to manually build SDL2 from source and specify the include and library directories. I suggest adding a submodule to the GitHub mirror of SDL2 and find a way to build SDL2TTF and SDL2_Image since they don't use CMake...

  • Headers include SDL.h instead of SDL2/SDL.h

  • Many compile errors with unresolved references, specifically SDL_FRect / FPoint. Not sure what they are.

  • GLCanvas widget is missing. One the project builds again, it's worth implementing... It might be more complex though...

Please keep the hard work! Much appreciated. I will happily contribute to this project.

Best regards
Alon

Build Instruction for Windows?

Hi, i haved builded successfully example and library for Ubuntu. Now i need to build for Windows to use with Visual Studio. I tried Cmake to generate MingGW file and using "mingw32-make" to build but error on file screen.cpp. Would you mind creating a build instruction for Windows MingGW? Thanks so much and sorry for my bad English.

4 errors in nanogui_sdl/screen.cpp

I've finally managed to get nanogui_sdl to link to my SDL library by force-feeding it a link to my copy and by changing all the <SDL/> and <SDL2/> includes appropriately. I'm now getting these errors on compilation:

nanogui-sdl\src\screen.cpp(24): error C2365: 'glActiveTexture': redefinition; previous definition was 'function'
lib\SDL2\include\SDL_opengl.h(1871): note: see declaration of 'glActiveTexture'

nanogui-sdl\ext\nanovg/nanovg_gl.h(208): warning C4201: nonstandard extension used: nameless struct/union
nanogui-sdl\src\screen.cpp(127): error C2659: '=': function as left operand

Error 00000501 after create tex

In the example programs and a program I have written, "Error 00000501 after create tex" is thrown when the screen object is initialized. Additionally, "Error 00000502 after convex fill" and "Error 00000502 after stroke fill" are thrown in Examples 1 and 2, and neither one displays any text, though all other elements render correctly.

I have made sure OpenGL is set to the version installed. I am using an Ubuntu virtual machine with OpenGL 2.1, and have tried linking libSDL2.so or libSDL2-2.0.so. Mesa is 12.0.6.

async texture load causes flickering during initial frames

Might be something I'm doing wrong but when I load the simple example I see a quick single flicker, and later after I move my mouse cursor over the dialog I see flicker.

I debugged it down to draw() internally creates an AsyncTexturePtr if its not yet cached based on if mMouseFocus is true or not. I fixed it by adding a loadTex() API to widget and doing basically:

void Widget::loadTex(SDL_Renderer* renderer)
{
    for (auto child : mChildren)
        if (child->visible())
            child->loadTex(renderer);
}
void Window::loadTex(SDL_Renderer* renderer)
{
    for (int i = 0; i < 2; i++)
    {
        bool mMouseFocusTemp = (i==0) ? true : false;
        int id = (mMouseFocusTemp ? 0x1 : 0);
        auto atx = std::find_if(_txs.begin(), _txs.end(), [id](AsyncTexturePtr p) { return p->id == id; });
        if (atx == _txs.end())
        {
            AsyncTexturePtr newtx = std::make_shared<AsyncTexture>(id);
            newtx->load(this, 0, 0, mMouseFocusTemp);
            _txs.push_back(newtx);
        }
    }

    Widget::loadTex(renderer);
}

Then calling this at startup.
This avoids any runtime flickering.
No idea if I'm on the right track to solving this, but fyi in case any one hits this.

Android support

Hi is it currently possible to use NanoGUI-SDL on Android?

Image panel

image panel wrong show selected items if scroll bar scrolled down

Errors when compiling on visual studio 2017 windows

I had to manually insert the SDL library paths to the project properties.

Afterwards it just gives compilation errors:
'glActiveTexture': redefinition; previous definition was 'function' nanogui
Error C2659 '=': function as left operand nanogui D:\GITHUB\nanogui-sdl\src\screen.cpp 127

both have to do with glactivetexture.

Was really looking forward to using this :)

It works on Raspberry Pi?

Hi,

It works on Raspberry Pi?

Im asking because the original project nanogui only works with opengl3 and raspberry dont have driver for it.

Thanks.

Failing to compile on MacOS X

Any chance you could document how to build on Mac OSX?
I'm on High Sierra, I have installed SDL and SDL2 with Homebrew (apparently both are needed), but I have errors when building:

Scanning dependencies of target nanogui
[  7%] Building CXX object CMakeFiles/nanogui.dir/src/darwin.mm.o
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:24:8: error: unknown type name 'PFNGLUNIFORM1IPROC'; did you mean 'PFNGLUNIFORM1IARBPROC'?
extern PFNGLUNIFORM1IPROC glUniform1i ;
       ^~~~~~~~~~~~~~~~~~
       PFNGLUNIFORM1IARBPROC
/usr/local/include/SDL/SDL_opengl.h:4151:25: note: 'PFNGLUNIFORM1IARBPROC' declared here
typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0);
                        ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:24:27: error: redefinition of 'glUniform1i' as different kind of symbol
extern PFNGLUNIFORM1IPROC glUniform1i ;
                          ^
/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2935:13: note: previous definition is here
extern void glUniform1i (GLint location, GLint v0);
            ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:25:8: error: unknown type name 'PFNGLUNIFORM1FPROC'; did you mean 'PFNGLUNIFORM1FARBPROC'?
extern PFNGLUNIFORM1FPROC glUniform1f ;
       ^~~~~~~~~~~~~~~~~~
       PFNGLUNIFORM1FARBPROC
/usr/local/include/SDL/SDL_opengl.h:4147:25: note: 'PFNGLUNIFORM1FARBPROC' declared here
typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0);
                        ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:25:27: error: redefinition of 'glUniform1f' as different kind of symbol
extern PFNGLUNIFORM1FPROC glUniform1f ;
                          ^
/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2931:13: note: previous definition is here
extern void glUniform1f (GLint location, GLfloat v0);
            ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:26:8: error: unknown type name 'PFNGLUNIFORM2IPROC'; did you mean 'PFNGLUNIFORM2IARBPROC'?
extern PFNGLUNIFORM2IPROC glUniform2i ;
       ^~~~~~~~~~~~~~~~~~
       PFNGLUNIFORM2IARBPROC
/usr/local/include/SDL/SDL_opengl.h:4152:25: note: 'PFNGLUNIFORM2IARBPROC' declared here
typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1);
                        ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:26:27: error: redefinition of 'glUniform2i' as different kind of symbol
extern PFNGLUNIFORM2IPROC glUniform2i ;
                          ^
/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2936:13: note: previous definition is here
extern void glUniform2i (GLint location, GLint v0, GLint v1);
            ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:27:8: error: unknown type name 'PFNGLUNIFORM2FPROC'; did you mean 'PFNGLUNIFORM2FARBPROC'?
extern PFNGLUNIFORM2FPROC glUniform2f ;
       ^~~~~~~~~~~~~~~~~~
       PFNGLUNIFORM2FARBPROC
/usr/local/include/SDL/SDL_opengl.h:4148:25: note: 'PFNGLUNIFORM2FARBPROC' declared here
typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1);
                        ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:27:27: error: redefinition of 'glUniform2f' as different kind of symbol
extern PFNGLUNIFORM2FPROC glUniform2f ;
                          ^
/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2932:13: note: previous definition is here
extern void glUniform2f (GLint location, GLfloat v0, GLfloat v1);
            ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:28:8: error: unknown type name 'PFNGLUNIFORM3FPROC'; did you mean 'PFNGLUNIFORM3FARBPROC'?
extern PFNGLUNIFORM3FPROC glUniform3f ;
       ^~~~~~~~~~~~~~~~~~
       PFNGLUNIFORM3FARBPROC
/usr/local/include/SDL/SDL_opengl.h:4149:25: note: 'PFNGLUNIFORM3FARBPROC' declared here
typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
                        ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:28:27: error: redefinition of 'glUniform3f' as different kind of symbol
extern PFNGLUNIFORM3FPROC glUniform3f ;
                          ^
/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2933:13: note: previous definition is here
extern void glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
            ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:29:8: error: unknown type name 'PFNGLUNIFORM3IPROC'; did you mean 'PFNGLUNIFORM3IARBPROC'?
extern PFNGLUNIFORM3IPROC glUniform3i ;
       ^~~~~~~~~~~~~~~~~~
       PFNGLUNIFORM3IARBPROC
/usr/local/include/SDL/SDL_opengl.h:4153:25: note: 'PFNGLUNIFORM3IARBPROC' declared here
typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2);
                        ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:29:27: error: redefinition of 'glUniform3i' as different kind of symbol
extern PFNGLUNIFORM3IPROC glUniform3i ;
                          ^
/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2937:13: note: previous definition is here
extern void glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
            ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:30:8: error: unknown type name 'PFNGLUNIFORM4FPROC'; did you mean 'PFNGLUNIFORM4FARBPROC'?
extern PFNGLUNIFORM4FPROC glUniform4f ;
       ^~~~~~~~~~~~~~~~~~
       PFNGLUNIFORM4FARBPROC
/usr/local/include/SDL/SDL_opengl.h:4150:25: note: 'PFNGLUNIFORM4FARBPROC' declared here
typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
                        ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:30:27: error: redefinition of 'glUniform4f' as different kind of symbol
extern PFNGLUNIFORM4FPROC glUniform4f ;
                          ^
/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2934:13: note: previous definition is here
extern void glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
            ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:31:8: error: unknown type name 'PFNGLUNIFORM4IPROC'; did you mean 'PFNGLUNIFORM4IARBPROC'?
extern PFNGLUNIFORM4IPROC glUniform4i ;
       ^~~~~~~~~~~~~~~~~~
       PFNGLUNIFORM4IARBPROC
/usr/local/include/SDL/SDL_opengl.h:4154:25: note: 'PFNGLUNIFORM4IARBPROC' declared here
typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
                        ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:31:27: error: redefinition of 'glUniform4i' as different kind of symbol
extern PFNGLUNIFORM4IPROC glUniform4i ;
                          ^
/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2938:13: note: previous definition is here
extern void glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
            ^
In file included from /Users/mdorier/nanogui-sdl/src/darwin.mm:1:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/nanogui.h:33:
In file included from /Users/mdorier/nanogui-sdl/include/nanogui/imageview.h:18:
/Users/mdorier/nanogui-sdl/include/nanogui/glutil.h:48:66: error: use of undeclared identifier 'GL_HALF_FLOAT'
template <> struct type_traits<half_float::half> { enum { type = GL_HALF_FLOAT, integral = 0 }; };
                                                                 ^
17 errors generated.
make[2]: *** [CMakeFiles/nanogui.dir/src/darwin.mm.o] Error 1
make[1]: *** [CMakeFiles/nanogui.dir/all] Error 2
make: *** [all] Error 2

I'm guessing those errors are related to OpenGL's installation on OSX?

I have a problem with 100% CPU use and incorrect rendering

Hello! I am making a new version of Chiaki for the Raspberry Pi! For the old/current version see here,
https://www.youtube.com/watch?v=9TIIiuy_Hxk

For this new version I'm trying to use your nanogui-sdl because it allows me to do DRM direct to screen rendering when not under a X server. But I am also intending to support regular X desktop use.

Iv'e blocked out some basic elements of my GUI using nanogui-sdl but every time I launch I get 100% CPU use for the first 15-20 seconds and also at that time the rendering is incorrect. For example as you can see in the video the transparency of the pink and blue window is not respected and there are also issues with re-scaling of the windows. Another thing is that during that initial period if I have text fields open the whole screen flashes with the cursor blinking.
Here's a video showing some of these things happening,

https://www.youtube.com/watch?v=yYLUT5W-QeE

I see that there is not much work in this Repo right now but I was hoping you would be able to tell me what these issues are?
If there's anything I can do to fix them?

I am using Raspberry Pi 4b 32bit Buster
SDL2 2.0.17
Mesa 21.3.0

UPDATE: I just realised that this does not happen in the example program so I will do some more problem solving to identify the cause.

Thank You

Correct way to dispose a window entirely?

I am using Window::dispose to destroy a window and its child widgets. However, VS complains about can't destroy Theme objects while their mutexes are locked (a.k.a. mutex destroyed while busy); and also there are some cases where Button::AsyncTexture::load causes reading access violation (due to the main Button object is already deleted).

So is it safe to call Window::dispose from the main thread?

critical error

On fedora x86

./example1
terminate called after throwing an instance of 'std::runtime_error'
  what():  Could not open image directory!
Aborted (zrzut pamięci)

compiling with some warning

In member function ‘SDL_Color sdlgui::Color::toSdlColor() const’:
/home/sdlgui/common.cpp:82:24: warning: narrowing conversion of ‘(((float)((const sdlgui::Color*)this)->sdlgui::Color::r()) * (float)255)’ from ‘float’ to ‘Uint8’ {aka ‘unsigned char’} inside { } [-Wnarrowing]
SDL_Color color{ r() * 255, g() * 255, b() * 255, a() * 255 };
~~~~^~~~~
/home/sdlgui/common.cpp:82:35: warning: narrowing conversion of ‘(((float)((const sdlgui::Color*)this)->sdlgui::Color::g()) * (float)255)’ from ‘float’ to ‘Uint8’ {aka ‘unsigned char’} inside { } [-Wnarrowing]
SDL_Color color{ r() * 255, g() * 255, b() * 255, a() * 255 };
~~~~^~~~~

Programmatic way of setting focus on button?

Hi!
I'm trying to select+highlight a button using just a function (I will later tie that to Gamepad input) but I can't get the effect I'm expecting.

I'm trying
button1->requestFocus();
and
button1->setFocused();

but none of those makes the button highlight as if I have the mouse cursor over it.
This works though,
button1->setBackgroundColor(Color(0, 255, 255, 250));

It does seem to activate/focus on the button's parent mini window though. Which is odd as the set color works correctly.

Im I going about it the wrong way?

Cheers

Labels too tight in the screenshot?

I'm comparing the screenshot to the one in the original NanoGUI, and I get the feeling that everything is much more packed, with smaller spacing surrounding labels/widgets. Is this deliberate? IMHO, the spacing in the original NanoGUI is much more pleasant/beautiful to the eyes than the one in the current screenshot...

Error 00000502 after convex fill message.

when I run example1.cpp with visual studio 2015 version. this error is happened

Error 00000502 after convex fill message.

the bellow are stack from visual studio debugger stopped at glnvg__checkError
nanogui.dll!glnvg__checkError(GLNVGcontext * gl, const char * str) line 392 C++
nanogui.dll!glnvg__convexFill(GLNVGcontext * gl, GLNVGcall * call) line 995 C++
nanogui.dll!glnvg__renderFlush(void * uptr) line 1129 C++
nanogui.dll!nvgEndFrame(NVGcontext * ctx) line 310 C
nanogui.dll!nanogui::Screen::drawWidgets() line 369 C++
nanogui.dll!nanogui::Screen::drawAll() 줄 309 C++

Should I need to configure the other things for openGL usage?

Thanks

Build error on windows

How did you manage to build on windows. The SDL include is inconsitent. Sometime is

#include <SDL/SDL_opengl.h>
or
#include <SDL2/SDL_opengl.h>

By default, in the SDL developper source, everthing in directly on the "include" folder.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.