HTML template and ThreeJS - Error creating WebGL context

Hi, I’m trying to use Three.js in a HTML template, looks like very interesting, unfortunately with CasparCG 2.3 LTE doesn’t work, from the log:

THREE.WebGLRenderer: Error creating WebGL context

The simplest example with a spinning cube, works fine in Safari, I even try with a node.js web server, same result, works in safari and firefox but no cube in casparcg.

WebGL seems working fine, WEBGL.isWebGLAvailable() returns true.

As soon I create the scene scene = new THREE.Scene(); it give the error.

Maybe I miss something? I’m very new to html and javascript, of course due to the flash eol :slight_smile:
Thanks

<enable-gpu>true</enable-gpu>

Thanks rrebuffo, I added

<html>
	<enable-gpu>true</enable-gpu>
</html>
<channels>...

now the error messages are many
I’m using an i5 with the integrated graphics, a low end pc for testing and developing

> [2021-04-21 13:21:14.944] [info]    Received message from 192.168.1.160: CG 1-20 ADD 1 "BLANK_THREEJS_EASY" 1 "}"\r\n
> [2021-04-21 13:21:14.958] [info]    Sent message to 192.168.1.160:202 CG OK\r\n
> [2021-04-21 13:21:15.617] [error]   OpenGL Error: 1282 Unknown error
> [2021-04-21 13:21:15.625] [error]   Exception: C:\Code\casparcg\official-master\src\common\gl\gl_check.cpp(60): Throw in function void __cdecl caspar::gl::SMFL_GLCheckError(const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,const char *,const char *,unsigned int)
> [2021-04-21 13:21:15.625] [error]   Dynamic exception type: class boost::exception_detail::clone_impl<struct caspar::gl::ogl_invalid_operation>
> [2021-04-21 13:21:15.625] [error]   [struct caspar::tag_error_info * __ptr64] = GL_INVALID_OPERATION
> [2021-04-21 13:21:15.625] [error]   [struct caspar::tag_msg_info * __ptr64] = the specified operation is not allowed in the current state
> [2021-04-21 13:21:15.625] [error]   [struct caspar::tag_stacktrace_info * __ptr64] =  0# 0x00007FF6A582524E in casparcg
> [2021-04-21 13:21:15.625] [error]    1# 0x00007FF6A58457C0 in casparcg
> [2021-04-21 13:21:15.625] [error]    2# 0x00007FF6A58A44C9 in casparcg
> [2021-04-21 13:21:15.625] [error]    3# 0x00007FF6A5880579 in casparcg
> [2021-04-21 13:21:15.625] [error]    4# 0x00007FF6A586C49E in casparcg
> [2021-04-21 13:21:15.625] [error]    5# 0x00007FF6A5870F3A in casparcg
> [2021-04-21 13:21:15.625] [error]    6# 0x00007FF6A586D13A in casparcg
> [2021-04-21 13:21:15.625] [error]    7# 0x00007FF6A5870829 in casparcg
> [2021-04-21 13:21:15.625] [error]    8# 0x00007FF6A586D448 in casparcg
> [2021-04-21 13:21:15.625] [error]    9# 0x00007FF6A587A08E in casparcg
> [2021-04-21 13:21:15.625] [error]   10# 0x00007FF6A5A8A885 in casparcg
> [2021-04-21 13:21:15.625] [error]   11# 0x000001EC6315F6D0
> [2021-04-21 13:21:15.625] [error]   
> [2021-04-21 13:21:15.625] [error]   
> 
> [2021-04-21 13:21:15.625] [error]    0# 0x00007FF6A582524E in casparcg
> [2021-04-21 13:21:15.625] [error]    1# 0x00007FF6A5824D2F in casparcg
> [2021-04-21 13:21:15.625] [error]    2# 0x00007FF6A5ACBB37 in casparcg
> [2021-04-21 13:21:15.625] [error]    3# _C_specific_handler in VCRUNTIME140
> [2021-04-21 13:21:15.625] [error]    4# _FrameUnwindFilter in VCRUNTIME140
> [2021-04-21 13:21:15.625] [error]    5# RtlCaptureContext2 in ntdll
> [2021-04-21 13:21:15.625] [error]    6# 0x00007FF6A59A9807 in casparcg
> [2021-04-21 13:21:15.625] [error]    7# 0x00007FF6A59F0D1E in casparcg
> [2021-04-21 13:21:15.625] [error]    8# cef_process_message_create in libcef
> [2021-04-21 13:21:15.625] [error]    9# GetHandleVerifier in libcef
> [2021-04-21 13:21:15.625] [error]   10# cef_string_utf16_to_upper in libcef
> [2021-04-21 13:21:15.625] [error]   11# cef_string_map_size in libcef
> [2021-04-21 13:21:15.625] [error]   12# cef_string_utf16_to_upper in libcef
> [2021-04-21 13:21:15.625] [error]   13# cef_string_map_size in libcef
> [2021-04-21 13:21:15.625] [error]   14# cef_string_map_size in libcef
> [2021-04-21 13:21:15.625] [error]   15# cef_string_map_size in libcef
> [2021-04-21 13:21:15.625] [error]   16# cef_string_map_size in libcef
> [2021-04-21 13:21:15.625] [error]   17# cef_string_map_size in libcef
> [2021-04-21 13:21:15.625] [error]   18# cef_time_delta in libcef
> [2021-04-21 13:21:15.625] [error]   19# cef_string_utf16_to_upper in libcef
> [2021-04-21 13:21:15.625] [error]   20# cef_string_utf16_to_upper in libcef
> [2021-04-21 13:21:15.625] [error]   21# cef_string_utf16_to_upper in libcef
> [2021-04-21 13:21:15.625] [error]   22# cef_string_utf16_to_upper in libcef
> [2021-04-21 13:21:15.625] [error]   23# cef_string_utf16_to_upper in libcef
> [2021-04-21 13:21:15.625] [error]   24# cef_string_map_size in libcef
> [2021-04-21 13:21:15.625] [error]   25# 0x00007FF6A58542A8 in casparcg
> [2021-04-21 13:21:15.625] [error]   26# 0x00007FF6A58B122E in casparcg
> [2021-04-21 13:21:15.625] [error]   27# 0x00007FF6A58AF2D0 in casparcg
> [2021-04-21 13:21:15.625] [error]   28# 0x00007FF6A5821489 in casparcg
> [2021-04-21 13:21:15.625] [error]   29# configthreadlocale in ucrtbase
> [2021-04-21 13:21:15.625] [error]   30# BaseThreadInitThunk in KERNEL32
> [2021-04-21 13:21:15.625] [error]   31# RtlUserThreadStart in ntdll
> [2021-04-21 13:21:15.625] [error]

those messages continue to repeat in a loop until the template is in execution

Sounds like a driver incompatibility with CEF’s webgl.
You can try and update the graphics drivers
Integrated graphics is not a godd idea for more than a single playout or basic templates. Let alone webgl

That’s not a good idea. It should support at least OpenGL 3.0.

Yes, It’s not a good idea, is just a tablet to if everything work, quiet and energy friendly.
For Production I use a Nuc Hades Canyon

I will check on the nuc the “enable GPU” as soon I can

anyway, the OpenGL is 4.6 and the log confirm OpenGL4.5.0

[2021-04-21 13:20:55.275] [info] ############################################################################
[2021-04-21 13:20:55.275] [info] Starting CasparCG Video and Graphics Playout Server 2.3.1 e767c1dda Release
[2021-04-21 13:20:55.390] [info] Initializing OpenGL Device.
[2021-04-21 13:20:55.392] [info] Initialized OpenGL 4.5.0 - Build 27.20.100.8682 Intel
[2021-04-21 13:20:55.501] [info] D3D11: Selected adapter: Intel(R) HD Graphics 615
[2021-04-21 13:20:55.501] [info] D3D11: Selected feature level: 45312
[2021-04-21 13:20:55.510] [info] Initialized ffmpeg module.
[2021-04-21 13:20:55.510] [info] Initialized oal module.
[2021-04-21 13:20:55.510] [info] Initialized decklink module.
[2021-04-21 13:20:55.510] [info] Initialized screen module.
[2021-04-21 13:20:55.510] [info] Initialized newtek module.
[2021-04-21 13:20:55.595] [info] Initialized html module.
[2021-04-21 13:20:55.595] [warning] Flash is no longer a recommended way of creating dynamic templates. Adobe have declared flash end-of-life at the end of 2020, and we cannot guarantee it will continue to work in any version after that time.
[2021-04-21 13:20:55.595] [warning] All support for flash templates will be removed in a future release of CasparCG
[2021-04-21 13:20:55.695] [info] Initialized flash module.
[2021-04-21 13:20:55.700] [info] Initialized bluefish module.
[2021-04-21 13:20:55.700] [info] Initialized image module.

With the Nuc Hades Canyon is even worst, with GPU enabled doesn’t event start

[2021-04-21 17:07:53.210] [info]    ############################################################################
[2021-04-21 17:07:53.210] [info]    CasparCG Server is distributed by the Swedish Broadcasting Corporation (SVT)
[2021-04-21 17:07:53.211] [info]    under the GNU General Public License GPLv3 or higher.
[2021-04-21 17:07:53.211] [info]    Please see LICENSE.TXT for details.
[2021-04-21 17:07:53.211] [info]    http://www.casparcg.com/
[2021-04-21 17:07:53.211] [info]    ############################################################################
[2021-04-21 17:07:53.211] [info]    Starting CasparCG Video and Graphics Playout Server 2.3.1 e767c1dda Release
[2021-04-21 17:07:53.397] [info]    Initializing OpenGL Device.
[2021-04-21 17:07:53.401] [info]    Initialized OpenGL 4.5.13559 Core Profile Context 26.20.12001.12000 ATI Technologies Inc.
[2021-04-21 17:07:53.418] [info]    D3D11: Selected adapter: Radeon RX Vega M GH Graphics
[2021-04-21 17:07:53.418] [info]    D3D11: Selected feature level: 45312
[2021-04-21 17:07:53.441] [info]    [asio] Shutting down global io_service.
[2021-04-21 17:07:53.441] [info]    [asio] Global io_service uninitialized.
[2021-04-21 17:07:53.441] [error]   Exception: C:\Code\casparcg\official-master\src\accelerator\ogl\util\device.cpp(132): Throw in function __cdecl caspar::accelerator::ogl::device::impl::impl(void)
[2021-04-21 17:07:53.441] [error]   Dynamic exception type: class boost::exception_detail::clone_impl<struct caspar::gl::ogl_exception>
[2021-04-21 17:07:53.441] [error]   [struct caspar::tag_msg_info * __ptr64] = Failed to initialize d3d interop.
[2021-04-21 17:07:53.441] [error]   [struct caspar::tag_stacktrace_info * __ptr64] =  0# 0x00007FF6FB09524E in casparcg
[2021-04-21 17:07:53.441] [error]    1# 0x00007FF6FB0B57C0 in casparcg
[2021-04-21 17:07:53.441] [error]    2# 0x00007FF6FB0D8D18 in casparcg
[2021-04-21 17:07:53.441] [error]    3# 0x00007FF6FB0D7DA3 in casparcg
[2021-04-21 17:07:53.441] [error]    4# 0x00007FF6FB0BA6AC in casparcg
[2021-04-21 17:07:53.441] [error]    5# 0x00007FF6FB0BAC6C in casparcg
[2021-04-21 17:07:53.441] [error]    6# 0x00007FF6FB0BABC5 in casparcg
[2021-04-21 17:07:53.441] [error]    7# 0x00007FF6FB0A7660 in casparcg
[2021-04-21 17:07:53.441] [error]    8# 0x00007FF6FB0A80AA in casparcg
[2021-04-21 17:07:53.441] [error]    9# 0x00007FF6FB097409 in casparcg
[2021-04-21 17:07:53.441] [error]   10# 0x00007FF6FB09A85D in casparcg
[2021-04-21 17:07:53.441] [error]   11# 0x00007FF6FB2C1DF8 in casparcg
[2021-04-21 17:07:53.441] [error]   12# BaseThreadInitThunk in KERNEL32
[2021-04-21 17:07:53.441] [error]   13# RtlUserThreadStart in ntdll
[2021-04-21 17:07:53.441] [error]   
[2021-04-21 17:07:53.441] [error]   

[2021-04-21 17:07:53.441] [error]    0# 0x00007FF6FB09524E in casparcg
[2021-04-21 17:07:53.441] [error]    1# 0x00007FF6FB094D2F in casparcg
[2021-04-21 17:07:53.441] [error]    2# 0x00007FF6FB2FE78A in casparcg
[2021-04-21 17:07:53.441] [error]    3# 0x00007FFCBE521030 in VCRUNTIME140
[2021-04-21 17:07:53.441] [error]    4# is_exception_typeof in VCRUNTIME140
[2021-04-21 17:07:53.441] [error]    5# RtlCaptureContext2 in ntdll
[2021-04-21 17:07:53.441] [error]    6# 0x00007FF6FB09A85D in casparcg
[2021-04-21 17:07:53.441] [error]    7# 0x00007FF6FB2C1DF8 in casparcg
[2021-04-21 17:07:53.441] [error]    8# BaseThreadInitThunk in KERNEL32
[2021-04-21 17:07:53.441] [error]    9# RtlUserThreadStart in ntdll
[2021-04-21 17:07:53.441] [error]   
[2021-04-21 17:07:53.523] [fatal]   Unhandled exception in main thread. Please report this error on the GitHub project page (www.github.com/casparcg/server/issues).

On some machines there is a setting somewhere, that makes the GPU available to other programs and not only to Windows. Google is your friend…

Have you tried setting the power options in control panel to maximum performance? Maybe running Caspar with elevated privileges?
I have running three.js templates in 2.3.1-LTS no problem, but on GeForce and Quadro GPUs. I have used Caspar on Intel’s UHD 620 and 630 in the past, but never tried to run webgl on them.

Hi, I didn’t have much luck
I updated everything I could, with a bit of research for the weird cpu/gpu combination of Hades Canyon

then maximised performances in:

Settings → System → Power & Sleep → Additional Power Settings → High Performance

and I did found how to select preferred GPU in:

settings → system → display → Graphic Settings

CasparCG launched with Radeon RX Vega:

[2021-04-29 18:48:38.136] [info]    Initialized OpenGL 4.5.13587 Core Profile Context 20.2.2 26.20.15019.19000 ATI Technologies Inc.
[2021-04-29 18:48:38.164] [info]    D3D11: Selected adapter: Radeon RX Vega M GH Graphics
[2021-04-29 18:48:38.164] [info]    D3D11: Selected feature level: 45312

CasparCG launched with Intel HD Graphics:

[2021-04-29 18:47:02.240] [info]    Initialized OpenGL 4.5.13587 Core Profile Context 20.2.2 26.20.15019.19000 ATI Technologies Inc.
[2021-04-29 18:47:02.281] [info]    D3D11: Selected adapter: Intel(R) HD Graphics 630
[2021-04-29 18:47:02.281] [info]    D3D11: Selected feature level: 45312

unfortunately with GPU enabled won’t start at all

here the full log

[2021-04-29 18:48:37.936] [info]    ############################################################################
[2021-04-29 18:48:37.937] [info]    CasparCG Server is distributed by the Swedish Broadcasting Corporation (SVT)
[2021-04-29 18:48:37.937] [info]    under the GNU General Public License GPLv3 or higher.
[2021-04-29 18:48:37.937] [info]    Please see LICENSE.TXT for details.
[2021-04-29 18:48:37.937] [info]    http://www.casparcg.com/
[2021-04-29 18:48:37.937] [info]    ############################################################################
[2021-04-29 18:48:37.937] [info]    Starting CasparCG Video and Graphics Playout Server 2.3.1 e767c1dda Release
[2021-04-29 18:48:38.133] [info]    Initializing OpenGL Device.
[2021-04-29 18:48:38.136] [info]    Initialized OpenGL 4.5.13587 Core Profile Context 20.2.2 26.20.15019.19000 ATI Technologies Inc.
[2021-04-29 18:48:38.164] [info]    D3D11: Selected adapter: Radeon RX Vega M GH Graphics
[2021-04-29 18:48:38.164] [info]    D3D11: Selected feature level: 45312
[2021-04-29 18:48:38.189] [info]    [asio] Shutting down global io_service.
[2021-04-29 18:48:38.189] [info]    [asio] Global io_service uninitialized.
[2021-04-29 18:48:38.189] [error]   Exception: C:\Code\casparcg\official-master\src\accelerator\ogl\util\device.cpp(132): Throw in function __cdecl caspar::accelerator::ogl::device::impl::impl(void)
[2021-04-29 18:48:38.189] [error]   Dynamic exception type: class boost::exception_detail::clone_impl<struct caspar::gl::ogl_exception>
[2021-04-29 18:48:38.189] [error]   [struct caspar::tag_msg_info * __ptr64] = Failed to initialize d3d interop.
[2021-04-29 18:48:38.189] [error]   [struct caspar::tag_stacktrace_info * __ptr64] =  0# 0x00007FF6354C524E in casparcg
[2021-04-29 18:48:38.189] [error]    1# 0x00007FF6354E57C0 in casparcg
[2021-04-29 18:48:38.189] [error]    2# 0x00007FF635508D18 in casparcg
[2021-04-29 18:48:38.189] [error]    3# 0x00007FF635507DA3 in casparcg
[2021-04-29 18:48:38.189] [error]    4# 0x00007FF6354EA6AC in casparcg
[2021-04-29 18:48:38.189] [error]    5# 0x00007FF6354EAC6C in casparcg
[2021-04-29 18:48:38.189] [error]    6# 0x00007FF6354EABC5 in casparcg
[2021-04-29 18:48:38.189] [error]    7# 0x00007FF6354D7660 in casparcg
[2021-04-29 18:48:38.189] [error]    8# 0x00007FF6354D80AA in casparcg
[2021-04-29 18:48:38.189] [error]    9# 0x00007FF6354C7409 in casparcg
[2021-04-29 18:48:38.189] [error]   10# 0x00007FF6354CA85D in casparcg
[2021-04-29 18:48:38.189] [error]   11# 0x00007FF6356F1DF8 in casparcg
[2021-04-29 18:48:38.189] [error]   12# BaseThreadInitThunk in KERNEL32
[2021-04-29 18:48:38.189] [error]   13# RtlUserThreadStart in ntdll
[2021-04-29 18:48:38.189] [error]   
[2021-04-29 18:48:38.189] [error]   

[2021-04-29 18:48:38.189] [error]    0# 0x00007FF6354C524E in casparcg
[2021-04-29 18:48:38.189] [error]    1# 0x00007FF6354C4D2F in casparcg
[2021-04-29 18:48:38.189] [error]    2# 0x00007FF63572E78A in casparcg
[2021-04-29 18:48:38.189] [error]    3# 0x00007FFE9E271030 in VCRUNTIME140
[2021-04-29 18:48:38.189] [error]    4# is_exception_typeof in VCRUNTIME140
[2021-04-29 18:48:38.189] [error]    5# RtlCaptureContext2 in ntdll
[2021-04-29 18:48:38.189] [error]    6# 0x00007FF6354CA85D in casparcg
[2021-04-29 18:48:38.189] [error]    7# 0x00007FF6356F1DF8 in casparcg
[2021-04-29 18:48:38.189] [error]    8# BaseThreadInitThunk in KERNEL32
[2021-04-29 18:48:38.189] [error]    9# RtlUserThreadStart in ntdll
[2021-04-29 18:48:38.189] [error]   
[2021-04-29 18:48:38.298] [fatal]   Unhandled exception in main thread. Please report this error on the GitHub project page (www.github.com/casparcg/server/issues).

don’t know, maybe I’m doing something wrong,
here the config file

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <paths>
        <media-path>media/</media-path>
        <log-path>log/</log-path>
        <data-path>data/</data-path>
        <template-path>templates/</template-path>
    </paths>
    <lock-clear-phrase>secret</lock-clear-phrase>
    <flash>
        <enabled>true</enabled>
        <buffer-depth>auto</buffer-depth>
    </flash>
    <html>
    <enable-gpu>true</enable-gpu>
</html>
    <channels>
        <channel>
            <video-mode>1080i5000</video-mode>
            <consumers>
                <decklink>
                    <device>1</device>
                    <latency>normal</latency>
                    <keyer>external</keyer>
                    <key-only>false</key-only>
                    <buffer-depth>5</buffer-depth>
                </decklink>             
            </consumers>
        </channel>
        <channel>
            <video-mode>1080i5000</video-mode>
            <consumers>
                <decklink>
                    <device>2</device>
                    <latency>normal</latency>
                    <keyer>external</keyer>
                    <key-only>false</key-only>
                    <buffer-depth>5</buffer-depth>
                </decklink>  
            </consumers>
        </channel>

        <channel>
            <video-mode>576p2500</video-mode>
            <consumers>
                <screen />
                <system-audio />
            </consumers>
        </channel>
    </channels>
    <controllers>
        <tcp>
            <port>5250</port>
            <protocol>AMCP</protocol>
        </tcp>
    </controllers>
    <amcp>
        <media-server>
            <host>localhost</host>
            <port>8000</port>
        </media-server>
    </amcp>
</configuration>