Code Monkey home page Code Monkey logo

glad-web's Introduction

Glad-Web

This is a webservice for glad, a multi-language Vulkan/GL/GLES/EGL/GLX/WGL loader-generator based on the official specifications.

Official instance running at: http://glad.dav1d.de/

Requirements:

Flask==0.10.1
Flask-Silk==0.2
Jinja2==2.7.3
MarkupSafe==0.23
Werkzeug==0.10.4
argparse==1.2.1
eventlet==0.17.4
future==0.15.0
gevent==1.0.2
greenlet==0.4.7
gunicorn==19.3.0
itsdangerous==0.24
lxml==3.4.4
wsgiref==0.1.2

Furthermore Flask-Autoindex is also required. I am using the git version at commit: bd5daee43353e77cb89d967bffa1a3786e5182ad. The PyPi version does not work.

And obviously glad needs to be installed as well!

Cronjob:

To delete all temporary files, I recommend running a cronjob every 24 hours:

#!/bin/sh
    
cd /home/pyweb/gladweb/glad-web/
source ../bin/activate
    
exec python -m gladweb cron --age 23

Gunicorn:

Start script:

#!/bin/sh

cd /path/to/gladweb/glad-web/
# assume virtualenv location, might need to be changed
source ../bin/activate

exec gunicorn -c gunicorn.config.py 'gladweb:create_application(debug=False, verbose=None)' "$@"

Config:

import os.path

base_path = os.path.split(os.path.abspath(__file__))[0]

bind = '127.0.0.1:5000'
workers = 5
worker_class = 'eventlet'
keepalive = 5
user = 'glad'
errorlog = os.path.join(base_path, 'error.log')
loglevel = 'warning'
proc_name = 'glad gunicorn'

Supervisor:

[program:glad]
command = /path/to/gladweb/glad-web/start_gladweb.sh
directory = /path/to/gladweb/glad-web
user = glad
autostart = True
autorestart = True
stdout_logfile = /var/log/supervisor/glad.log
stderr_logfile = /var/log/supervisor/glad_err.log

Nginx:

server {
    listen 80;
    server_name localhost;

    root /path/to/glad-web/;

    location / {
        try_files $uri @proxy_to_app;
    }

    location /static {
        alias /path/to/glad-web/gladweb/static;
    }
    
    # 'frozen' html files 
    location /generated {
        default_type text/plain;
        alias /path/to/glad-web/temp;
    }
   
    # served by flask-silk 
    location /generated/icons {
        try_files $uri @proxy_to_app;
    }

    location @proxy_to_app {
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_redirect off;

        proxy_pass http://localhost:5000;
    }
}

glad-web's People

Contributors

dav1dde 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

glad-web's Issues

Generated code issues pedantic warnings with modern compilers

src/glad.c:1698:25: error: ISO C forbids conversion of object pointer to function pointer type [-Werror=pedantic] glad_glGetnHistogram = (PFNGLGETNHISTOGRAMPROC)load("glGetnHistogram"); ^

src/glad.c:1700:26: error: ISO C forbids conversion of object pointer to function pointer type [-Werror=pedantic] glad_glTextureBarrier = (PFNGLTEXTUREBARRIERPROC)load("glTextureBarrier"); ^

Changing the code to this
1698 glad_glGetnHistogram = (PFNGLGETNHISTOGRAMPROC)load("glGetnHistogram");
1699 *(void**) (&glad_glGetnMinmax) = load("glGetnMinmax");
1700 glad_glTextureBarrier = (PFNGLTEXTUREBARRIERPROC)load("glTextureBarrier");

based on an stackoverflow comment eliminates the issue.

Emscripten support

I know there is a closed issue for this that essentially recommends not using glad on emscripten ("no loader needed"), but the best thing about glad is that the headers are the same and found in the same place across all platforms. It would be awesome if glad supports emscripten through the same API as all other platforms. Besides, the glad API has other functions, not only dynamic function lookup.

Glad header for different GL version or platform

  • Is the source code generated with same gl version from web-service in different platform be different?
  • If the answer of last question is no, what is the motivation that web-generator do not provide permanently source code, be letting user's glad source file be more latest to contain new features?

BTW, i want to embedding glad source code in to my app. Like glfw, I fetch is use cmake FeachContent from git repo, compile and link locally.

  • Is there some way to detect current driver and determine the relative GL version?
  • Is there some way to automatically down the glad loader generating web? some web interface which use GET SET.

Date is ahead of current system time

When I recieve the zip, Make complains about clock skew detected. After looking at the files I dropped off, it says the data was last done in 2021.

Modifying the date with touch *.h glad.c fixes this issue.

Note: this could be a problem with glad, not glad-web

Multiple output formats (instead of only .zip)

Redirect to a page where you have the choice of downloading specific files individually or a complete zip.

Depending on a configuration make it possible to keep this page permanently, either store the glad options associated with the page or the generated files.

Permanent Link

Hi,
I'm trying to set up my build system so that others can easily build my project. Is there a way to get a permanent link for a given configuration?

Thanks

add emscripten support to the loader

found this private function in emscripten, and it works.

#if defined(__EMSCRIPTEN__)
    extern void* emscripten_GetProcAddress(const char *name_);
#endif

What license should I distribute this?

Is there any license this project's generated loader files (glad.c and glad.h) are under? I want to ship my project that contains both files in the project source tree.

My project is being released under both GPLv3 and LGPLv3.

Add support for OpenGL in Rust.

Rust as a programming language is growing rapidly. It would be nice if there way a way to be able to Add all versions of OpenGL in glad to rust. By Far glad is perfect for my needs for the Intel GM45 that is in my Inspiron 1545 that actually does not crash on me when I compile. I know of a few games that uses OpenGL newer than 2.1 that causes the crash. Otherwise good work on being able to select version 2.1 on the website that suits my needs.

OpenGL ES loader not invoked

Hi, I would like to get some clarification regarding the loading of OpenGL ES function pointers. Please note that this may not be a bug and just a misunderstanding on my side.

I have generated a loader from your website with the following settings:

Language: C/C++
Specification: OpenGL
Profile: Core
gl: Version 4.5
gles1: None
gles2: Version 3.1
glsc2: None
Extensions: None

When I then open an OpenGL ES 3.1 context and call gladLoadGL(), I notice that glad_glDispatchCompute is unresolved:

printf("Address of glad_glDispatchCompute: %p\n", glad_glDispatchCompute); // (nil)

A closer look at the generate glad.c file reveals that the OpenGL ES loader is not called:

int gladLoadGL(void) {
    int status = 0;

    if(open_gl()) {
        status = gladLoadGLLoader(&get_proc);
        close_gl();
    }

    return status;
}

If however I replace the call to gladLoadGLLoader() to gladLoadGLES2Loader(), then I do get glad_glDispatchCompute resolved to a correct address:

int gladLoadGL(void) {
    int status = 0;

    if(open_gl()) {
        //status = gladLoadGLLoader(&get_proc);
        status = gladLoadGLES2Loader(&get_proc);
        close_gl();
    }

    return status;
}
Address of glad_glDispatchCompute: 0x7f3ae8d09580

Can you help clarify what is the expected behaviour here? If I open an OpenGL ES context, shouldn't glad call the OpenGL ES loader?

Given that glad is calling the GL loader and not the GL ES loader, I have also tried generating a loader with no gl version (only gles2):

Language: C/C++
Specification: OpenGL
Profile: Core
gl: none
gles1: None
gles2: Version 3.1
glsc2: None
Extensions: None

However, if I generate such a loader, I cannot even compile the generated files.

Please clarify if this is a bug in the loader generator or a misunderstanding on my side.

Thanks.

Can't omit khrplatform?

When I look in the files generated by GLAD web, I see the line:

Omit khrplatform: False

glad.c also always has:

#include <KHR/khrplatform.h>

As far as I can tell I don't need this file, I certainly don't use it. Every time I emit GLAD I manually delete the "#include khrplatform" line.

The line in the header comments implies that GLAD has the ability to omit the khrplatform include. Could this ability be exposed in the web interface? I see no such button currently.

mx global causes an error and overall bad UX on website

Hello,

the option mx global causes an error.
Error:
Invalid option 'MX_GLOBAL'

Also the user experience on the website is rather ..., it looses inputs if an error is raised. I tested it a little bit, selecting debug and mx, -> everything gets lost. Happens also with mx global.
Error:
option MX can not be used together with DEBUG

Maybe the UI should show the user which inputs are valid, before he clicks generate and looses every input.

Support selecting multiple Specification extensions

Using the web service I noticed you have to choose between OpenGL, EGL, WGL, GLX to add extensions to the list, when you change the Specification, the list is reseted.
It would be great to be able to add OpenGL extensions together with, for example, WGL extensions.

See: Dav1dde/glad#53

Non-interactive generator

Hello, thank you for glad and this web frontend!

For build scripts it would be nice to have a URL from which to download the correct glad version instead of including the generated code in the project's repository. Right now, non-interactive use would require a script to send a post request and get the proper URL from there, which is not hard, but a lot less comfortable than just generating a URL which could then be used e.g. in CMake's ExternalProject_Add directive.

You already support "Permalinks" to pre-fill the form, like this one:
http://glad.dav1d.de/#profile=core&specification=gl&api=gl%3D3.3&api=gles1%3Dnone&api=gles2%3Dnone&api=glsc2%3Dnone&language=c&loader=on

Would you be willing to support a similar url that would directly lead to the zip file?

There's a huge number of possible configurations for glad, so I understand that you cannot persistently host all combinations. Generating the zip files on the fly and caching them should be alright though.

Add Nim support

I attempted to do it myself but the README is not sufficiently detailed enough for someone who is not familiar with Python web development like myself and I don't want to invest the time to learn it because it would be a one-off thing for me...

Alternatively, I could make a PR "blind" containing the changes and then you could test it etc... But the necessary changes seem to be quite trivial, probably a half an hour job anyway...

glad wgl generated online with --local-files differs from local

Not sure if this is the right place to file this but it seems to be working locally so I figure it's web-specific.

I was using the online generator and I found that glad_wgl.h generated with --local-files isn't quite right, see glad_wgl.h (while that file lasts) built from this config:

/*

    WGL loader generated by glad 0.1.27 on Mon Sep 10 13:11:26 2018.

    Language/Generator: C/C++
    Specification: wgl
    APIs: wgl=1.0
    Profile: -
    Extensions:
        
    Loader: True
    Local files: True
    Omit khrplatform: False

    Commandline:
        --api="wgl=1.0" --generator="c" --spec="wgl" --local-files --extensions=""
    Online:
        http://glad.dav1d.de/#language=c&specification=wgl&loader=on&api=wgl%3D1.0
*/

// ....

#include <glad/glad.h>

But if I clone the same version of glad locally it generates #include "glad.h" as I'd expect.

The same seems to happen with glx.

`glMapBuffer` is missing from the OpenGL ES (2) header.

According to the spec, glMapBuffer should be supported by OpenGL ES2. When generating the header, however, it is not included. Could you tell me what I am doing wrong?

To generate the files, I have used the web service with these settings:
--profile="compatibility" --api="gles2=3.2" --generator="c" --spec="gl"

, and included all the extensions.

~Paul

WGL Undefined References

I choseed WGL and generated the code,but the generated file glad_ wgl. c seems to contain errors

static int has_ext(const char *ext) {
    const char *terminator;
    const char *loc;
    const char *extensions;

    if(wglGetExtensionsStringEXT == NULL && wglGetExtensionsStringARB == NULL)
        return 0;

    if(wglGetExtensionsStringARB == NULL || GLADWGLhdc == INVALID_HANDLE_VALUE)
        extensions = wglGetExtensionsStringEXT();
    else
        extensions = wglGetExtensionsStringARB(GLADWGLhdc);

    if(extensions == NULL || ext == NULL)
        return 0;
...

identifier wglGetExtensionsStringEXT wglGetExtensionsStringARB is undefined.

https://glad.dav1d.de/#language=c&specification=wgl&api=wgl%3D1.0&extensions=WGL_EXT_swap_control&loader=on

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.