Vertex Buffer & Rotation
Hello everyone,
due to heavy performance issues I had within my project, I decided to rewrite all of my drawing functions and use Vertex Buffers (respective: VBOs, depending on graphic card).
After I got behind on how Vertex Buffers work it was like: "Wohooo! I'm in FPS heaven!". I got up from ~28 Frames to 150-200 Frames - so I was pretty sadisfied with the result.
So, now let's get to the problem I have (there always has to be one):
I'm using two vertex buffers - one for the world itself, and the other one for all of my sprites.
First I draw my world, then the sprites (consisting of two triangles with an alpha TGA texture) - both with absolute world coordinates.
I want the sprites to always face the camera. With my old algorithm, where all of my coordinates were relative, I translated to the center of the sprite and rotated by the negative amount of my world rotation around the z-axis - which worked.
But now, since I'm using world coordinates for my sprites I can't do it like this...as soon as I start rotating my world, the sprites will rotate into nirvana.
Can anyone help?
Sorry, for this is probably a newbish question again, but as soon as it comes to mathematics, my brain transforms into a big question mark ;)
Thanks in advance
sorry, but sprites and VBO's doesn't really like each other.
IT is possible to fix what you are doing(i dont know how).
But since you are redoing the rotations for every frame the great VBO speed enhancement will go lost.
You could use the pointsprite thingey though.
Witch by the way can be accelerated with VBO.
IT is possible to fix what you are doing(i dont know how).
But since you are redoing the rotations for every frame the great VBO speed enhancement will go lost.
You could use the pointsprite thingey though.
Witch by the way can be accelerated with VBO.
www.flashbang.se | www.thegeekstate.com | nehe.gamedev.net | glAux fix for lesson 6 | [twitter]thegeekstate[/twitter]
You can use dynamic VBOs, which are still much faster than immediate functions or as the previous poster suggested you could also use point sprites (but they are limited to squares afaik)
Thank you guys :D
A limitation to squares wouldn't be too big of a problem.
Do you, by any chance, have any links to literature about dynamic VBOs/point sprites?
A limitation to squares wouldn't be too big of a problem.
Do you, by any chance, have any links to literature about dynamic VBOs/point sprites?
http://oss.sgi.com/projects/ogl-sample/registry/ARB/point_sprite.txt is as good a place as any to start.
pointsprites are easy to implement.
the parent site is full of goodies
http://oss.sgi.com/projects/ogl-sample/registry/
pointsprites are easy to implement.
the parent site is full of goodies
http://oss.sgi.com/projects/ogl-sample/registry/
www.flashbang.se | www.thegeekstate.com | nehe.gamedev.net | glAux fix for lesson 6 | [twitter]thegeekstate[/twitter]
Ok, point sprites would basicly be exactly what I'm looking for.
But from what I see, point sprites align themselves towards the camera over every axis - which is logical, since they were designed for particle engines.
This would mean: if i use point sprites for rendering "normal" sprites, they will always face the camera, even if i fly over them.
I don't believe so, but is there any way to limit the rotation to only one axis (like axis aligned billboards)?
But from what I see, point sprites align themselves towards the camera over every axis - which is logical, since they were designed for particle engines.
This would mean: if i use point sprites for rendering "normal" sprites, they will always face the camera, even if i fly over them.
I don't believe so, but is there any way to limit the rotation to only one axis (like axis aligned billboards)?
not for point sprites.
they are infact not billboards at all but rather a large point with a texture on it, the only thing affected by the model and projection matrics is the central point.
thus they are not treated as polygons, allthough some OGL drivers convert them to polys internaly.
If you want axis aligned billboards, then you have to do it yoursef, there are no shortcuts for those.
Except for shaders, a well designed vertex shader could do the job for you.
they are infact not billboards at all but rather a large point with a texture on it, the only thing affected by the model and projection matrics is the central point.
thus they are not treated as polygons, allthough some OGL drivers convert them to polys internaly.
If you want axis aligned billboards, then you have to do it yoursef, there are no shortcuts for those.
Except for shaders, a well designed vertex shader could do the job for you.
www.flashbang.se | www.thegeekstate.com | nehe.gamedev.net | glAux fix for lesson 6 | [twitter]thegeekstate[/twitter]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement