Code Monkey home page Code Monkey logo

gl's People

Contributors

dmitshur avatar tanema 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

gl's Issues

Getting an error in go 1.5

When I try this go get -u github.com/goxjs/gl/... I get this error

package golang.org/x/mobile/event/config: cannot find package "golang.org/x/mobile/event/config" in any of:
    /usr/local/go/src/golang.org/x/mobile/event/config (from $GOROOT)

this maybe because of the this refactor in this commit,
golang/mobile@f632204

Complete implementation of all remaining functions.

Both the WebGL and Windows backends (glweb.gl and gl_windows.go) are partially implemented. Most common funcs are there (for all my tests and gxui tests), but far from all.

All remaining funcs are marked with "not yet implemented" panics.

Trying to cross compile on Mac to Windows, errors:

bash-3.2$ GOOS=windows GOARCH=386 go build -o g4.exe g4.go
../github.com/goxjs/gl/gl_opengl.go:10:2: no buildable Go source files in /p/lorgenome/src/github.com/go-gl/gl/v2.1/gl
../github.com/goxjs/glfw/desktop.go:10:2: no buildable Go source files in /p/lorgenome/src/github.com/go-gl/glfw/v3.2/glfw

Has any one tried to cross compile this?

Supported OpenGL version

It seems odd that you are using OpenGL 2.1 for desktops but ES2 for mobile. Doesn't the ES2 spec basically match OpenGL 3.3? Is there more detail that I'm missing?

Attrib.Value is int for webgl and uint for opengl?

In attempting to cross-compile a program for both WebGL and Desktop OpenGL, I've noticed that the Attrib type is uint for the former, and int for the latter. This makes it a little hard to manipulate these in a portable way.

Is there a technical reason why these are different, or could they be brought into alignment?

Fails on Raspberry Pi (go1.5 linux/arm).

go get github.com/goxjs/gl

github.com/goxjs/gl
code/go/src/github.com/goxjs/gl/gl_opengles.go:24: ContextWatcher redeclared in this block
previous declaration at code/go/src/github.com/goxjs/gl/gl_opengl.go:17
code/go/src/github.com/goxjs/gl/gl_opengles.go:26: contextWatcher redeclared in this block
previous declaration at code/go/src/github.com/goxjs/gl/gl_opengl.go:19
code/go/src/github.com/goxjs/gl/gl_opengles.go:29: contextWatcher.OnDetach redeclared in this block
previous declaration at code/go/src/github.com/goxjs/gl/gl_opengl.go:33
code/go/src/github.com/goxjs/gl/gl_opengles.go:31: ActiveTexture redeclared in this block
previous declaration at code/go/src/github.com/goxjs/gl/gl_opengl.go:38
code/go/src/github.com/goxjs/gl/gl_opengles.go:35: AttachShader redeclared in this block
previous declaration at code/go/src/github.com/goxjs/gl/gl_opengl.go:45
code/go/src/github.com/goxjs/gl/gl_opengles.go:39: BindAttribLocation redeclared in this block
previous declaration at code/go/src/github.com/goxjs/gl/gl_opengl.go:53
code/go/src/github.com/goxjs/gl/gl_opengles.go:45: BindBuffer redeclared in this block
previous declaration at code/go/src/github.com/goxjs/gl/gl_opengl.go:60
code/go/src/github.com/goxjs/gl/gl_opengles.go:49: BindFramebuffer redeclared in this block
previous declaration at code/go/src/github.com/goxjs/gl/gl_opengl.go:67
code/go/src/github.com/goxjs/gl/gl_opengles.go:53: BindRenderbuffer redeclared in this block
previous declaration at code/go/src/github.com/goxjs/gl/gl_opengl.go:74
code/go/src/github.com/goxjs/gl/gl_opengles.go:57: BindTexture redeclared in this block
previous declaration at code/go/src/github.com/goxjs/gl/gl_opengl.go:81
code/go/src/github.com/goxjs/gl/gl_opengles.go:57: too many errors`

headless

any plans to support headless gl ?

JS TexImage2D produces TypeError

TypeError: Argument 9 of WebGLRenderingContext.texImage2D does not implement interface ArrayBufferViewOrNull on Firefox 42.0 and Uncaught TypeError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': parameter 9 is not of type 'ArrayBufferView' on Chrome 48.0.2564.109.

AFAIK the data parameter of gl.TexImage2D is a []byte which becomes a Uint8Array in GopherJS... which should satisfy the WebGL standard which calls for an ArrayBufferView.

For comparison, gl.BufferData takes a []byte and works fine. The only difference I can see is that the WebGL spec for bufferData specifies a BufferDataSource? (which is defined as an ArrayBufferView or an ArrayBuffer in the spec) and not an ArrayBufferView? type for the data parameter.

README: stop suggesting GOARCH=js go get since it no longer works

I am sorry, this may be very basic but I am trying to use this library and I try to run

GOARCH=js go get -u -d github.com/goxjs/gl/...

I get unsupported GOOS/GOARCH pair darwin/js I have tried a series of pairs like js/js or /js or js/darwin and I get the same message everytime.

Am I doing something wrong? does the library need to be updated?

Maintenance and Supersession

This package is fully functional, but may eventually become superceded by the new x/mobile/gl plan.

Yet, over 4 years after that sentence was written, I couldn't find any updates on WebGL support being added to the golang.org/x/mobile/gl package.

Is there actually any work at all being done with that (and I just missed it), or is supersession by x/mobile/gl entirely a hypothetical?

If it's the latter, it might be about time that the README sees another update to more accurately reflect the current state of this package..?

go 1.6 cgocheck

golang/go#12416

Go 1.6 will be released end of this month and reject passing go memory block to cgo. Do you have any plant to support 1.6?

panic: runtime error: cgo argument has Go pointer to Go pointer

goroutine 1 [running, locked to thread]:
github.com/go-gl/gl/v2.1/gl.ShaderSource(0x100000002, 0xc82002e088, 0x0)
    /Users/shibukawa.yoshiki/gopath/src/github.com/go-gl/gl/v2.1/gl/package.go:24310 +0x4c
github.com/goxjs/gl.ShaderSource(0xc800000002, 0xc82009e1e0, 0x1ce)
    /Users/shibukawa.yoshiki/gopath/src/github.com/goxjs/gl/gl_opengl.go:861 +0xc0
github.com/shibukawa/nanovgo.(*glShader).createShader(0xc82008c000, 0x42ccda0, 0x6, 0x4365cc0, 0x33, 0x0, 0x0, 0x4517840, 0x199, 0x4518040, ...)
    /Users/shibukawa.yoshiki/gopath/src/github.com/shibukawa/nanovgo/gl_backend.go:41 +0x182
github.com/shibukawa/nanovgo.(*glParams).renderCreate(0xc82000a410, 0x0, 0x0)
    /Users/shibukawa.yoshiki/gopath/src/github.com/shibukawa/nanovgo/gl_backend.go:409 +0x259
github.com/shibukawa/nanovgo.createInternal(0x4d442e0, 0xc82000a410, 0x45efde0, 0x0, 0x0)
    /Users/shibukawa.yoshiki/gopath/src/github.com/shibukawa/nanovgo/nanovgo.go:1362 +0x421
github.com/shibukawa/nanovgo.NewContext(0x0, 0x4514828, 0x0, 0x0)
    /Users/shibukawa.yoshiki/gopath/src/github.com/shibukawa/nanovgo/gl_backend.go:25 +0xe1
main.main()
    /Users/shibukawa.yoshiki/gopath/src/github.com/shibukawa/nanovgo/sample/sample.go:45 +0x19e

(tested my sample code with go 1.6 beta1 on Mac)

WebGL GetIntegerv: not yet tested [Confirmed Functional]

Wanted to give some feedback that this seems to be functional. I will probably be confirming a few more of these over the next few days.

gl.GetIntegerv(gl.VIEWPORT, viewport)

returns [0 0 300 150] and I checked my context and it says WebGLRenderingContext {canvas: canvas, drawingBufferWidth: 300, drawingBufferHeight: 150}

Can't get second attribute location

Hi,
I took the triangle example and just added the lines bellow:
...
attribute vec3 aVertexPosition;
attribute vec3 aVertexPosition2;
...
vertexPositionAttrib := gl.GetAttribLocation(program, "aVertexPosition")
fmt.Printf("vertexPositionAttrib = %d", vertexPositionAttrib)
vertexPositionAttrib2 := gl.GetAttribLocation(program, "aVertexPosition2")
fmt.Printf("vertexPositionAttrib2 = %d", vertexPositionAttrib2)

...

I build it with gopherjs and the value of vertexPositionAttrib2 is -1.

Did I missed something?

Regards,

Marc

Unable to Get Current Frame Buffer In Webgl

There are points where I need to get the current frame buffer, bind another, then bind the first one however right now it is not really possible to do that in web gl. Normally I would call gl.GetInteger(gl.FRAMEBUFFER_BINDING) but that always returns 0 and wont allow me to bind to it. According to this https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindFramebuffer I would need to call getParameter on the context to get the current frame buffer. It is hard to name a solution to this since adding a GetCurrentFrameBuffer() method would change the whole api. Also I was thinking exposing the context so I can call any function on it but again that does not work for a uniform API.

Let me know if I have missed a solution, that could be possible as well.

Update to newest "golang.org/x/mobile/gl"

I'm currently investigating my options for writing an OpenGL application for both desktop and web and this repository seems the be the best candidate - good work!

It is a while since it was forked from "golang.org/x/mobile/gl" and it seems that there were quite some major changes - adding WebGL support wasn't one of them.
One change I like particularly is the render-thread: Applications use a glctx-object that exposes the OpenGL functionality, but the calls to that context are only pushed into a channel and executed later by a dedicated render thread. This improves multithreading / go-routine support greatly.

I'm not able to use "golang.org/x/mobile/gl" due to the lack of WebGL support (I don't need to support mobile). And I also don't like the fact that desktop applications require the ANGLE dlls instead of using the OpenGL bindings from go-gl - but I can live with that.

Is it possible for goxjs to adapt those features or to be updated to the newest version of golang.org/x/mobile/gl?
Which changes would be required to do so?

Does anyone want Windows support?

Right now this package supports OS X, Linux, and browsers.

Windows is currently not supported. I can add it very easily, it would take me an hour or so, but I wouldn't want to spend time on it unless people actually want/need it (I don't use Windows myself).

If you're using this package (or considering it) and want Windows backend added, just leave a +1 here.

Suggestion: add basic examples.

any chance on getting some basic examples, to have a base to work from ?

i am quite excited about this project and eager to see how well opengl and webgl can work together.

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.