howto use Vertex Buffer objects(vbo) with opengl & Qt
Posted: October 31, 2009 Filed under: Game Development | Tags: howto, openGL, qt, vbo 1 Comment »This how-to concerns, including the functions needed for using Vertex Buffer Objects or VBOs; but in Qt framework. In short, this answers questions like:
“ glGenbuffers : identifier not found error
How do I resolve this (when working in Qt)? “
This article at gamedev explains the process very well. The article is old, but I would recommend reading it since you then understand what the problem is and why is it giving you this error.
After you’re done reading that, you’d know that you are still using openGL v1.1 and need to access VBOs which is a feature of openGL v1.5. This is done by using v1.5 as extensions and interacting with the device drivers(assuming you have the latest drivers and they support v1.5), which is facilitated in code by specific function pointers.
By now, you’d know how to get this fixed if you were on a windows machine. But, I was using Qt and needed a way to get it to work with that. I came across these files:
glextensions.h and
glextensions.cpp
provided by Qt in one of there demos (boxes). These would resolve the functions you need for using VBOs. To get it to work, the code is not trivial.
After including the files in your header, one needs to “resolve()” the associated functions with a “context” (which is provided by the QGLWidget (or a class that you might have derived from it) ).
This is how I resolve them from within my class which derives from QGLWidget:
getGLExtensionFunctions().resolve(this->context() );
Functions like glGenBuffers, glBindBuffer, glBufferData etc are now ready to be used.
Also, I heard a lot of people using GLEW but I did not explore that route, so if you are stuck that might be something worthwile to checkout.
I hope it this article has saved you both, hours and tears. Let me know if you need any help.
(PS: When you call the resolve() function, the context should be available. I am still not 100% clear on how Qt manages the context for you, but I call it within InitializeGL(), since the context would be ready when the control reaches there. Also, take a look at the glextensions files to see they do pretty much the same thing as mentioned in the gamedev article )
More screenshots : My Collada renderer now supports PolyList
Posted: October 13, 2009 Filed under: Announcements, Game Development | Tags: collada 2 Comments »Yayy! Let them screenshots do the talking
(Primitive: Polylist)
More stuff coming up!
Screenie from my collada renderer / processor
Posted: October 12, 2009 Filed under: Announcements, Game Development | Tags: collada Leave a comment »While, I’ve not been posting for quite some time now, I got myself a prototype collada dae file reader and renderer working! It works for triangles primitives for now. Anyways, mumbo jumbo stuff is going to follow, but here is the screenshot of a “duck”.
| My output | Original model images |
I also have the normal, texture and color information being processed and stored per vertex (just that I was too lazy to put in the code for rendering)
Yeeehaw !
How to install CGAL (on Windows) and make it work with Visual Studio
Posted: October 2, 2009 Filed under: libs | Tags: howto Leave a comment »- Download the binary for windows at http://gforge.inria.fr/frs/?group_id=52
- Run the executable and let it roll
- After the installer is done with its thing, fire up CMake-gui
- Use in-place compilation or otherwise (I prefer to make a “new folder” and make CMake output the solution files in that folder). I will assume that you do the same.
- PS: Choose Visual Studio 200X compiler depending on whichever compiler you use.
- Once CMake is done with generating VS .sln file, open it
- Do:
- Clean Solution
- Rebuild Solution
- Just two more things need to be done now..
- Include : Goto “new folder/include/CGAL” (in the new folder where cmake output its stuff): copy compiler_config.h to the “CGAL_DIR/include/CGAL”
- Lib :
- Make a new folder “lib” in CGAL_DIR/
- Copy “new folder/Debug/” (& release if you built it in release mode) to CGAL_DIR/lib (copy the *.lib and *.pdb)
Voila~ You’re done!