Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: OpenGL VBOs  (Read 3503 times)

0 Members and 1 Guest are viewing this topic.

sknnywhiteman

  • Newbie
  • *
  • Posts: 38
    • View Profile
    • Email
OpenGL VBOs
« on: June 29, 2012, 08:28:05 pm »
I've been reading around recently about how people render things in OpenGL, and I see that most people who have been working with OpenGL for a while have been using Vertex Buffer Obects. I became interested in them and started reading around people's OpenGL code to create it. I tried using them, however, and I'm not able to use any functions like glGenBuffers(1, &IndexVBOID), and glBindBuffer(GL_ARRAY_BUFFER, VertexVBOID). Does anybody else use VBOs with SFML or know of any way to use them? I could use Glut if I needed to, but I'd rather not.
If anyone could help me, it'd be appreciated greatly! :D

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: OpenGL VBOs
« Reply #1 on: June 29, 2012, 09:51:50 pm »
VBO are an extension of OpenGL, so you need to include glew.h (which will include OpenGL for you)
http://glew.sourceforge.net/install.html
(Don't worry, you don't need GLUT)

sknnywhiteman

  • Newbie
  • *
  • Posts: 38
    • View Profile
    • Email
Re: OpenGL VBOs
« Reply #2 on: June 29, 2012, 10:35:21 pm »
Okay. I got glew, now... For glew32.dll, should I include that in only system32 or is that a library I need to bring with my code like the SFML binaries?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: OpenGL VBOs
« Reply #3 on: July 01, 2012, 09:25:54 am »
SFML 2 provides a low-level API that lets you render objects with vertex arrays (sf::VertexArray). Maybe you don't need to use OpenGL for the task you try to achieve.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: OpenGL VBOs
« Reply #4 on: July 02, 2012, 03:29:15 pm »
We at SFGUI have made extensive/exclusive use of VBOs for our rendering. If you are brave enough and have lots of time you can look for useful pieces of code in http://redmine.boxbox.org/projects/sfgui/repository/revisions/master/entry/src/SFGUI/Renderer.cpp

95% of it is probably irrelevant for you but I guess you can see how we made it work with SFML along with all those nasty hacks :D

We also had to use GLee instead of GLEW because of build issues in certain configurations.

A word of warning: Using VBOs with SFML is associated with many many pitfalls. Do not expect to get it working until after a very long time and numerous sessions of reading through SFML source.

I would thoroughly assess the situation first and ask if VBOs are really needed and if they would even cause a performance increase. As Nexus said SFML provides a "low-level" API that wraps around OpenGL's own Vertex Arrays so it isn't really that low level anymore. If that suffices for you then I would recommend you use that instead.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: OpenGL VBOs
« Reply #5 on: July 02, 2012, 03:38:36 pm »
Quote
A word of warning: Using VBOs with SFML is associated with many many pitfalls. Do not expect to get it working until after a very long time and numerous sessions of reading through SFML source.
Anything that can be improved in SFML?
Laurent Gomila - SFML developer

sknnywhiteman

  • Newbie
  • *
  • Posts: 38
    • View Profile
    • Email
Re: OpenGL VBOs
« Reply #6 on: July 04, 2012, 02:08:33 am »
Maybe you don't need to use OpenGL for the task you try to achieve.
I probably don't NEED to use OpenGL, but I'm doing it for a learning experience, mostly.

A word of warning: Using VBOs with SFML is associated with many many pitfalls. Do not expect to get it working until after a very long time and numerous sessions of reading through SFML source.

I've gotten it to work pretty well. I of course haven't gotten really far in-depth, but I've has success with it without any problems, once I learned how to use them.

I probably don't NEED to use VBOs, but I'm just creating a 2D tilemap game, rendering chunks a lot faster than before, with close to 2000 vertices per-chunk. before VBOs, I was just using the simple "glBegin(GL_QUADS);", which I have read from all over the internet that it's a big no-no, and that the most standard way of rendering after OpenGL core 3 is VBOs. So, I'm just doing this as a learning experience so I can fully grasp VBOs and maybe do something much more worth while in the future.

Thanks everyone for your help! :D

 

anything