<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br></div><div>On May 20, 2014, at 11:36 AM, Michael Baker <<a href="mailto:michaeltbaker@gmail.com">michaeltbaker@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 19, 2014 at 11:43 PM, Anthony Cowley <span dir="ltr"><<a href="mailto:acowley@gmail.com" target="_blank">acowley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><br>
> On May 20, 2014, at 12:20 AM, Michael Baker <<a href="mailto:michaeltbaker@gmail.com">michaeltbaker@gmail.com</a>> wrote:<br>
><br>
> I'm using OpenGLRaw and I'm getting 3 frames per second trying to draw 8000 triangles. When I profile the application, I see that almost all of the time is taken by a call to CGLFlushDrawable, which is apparently OSX's function for swapping the back buffer to the front buffer.<br>

<br>
</div>Can you put the code somewhere so we can take a look? OpenGL offers 8000 ways to draw 8000 triangles.<br>
<br>
Anthony<br>
<div class=""><br>
<br>
><br>
> Has anyone else run into a problem like this? I seem to recall a thread a while ago about a Haskell specific OpenGL performance issue, but I can't find it now.<br>
</div>> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div><div class="gmail_extra">Here's the code <a href="https://gist.github.com/MichaelBaker/4429c93f2aca04bc79bb">https://gist.github.com/MichaelBaker/4429c93f2aca04bc79bb</a>. I think I have everything important in there. Line 53 is the one that causes the slow down. I guess some things to note are that "Triangle" is Storable and the vector I'm creating on line 14 and writing to on line 47 is a mutable storable vector.<br></div></div></div></blockquote><div><br></div><div>I would avoid setting the buffer data every frame like this. You should create your VBO once, then map it, update the data, and unmap it every frame if all your geometry really does change every frame. </div><div><br></div><div>Don't use a list for your geometry if you can avoid it.</div><div><br></div><div>Consider using VAOs to keep track of enabled attributes, etc.</div><div><br></div><div>Unsurprisingly, I'd recommend taking a look at the vinyl-gl tutorial for most of those considerations, though I don't think I say anything about mapping buffers there.</div><div><br></div><div>Anthony</div><div><br></div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra">
</div><div class="gmail_extra"><br></div><div class="gmail_extra">Also, thanks Alp, I'll look into this when I get home. Although I don't think my computer has more than one graphics card (it's a Macbook Air).</div>
</div>
</div></blockquote></body></html>