emscripten-core / emscripten-core/emscripten

Undefined Reference while using webgl

Open
#12,596 2 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Hi, Browser throws `Uncaught TypeError: Cannot read property 'viewport' of undefined
at _glViewport` while using `gl` methods OS:macOS Catalina 10.15.7

Here is the sample code i have used.

```cpp
#include
#include
#include
#include
#include

void getSurfaceForCanvas(std::string id,int width,int height){
std::cout << "\nCreating context for " << id << " okay\n";
EmscriptenWebGLContextAttributes attrs;

attrs.explicitSwapControl = 0;
attrs.depth = 1;
attrs.stencil = 1;
attrs.antialias = 1;
attrs.majorVersion = 2;
attrs.minorVersion = 0;
emscripten_webgl_init_context_attributes(&attrs);
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context(id.c_str(), &attrs);
if (context < 0)
{
std::cout << "\nFailed to create webgl Context " << context;
}
EMSCRIPTEN_RESULT r = emscripten_webgl_make_context_current(context);
if (r < 0) {
std::cout<<"\nFailed tp make webgl curren t "<

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.