• Best procedure for rendering 2D sprites in OpenGL?
    12 replies, posted
Which of these method's can be considered [B]most [/B] superior for 2D sprites? Please do not recommend SFML. I do not want it. Immediate Rendering? Display Lists? Vertex Arrays? or Vertex Buffering? Thank you! Also I apologize in case I made any misconceptions or mistakes in this post. :quagmire:
The first three methods you listed are all deprecated, use vertex buffers. 2D sprites are quite easy to do, you just need a basic fragment and vertex program to get it up and running. A 3D math library is not needed. :zoid:
Woah! Thanks bro! :zoid: Another thing, I haven't seen one swear word here yet, so I'm highly cautious about pulling any beeps around this place if you know what I mean.
Well, you can swear, just don't be an asshole.
What about Pixel Buffer Objects though? -> [url]http://www.songho.ca/opengl/gl_pbo.html[/url]
[QUOTE=Mordi;36063500]What about Pixel Buffer Objects though? -> [url]http://www.songho.ca/opengl/gl_pbo.html[/url][/QUOTE] How is this in any way relevant to drawing sprites?
[QUOTE=Overv;36063604]How is this in any way relevant to drawing sprites?[/QUOTE] I was told that using PBO's was a much faster way to draw 2D sprites than drawing a quad using glBegin and glEnd. Is this not correct?
[QUOTE=Mordi;36065297]I was told that using PBO's was a much faster way to draw 2D sprites than drawing a quad using glBegin and glEnd. Is this not correct?[/QUOTE]glBegin and glEnd are immediate drawing, which is slow as shit since the CPU has to upload all the data every frame (Correct me if I'm wrong). Any sort of buffer that uploads data to the GPU is probably faster than immediate drawing.
[QUOTE=dije;36158646]glBegin and glEnd are immediate drawing, which is slow as shit since the CPU has to upload all the data every frame (Correct me if I'm wrong). Any sort of buffer that uploads data to the GPU is probably faster than immediate drawing.[/QUOTE] As far as i'm aware, data is cached so data that is drawn every frame doesn't get repeatedly pushed to the graphics card unnecessarily Although, seeing as with non immediate methods you know what needs to be pushed and what doesn't, you can much more effectively cache the data on the gpu yourself, rather than leaving the implementation guessing, so quite a bit faster
[QUOTE=Icedshot;36158937]As far as i'm aware, data is cached so data that is drawn every frame doesn't get repeatedly pushed to the graphics card unnecessarily Although, seeing as with non immediate methods you know what needs to be pushed and what doesn't, you can much more effectively cache the data on the gpu yourself, rather than leaving the implementation guessing, so quite a bit faster[/QUOTE] It caches immediate mode operations? How does that work? Are you sure you're not talking about display lists? AFAIK, immediate mode with display lists was/is the fastest option (faster even than VBOs, in many cases, although it varies by implementation), since the driver can optimize every last little detail, but it's been deprecated in the newer OpenGL specs (possibly to cut down on driver complexity).
What can I do with frame buffer objects? I have also tested the overall performance between Displays Lists and VBO's and the Display Lists, and the results showed that Display Lists outperformed VBO's in terms of rendering falling 2D sprites (which in this case are pictures of Alaskan scenery and the occasional man) by a facter of 50 frames.
[QUOTE=Cockman;36192521]What can I do with frame buffer objects?[/QUOTE] You can create light, post effects, or in-game cameras using frame buffer objects. The lighting technique I tried required many different frame buffers accumulated together, but you can also make post process effects using a framebuffer. Which let you filter the final look through another shader. I've accomplished it here: [vid]http://farmpolice.com/content/videos/uEC8ZqCXJk999Yij.webm[/vid] And you can see the code I used around line 231 in [url=https://github.com/naelstrof/Astrostruct/blob/master/src/NRender.cpp]NRender.cpp[/url]. [editline]asdf[/editline] ehhe post-process shaders are so fun. [vid]http://farmpolice.com/content/videos/96FfM1ryUxJ1HI0P.webm[/vid]
[QUOTE=Cockman;36192521]What can I do with frame buffer objects?[/QUOTE] We use FBOs for practically everything these days. Even games that aren't fully deferred probably have a few full-screen buffers for modern lighting/postprocessing effects. In deferred shading, you render information about the surface properties (depth, normal, albedo, etc.) to off-screen buffers instead of directly rendering the surfaces themselves with full lighting. This effectively changes lighting complexity from O(N*M) to O(N+M), meaning you can get more lights for less cost.
Sorry, you need to Log In to post a reply to this thread.