haskell-opengl / glut Goto Github PK
View Code? Open in Web Editor NEWHaskell bindings to GLUT
Home Page: http://www.haskell.org/haskellwiki/OpenGL
License: BSD 3-Clause "New" or "Revised" License
Haskell bindings to GLUT
Home Page: http://www.haskell.org/haskellwiki/OpenGL
License: BSD 3-Clause "New" or "Revised" License
This bit of initialisation code doesn't work. The key presses seem to be still repeating. Is there any fix or known workarounds for the same?
Hi, I wanted to tell you that this Tutorial here ( https://wiki.haskell.org/OpenGLTutorial1 ) is not up to date, since neither color3f
nor vertex3f
(used near the bottom of the page) are accessible that way anymore.
Hello,
Would it be possible to modify https://github.com/haskell-opengl/GLUT/blob/master/examples/RedBook8/Chapter01/Triangles.hs so that it demonstrates how to create and assign vertex colors for the triangles in the example?
It is one of the cleanest examples of code I could find so far, but it is missing an important component (vertex colors). I really would like to know how to achieve that.
Regards,
Vlad
I'd like to be able to use opengl/GLUT from the ghci prompt. On Mac OS 10.9.2 with ghc 7.8.2 once I invoke main on the programs in the tutorial at http://www.haskell.org/haskellwiki/OpenGLTutorial1 or http://www.haskell.org/haskellwiki/OpenGLTutorial2 I can't get back to the ghci prompt, all I can do is Quit out of the icon in the doc which kills my Haskell program. Starting ghci with -fno-ghci-sandbox doesn't help.
Is this how it is supposed to work or is this a bug? At http://www.haskell.org/haskellwiki/OpenGLTutorial1 it does say: "Alas, on some platforms GHCi has problems running the following programs, so you might have to compile them with GHC and run the generated executables instead." but it gives no details on which platforms and what ghc versions this occurs and what the symptoms are. Nor does it refer to a ghc ticket or any other bug report.
I had problems in the past with with this, generally crashes with segmentation faults. I got the impression that this would be fixed with dynamic linking in 7.8.2 so trying again. There is a discussion on the ghc-devs mailing list of dynamic linking, foreign libraries and ghci on ghc dev so it would be great if any of the maintainers could join that discussion and give your thoughts and details of your experience and the current status on 7.8.2
I'm currently building a project on OSX and finding that I can't actually get freeGLUT linking. The installed system version of GLUT is always being used.
Just to confuse matters, I'm also using stack to build and have install freeGLUT with brew.
I realise that OSX is its own special flavour of awkward for this type of thing, but I feel like there should just be some ghc-options flags that I should be able to pass that will make it clear I want to build against freeGLUT and not the system framework. Just can't seem to figure out what they are.
Currently I'm telling stack to explicitly pass ghc the -lGLUT flag, but that doesn't seem to be doing the trick.
https://github.com/rumblesan/improviz/blob/master/stack.yaml#L62-L69
When I enable a single example in the cabal file and try to build I get the following error:
Build profile: -w ghc-9.8.2 -O1
In order, the following will be built (use -v for more details):
- GLUT-2.7.0.16 (lib) (configuration changed)
- GLUT-2.7.0.16 (exe:RedBook4-Hello) (configuration changed)
Configuring library for GLUT-2.7.0.16..
Preprocessing library for GLUT-2.7.0.16..
Building library for GLUT-2.7.0.16..
Configuring executable 'RedBook4-Hello' for GLUT-2.7.0.16..
Preprocessing executable 'RedBook4-Hello' for GLUT-2.7.0.16..
Building executable 'RedBook4-Hello' for GLUT-2.7.0.16..
[2 of 2] Linking /Users/xyz/proj/GLUT/dist-newstyle/build/aarch64-osx/ghc-9.8.2/GLUT-2.7.0.16/x/RedBook4-Hello/build/RedBook4-Hello/RedBook4-Hello
ld: Absolute addressing not allowed in arm64 code but used in '_Lcapw_info' referencing '_GLUTzm2zi7zi0zi16zminplace_GraphicsziUIziGLUTziRawziCallbacks_makeDisplayFunc1_closure'
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
ghc: `clang' failed in phase `Linker'. (Exit code: 1)
Error: cabal: Failed to build exe:RedBook4-Hello from GLUT-2.7.0.16.
I try the minimal hello-world in glut (copied from the wiki) and run it in ghci.
When I close the window (esc is not available) ghci closes.
Is there a procedure to have glut
run in ghci repeatedly? Thank you!
GHCi, version 8.10.7
GLUT 2.7.0.16
haskell ghc-8.10.7
GLUT/src/Graphics/UI/GLUT/Fonts.hs
Lines 58 to 62 in 95db3fd
For a stroke font, return the width in units.
Should this be: "For a stroke font, return the height in units."
Hi, I got tripped up by stride when trying to modify this example to use Vertex4s instead of Vertex2s. I suggest a change such that stride is calculated:
let firstIndex = 0
vPosition = AttribLocation 0
vertexAttribPointer vPosition $=
(ToFloat, VertexArrayDescriptor 2 Float (fromIntegral $ sizeOf (head vertices)) (bufferOffset firstIndex))
vertexAttribArray vPosition $= Enabled
This package automatically uses freeglut on macOS Sierra 10.12.5, which is unpractical, since using FreeGLUT on a mac means that you have to install a X server. The changelog only states that it is possible to link against FreeGLUT, while it seems to be selected AND INSTALLED by default, which is also strange, since GLUT is shipped with macs. Is there a compilation flag to prevent that, or anything?
When I depend on the GLUT
Haskell package (2.6
or newer) on GHC 7.10.1
on OS X 10.9.5
, the GLUT package builds and installs successfully, but applications that depend on GLUT
fail during cabal install
with this kind of linking error:
<command line>: can't load .so/.DLL for: .../.cabal-sandbox/lib/x86_64-osx-ghc-7.10.1/GLUT_99KmPk9UqZy96uvbsgIYcH/libHSGLUT-2.6.0.1-0sykGmIsSqkEsQwajDtfCI-ghc7.10.1.dylib (dlopen(.../.cabal-sandbox/lib/x86_64-osx-ghc-7.10.1/GLUT_99KmPk9UqZy96uvbsgIYcH/libHSGLUT-2.6.0.1-0sykGmIsSqkEsQwajDtfCI-ghc7.10.1.dylib, 5):
Symbol not found: _glutBitmap8By13
Referenced from: .../.cabal-sandbox/lib/x86_64-osx-ghc-7.10.1/GLUT_99KmPk9UqZy96uvbsgIYcH/libHSGLUT-2.6.0.1-0sykGmIsSqkEsQwajDtfCI-ghc7.10.1.dylib
Expected in: flat namespace
in .../.cabal-sandbox/lib/x86_64-osx-ghc-7.10.1/GLUT_99KmPk9UqZy96uvbsgIYcH/libHSGLUT-2.6.0.1-0sykGmIsSqkEsQwajDtfCI-ghc7.10.1.dylib)
I'm not sure whether this is GHC's fault or an interaction between OS X, GHC 7.10.1, etc., but this seemed like a good place to report this.
In cmake
you can add the flag -DFREEGLUT_GLES=ON
, per the docs. It would be nice to have that option here too.
Can we bump the Data.ByteString version to 0.10.4.0 ? Currently, attempts to compile with ByteString 0.10.4.0 installed, lead to the following error:
Prelude> :load "examples/RedBook8/Chapter01/LoadShaders.hs"
[1 of 1] Compiling LoadShaders ( examples/RedBook8/Chapter01/LoadShaders.hs, interpreted )
examples/RedBook8/Chapter01/LoadShaders.hs:46:12:
Couldn't match type bytestring-0.10.0.2:Data.ByteString.Internal.ByteString' with
B.ByteString'
Expected type: T.Text -> B.ByteString
Actual type: T.Text
-> bytestring-0.10.0.2:Data.ByteString.Internal.ByteString
In the first argument of (.)', namely
TE.encodeUtf8'
In the expression: TE.encodeUtf8 . T.pack
In an equation for `packUtf8': packUtf8 = TE.encodeUtf8 . T.pack
examples/RedBook8/Chapter01/LoadShaders.hs:75:32:
Couldn't match expected type bytestring-0.10.0.2:Data.ByteString.Internal.ByteString' with actual type
B.ByteString'
In the second argument of ($=)', namely
src'
In a stmt of a 'do' block: shaderSourceBS shader $= src
In the expression:
do { src <- getSource source;
shaderSourceBS shader $= src;
compileAndCheck shader;
attachShader program shader;
.... }
Failed, modules loaded: none.
Hi, when I want to use any of the inbuilt fonts, with runghc
or ghci
, I get:
Prelude Main> freeglut (<interactive>): stroke font 0x45f37b20 not found
This seems to be known at least to the Gloss people.
Using ghci is important for what I'm trying to do with this, so I cannot just use ghc for it unfortunately.
Is there anything we can do about this? Do you know what the restriction here is?
Hi
GLUT on Hackage has not been updated since February 5, and does not compile with GHC 7.6.
Many of the functions in Graphics.UI.GLUT.Raw.Functions are very useful and necessary; an example pertinant to my project is glutIgnoreKeyRepeat. The decision to move Graphics.UI.GLUT.Raw and submodules to the other-modules section, thus, leaves me with no way to call those very useful low level bindings without either making bindings to them in my own project or modifying this package locally.
What was the motivation for this change? Can we get it changed back?
This should be ContinueExecution. If there's a good way to fix this without breaking things, that would be good. One possibility is adding a correctly spelled constructor which mimics the behavior, but having ContinueExecution and ContinueExectuion do the same thing might be confusing. Maybe do that and mark ContinueExectuion deprecated.
GLUT version is 2.7.0.6, this feels related to the https://ghc.haskell.org/trac/ghc/ticket/10568 saga.
dlsym (used by hs_GLUT_getProcAddress
) does not find glutInit
, however the framework is actually loaded. Compiled binaries work fine.
Prelude> :m +Graphics.UI.GLUT
Prelude Graphics.UI.GLUT> getArgsAndInitialize
*** Exception: user error (unknown GLUT entry glutInit)
...
Prelude Graphics.UI.GLUT System.Posix.DynamicLinker> dlsym Default "glutInit"
*** Exception: user error (dlsym: dlsym(RTLD_DEFAULT, glutInit): symbol not found)
Starting ghci with DYLD_INSERT_LIBRARIES=/System/Library/Frameworks/GLUT.framework/GLUT
serves as a workaround, however I'm not sure what's the best way to resolve this problem properly.
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.