From nobody Thu Jan 28 07:30:15 2021 Authentication-Results: mail-b.sr.ht; dkim=pass header.d=eliasnaur.com header.i=@eliasnaur.com Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by mail-b.sr.ht (Postfix) with ESMTPS id CBFBB11EFFF for <~eliasnaur/gio@lists.sr.ht>; Thu, 28 Jan 2021 07:30:14 +0000 (UTC) Received: by mail-ej1-f46.google.com with SMTP id a10so6246572ejg.10 for <~eliasnaur/gio@lists.sr.ht>; Wed, 27 Jan 2021 23:30:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eliasnaur.com; s=google; h=mime-version:content-transfer-encoding:date:message-id:from:to:cc :subject:references:in-reply-to; bh=PfFhFTqI/NSrZrNiPD9wojIp9uh8JoqRr/uYADdYmvs=; b=2xs49Ty8Zv/qs75j+v719jt8zwPyJbRFuRiC7kQrxVGFwCA4MNGg/uVwa1UxneWDtu L0bPnVOOzfZZjoxxA1ch7IQ99q/CRop2ZmUjIA67Shg54FliZ9eRlcFy6+4UP4gDlQUd 2ZuJHvez9kUfRtDhtOkMXbdtbk/jwONBToSbvdNU72E6N1kbdW/fX2lC6FLE4LnebJQs IflkUp5gGQ3JBPp4wIVX3HhKr8HN8lGvkdwgeBUoWJEfHoBvSydQT27V5H1Mhd1KmCAF uSjOmEg/NZYslnG6WZ8QPdTPF8fVa859YcNf2Fhx4f2tgm1RMTI2gNmlTnN3lvxN1HDS g/Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding:date :message-id:from:to:cc:subject:references:in-reply-to; bh=PfFhFTqI/NSrZrNiPD9wojIp9uh8JoqRr/uYADdYmvs=; b=QDOV2ZjYt+kyKECQCHuS0bJRb06vkJaxaS4AHjbV1KQdfa9s3prd6qrAjldnf8V5jQ D/a4Enubeqs8mSeNQ47TUv9uLI0XkpsWhh7gpvvhOq78bAvp5FLFu+4gSAmy1UKTl9tI PT6cdcyW4FxLrLenHVZSd4u2/4lKK3w7e4DiI96innH33D0MSXgeBk0ZrnxupgzB9sjb ZVokDlNqz6NpmzwAAas0CQc5J8773en1/1NuWBTHbT9Fkd38zNS2Djg+n4cE5fP7re2b 3OYMe+qw31yxle6xE/BvsdFaFQYW4WX+8+xxL02chMPRvoKcPjeIw3Xm1HmvDoLQWfif iBiA== X-Gm-Message-State: AOAM530KsARVYnkzFLkoGH7EFUQlxQdAzvXLwLC+ZfSCWt8+MJXKWoO+ WDhY91wprcIq/Sbh1aDiIX5brg== X-Google-Smtp-Source: ABdhPJxptsynIAm4KU6LrKh1RSJf1Jv+hkLyfyTjcj3AZAdsMbLMKjTFE7M02mYxlzhpCtrPR/IF6w== X-Received: by 2002:a17:906:3b0b:: with SMTP id g11mr9477304ejf.169.1611819013470; Wed, 27 Jan 2021 23:30:13 -0800 (PST) Received: from localhost ([145.255.60.245]) by smtp.gmail.com with ESMTPSA id j23sm2556717edv.45.2021.01.27.23.30.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Jan 2021 23:30:12 -0800 (PST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 28 Jan 2021 08:30:12 +0100 Message-Id: From: "Elias Naur" To: "Zhao Wang" Cc: <~eliasnaur/gio@lists.sr.ht> Subject: Re: Embed Gio with other OpenGL rendering References: In-Reply-To: On Wed Jan 27, 2021 at 23:45 CET, Zhao Wang wrote: > This works, thank you! > > On Wed, Jan 27, 2021 at 8:45 AM Elias Naur wrote: > > > > On Tue Jan 26, 2021 at 23:41 CET, Zhao Wang wrote: > > > On Tue, Jan 26, 2021 at 5:51 AM Elias Naur wrote= : > > > > On Mon Jan 25, 2021 at 17:40, Zhao Wang wrote: > > > > > On Mon, Jan 25, 2021 at 2:05 AM Elias Naur w= rote: > > > > > > On Mon Jan 25, 2021 at 8:43 AM CET, Zhao Wang wrote: > > > > > > > I just tried the GLFW example on windows, it failed as expect= ed as > > > > > > > shown by the attachment. > > > > > > > > > > > > > > It panic when trying to GetString for Extension during initia= lizing a > > > > > > > new backend. > > > > > > > > > > > > > > > > > > > The OpenGL backend depends on ANGLE to work. I have an old buil= d here[0] > > > > > > if you like. Place the DLLs in the same directory as the GLFW b= inary (or > > > > > > the current directory if you're using `go run`). > > > > > > > > > > > > > > > > Regarding running the glfw example on windows, I put these DLLs i= n the > > > > > same directory as the GLFW binary and do "go run". I got this err= or when > > > > > creating new backend: > > > > > > > > > > "2021/01/25 16:52:52 failed to parse OpenGL ES version ()" > > > > > > > > > > It returns empty string for OpenGL ES version and thus failed at = this line > > > > > in NewBackend method: > > > > > > > > > > "glimpl.ParseGLVersion()" > > > > > > > > > > Will dig more into this to collect more information. > > > > > > > > > > > > > I found and fixed an issue that should fix the above error [4]. Ple= ase > > > > try again. > > > > > > > > Elias > > > > > > > > [4] https://gioui.org/commit/57872856e8c5b5de > > > > > > Tried again with latest Gio, seems still the same problem. I made > > > a commit here [0]. Do I need to include the ANGEL binaries? > > > I am not sure if the ones [1] you gave me already include > > > everything we need. > > > > > > [0] https://github.com/zwang/gio-example/commit/3c34d05d121ba722f6bd8= b926f21ef1fb3246988 > > > [1] https://drive.google.com/file/d/1k2950mHNtR2iwhweHS1rJ7reChTa3rki= /view?usp=3Dsharing > > > > The Gio fix only covered the kitchen example on Linux/Wine. Testing on > > Windows proper revealed another issue: the glfw example always selects > > the desktop OpenGL, which on Windows is something different than ANGLE. > > Gio and GLFW thus ends up with different OpenGL function pointers. > > > > I added support for EGL to the glfw example here: [0]. The OpenGL ES > > bindings package "github.com/go-gl/gl/v3.1/gles2" does not build on > > macOS[1], so you'll have to outcomment the gles2 references to see it i= n > > action on Windows. > > > > It doesn't actually work on Windows either without this fix to the > > glow generator[2]. You'll need to run the generator to generate a > > compatible package: > > > > $ cd glow-with-pr-112 > > $ go build ./glow generate -api=3Dgles2 -version=3D3.1 > > $ mv gl/*.go ../gl/v3.1/gles2 # a checkout version of github.com/go-gl/= gl > > > Will this change be made to github.com/go-gl/gl/v3.1/gles2 master too? > Sounds like it should be. > Yeah. I leaved it as soon as I discovered a fix and that go-gl/gl contains what I think is a design flaw (that you can't mix gl and gles2 calls, even though they behave identically). I figured you had your own way of loading GL function pointers anyway, making the point moot. PR 112 is merged, so it would be easy to do if you need it. > > Finally, you'll need the EGL headers and of course the ANGLE EGL librar= y > > to run the example on Windows: > > > > $ cd gl > > $ go mod init github.com/go-gl/gl > > $ cd ../gio-example > > $ go mod edit -replace github.com/go-gl/gl=3D../gl > > $ CGO_FLAGS=3D"-I\include" CGO_LDFLAGS=3D"-L" go run -tags egl ./glfw > > > > The "egl" tag instructs go-gl to use the EGL mechanism to load function > > pointers. > > > This works for me with some changes. I first put the flags into > environment variables. > Then used CGO_CFLAGS instead of CGO_FLAGS. > Then when I run, I go to gio-example/glfw foder, run go run -tags egl mai= n.go > In gio-example/glfw, I have the generated angle libs as attached above > in angels.zip > Ah, sorry for the typo. My Windows machine don't have access to my email so I typed the line manually. Elias