Jump to content

  • Log In with Google      Sign In   
  • Create Account


germangb

Member Since 17 Aug 2012
Offline Last Active Apr 23 2014 12:21 PM

Posts I've Made

In Topic: VBOs and transformation matrices

25 November 2013 - 08:50 AM

EDIT: totally misunderstood your question! As the others above have stated, you wouldn't put all geometry into a VBO. You would have a VBO per object or per surface or something. Then you would be able to draw those objects individually with separate uniforms.

 

 

In most cases your VBO will be initialized once with vertex data that's in "model space" and then you'll leave the VBO alone. When you want to transform the object into world space, you'll do that in the vertex shader. You can send your transformation matrices to the vertex shader with uniform buffers.

#version 410

in vec4 position;
in vec3 color;

out vec4 out_position;

uniform Transform {
    mat4 model_view_projection;
};

void main()
{
    out_position = position * model_view_projection;
}

In that code model_view_projection is a member of the Transform uniform buffer. On the CPU side you would make a buffer that contained your model-view-projection matrix, and then bind that buffer to the location of Transform before drawing.

 

This way you never have to update your VBO, and all transformations are done efficiently on the GPU.

 

What If I want to update the geometry? (add/remove vertices to the VBO)

 

And If I have, let's say, lots of small sprites (textured quads/triangles), a single VBO for each of them doesn't look like a good idea...


In Topic: alpha maps?

17 February 2013 - 11:54 AM

I've seen that by increasing the resolution of the alpha map, the path gets smoother, but I have to increase it a lot...


In Topic: terrain render

12 December 2012 - 09:04 AM

If your question is purely about whether or not viewport clipping is supported with each of these rendering methods, the answer is Yes. Viewport clipping is part of the rendering pipeline and it makes no difference how the triangles got to that stage of the pipeline.

But we can’t tell you in good conscience to use immediate mode nor display lists.
Immediate mode has been deprecated for ages and is terribly horribly slow. Display lists have been deprecated for a shorter period of time but are deprecated and their use is entirely discouraged not only by people who know what they are doing but also by Khronos. Considering how easy the switch is to VBO’s from display lists, there really is no reason not to do it, so I really can’t understand why you can’t just use VBO’s and be done with it.

In future versions of OpenGL you won’t even have the choice not to use VBO’s—it will be required that you do.


L. Spiro


thanks! I'll definitely go with VBOs :)

In Topic: terrain render

11 December 2012 - 12:23 PM

Using immediate mode makes slow.
It is never “okay” to use immediate mode.
Use VBO’s.


L. Spiro


yeah I know, but what about displaylists instead of VBOs?

In Topic: terrain render

10 December 2012 - 02:07 PM

Yes. viewport clipping still works in immediate mode IIRC.


won't it make the framerate drop drastically?

PARTNERS