GithubHelp home page GithubHelp logo

faiface / glhf Goto Github PK

View Code? Open in Web Editor NEW
248.0 248.0 24.0 114 KB

openGL Have Fun - A Go package that makes life with OpenGL enjoyable.

License: MIT License

Go 100.00%
go golang graphics library opengl

glhf's People

Contributors

bencarrr avatar dusk125 avatar duysqubix avatar faiface avatar wieku 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

glhf's Issues

Array uniforms feature request

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])

Data race

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

sprite draw is suddenly broken for me

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!

Drawing slice forces GL_TRIANGLES

glhf/vertex.go

Line 266 in 82a6317

gl.DrawArrays(gl.TRIANGLES, int32(i), int32(j-i))

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)

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.