PDA

View Full Version : GUI with OpenGL



Limas
11-02-2010, 05:21 AM
Hi,

I want to develop a little GUI for Games and other thing with Buttons, Scrollbars and so on. But how should I store and render the Textures? Should I use Buffer Objects or Texture Objects? Should I use Texture Mapping to map the Textures on a Polygon or should I use glDrawPixels?

What is the most efficient way to render the textures for the control elements?

Limas
11-02-2010, 11:33 AM
ok I try to ask in another way. What is fastest and most efficient way to draw a Texture?

blink
11-02-2010, 11:50 AM
Hmm... most efficient way. In Opengl you won't get a direct response for that kind of things. I can tell you how i do it though. I have vector of a struct that contains texcoord, size of a quad and some other things i want to draw for that frame and at the end i draw every widget in the same layer/frame in one pass like.



dd.blend(bf_src_alpha, bf_one_minus_src_alpha);
dd.set(rs_blending, true);
pg->use();
pg->bind(tx_location, tx);
dd.set_stream(vs_vertex, type_f32, 2, stride, &v[0].pos);
dd.set_stream(vs_texcoord, type_f32, 2, stride, &v[0].tuv);
dd.set_vertex_format(has_vertex | has_texcoord);
dd.draw(ds_quads, nv);
pg->unuse();
dd.set(rs_blending, false);


Hope it gives you an idea.