[Haskell-cafe] a textured quad/triangle
Oliver Charles
ollie at ocharles.org.uk
Tue Oct 21 11:12:47 UTC 2014
During 24 Days of Hackage last year, I wrote some basic code to get a
spinning triangle on screen, using VBOs and shaders. You can find the code
for this at
https://github.com/ocharles/blog/blob/master/code/2013-12-02-linear-example.hs
.
To do texturing, it's not much more complicated. My toy "hadoom" project (a
Doom-like engine in Haskell) uses texturing - but obviously there's more
code to wade through there. I think the relevant stuff will be
* Loading:
https://github.com/ocharles/hadoom/blob/420597915f115d608192cfb32e6087f7e9044732/hadoom/Material.hs#L21
* Binding:
https://github.com/ocharles/hadoom/blob/420597915f115d608192cfb32e6087f7e9044732/hadoom/Material.hs#L84
* Using in a shader:
https://github.com/ocharles/hadoom/blob/420597915f115d608192cfb32e6087f7e9044732/shaders/fragment/solid-white.glsl#L48
You'll have to do some grep'ing to see how it all fits together. You'll
also need to add UV coordinates to the triangle.
Hope this provides enough information to help you get started. If you're
comfortable on IRC, you might want to swing by #haskell-game on Freenode,
where we're trying to build a Haskell game/graphics dev community.
- ocharles
On Tue, Oct 21, 2014 at 11:24 AM, Vlad Lopatin <madjestic13 at gmail.com>
wrote:
> Hello,
>
> I am looking for a working example of texture binding, using VBOs and
> OpenGL4+ standard. A textured quad/triangle would be great. Does anybody
> have one?
>
>
> Regards,
> Vlad
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141021/6b79f288/attachment.html>
More information about the Haskell-Cafe
mailing list