faiface / glhf Goto Github PK
View Code? Open in Web Editor NEWopenGL Have Fun - A Go package that makes life with OpenGL enjoyable.
License: MIT License
openGL Have Fun - A Go package that makes life with OpenGL enjoyable.
License: MIT License
It would be nice to have an array uniforms. Useful for dynamic shadows when obstacles are many.
Seems it's can be done by calling gl.Uniform1fv with second param equals to desired array size in shader.go.
Something like this:
case Float:
value := value.(float32)
gl.Uniform1fv(s.uniformLoc[uniform], 1, &value)
case FloatArr:
value := value.([]float32)
length := int32(len(value))
gl.Uniform1fv(s.uniformLoc[uniform], length, &value[0])
I'm trying to test TilePix drawing to a pixel Window using xvfb which creates a headless GUI/display/browser etc etc in travis-ci.
I'm testing with -race
, and I get this data race; here is the output of the failure:
==================
--- FAIL: TestMap_DrawAll (0.42s)
testing.go:809: race detected during execution of test
==================
WARNING: DATA RACE
Write at 0x00c00000e180 by main goroutine:
github.com/faiface/glhf.(*VertexSlice).SetLen()
/home/travis/gopath/pkg/mod/github.com/faiface/[email protected]/vertex.go:66 +0xc9
github.com/faiface/pixel/pixelgl.(*GLTriangles).SetLen.func1()
/home/travis/gopath/pkg/mod/github.com/faiface/[email protected]/pixelgl/gltriangles.go:82 +0xa7
github.com/faiface/mainthread.Run()
/home/travis/gopath/pkg/mod/github.com/faiface/[email protected]/mainthread.go:44 +0xf7
github.com/faiface/pixel/pixelgl.Run()
/home/travis/gopath/pkg/mod/github.com/faiface/[email protected]/pixelgl/run.go:32 +0x64
github.com/bcvery1/tilepix_test.TestMain()
/home/travis/gopath/src/github.com/bcvery1/tilepix/map_test.go:16 +0x92
main.main()
_testmain.go:144 +0x32f
Previous read at 0x00c00000e180 by goroutine 12:
github.com/faiface/pixel/pixelgl.(*GLTriangles).Update()
/home/travis/gopath/pkg/mod/github.com/faiface/[email protected]/vertex.go:50 +0x93
github.com/faiface/pixel/pixelgl.NewGLTriangles()
/home/travis/gopath/pkg/mod/github.com/faiface/[email protected]/pixelgl/gltriangles.go:39 +0x1aa
github.com/faiface/pixel/pixelgl.(*Window).MakeTriangles()
/home/travis/gopath/pkg/mod/github.com/faiface/[email protected]/pixelgl/canvas.go:65 +0x9d
github.com/faiface/pixel.(*Drawer).Draw()
/home/travis/gopath/pkg/mod/github.com/faiface/[email protected]/drawer.go:74 +0x4b8
github.com/faiface/pixel.(*Sprite).DrawColorMask()
/home/travis/gopath/pkg/mod/github.com/faiface/[email protected]/sprite.go:87 +0x1c5
github.com/bcvery1/tilepix.(*Map).DrawAll()
/home/travis/gopath/pkg/mod/github.com/faiface/[email protected]/sprite.go:61 +0x8f1
github.com/bcvery1/tilepix_test.TestMap_DrawAll()
/home/travis/gopath/src/github.com/bcvery1/tilepix/map_test.go:98 +0x2a4
testing.tRunner()
/home/travis/.gimme/versions/go/src/testing/testing.go:865 +0x162
Goroutine 12 (running) created at:
testing.(*T).Run()
/home/travis/.gimme/versions/go/src/testing/testing.go:916 +0x651
testing.runTests.func1()
/home/travis/.gimme/versions/go/src/testing/testing.go:1157 +0xa6
testing.tRunner()
/home/travis/.gimme/versions/go/src/testing/testing.go:865 +0x162
testing.runTests()
/home/travis/.gimme/versions/go/src/testing/testing.go:1155 +0x521
testing.(*M).Run()
/home/travis/.gimme/versions/go/src/testing/testing.go:1072 +0x2e9
github.com/bcvery1/tilepix_test.TestMain.func1()
/home/travis/gopath/src/github.com/bcvery1/tilepix/map_test.go:17 +0x41
github.com/faiface/mainthread.Run.func1()
/home/travis/gopath/pkg/mod/github.com/faiface/[email protected]/mainthread.go:37 +0x34
==================
Here is the change which is generating this problem:
bcvery1/tilepix#81
Everything was fine 3 days ago, but now both my exercises with pixel engine and glhf demo show the same problem: no errors, windows is created and even filled with Clear color, but no sprites is drawed. Window updates and closes just fine, draw method is called, but no evidence off sprite
what i'm doing wrong?
win7 x64, Nvidia last drivers.
Sry for mb stupid question!
Line 266 in 82a6317
Drawing a slice forces the gl.TRIANGLES drawmode, meaning you have to revert to direct gl calls to draw points or other primitives
(I've implemented my own method for now to pass a draw mode, I'd make a pull request but I'm not sure what to call the method, I'm just using Draw2(mode uint32)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.