vbo.hpp 2.23 KB
Newer Older
Sylvain Thery's avatar
Sylvain Thery committed
1 2 3
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
4
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg           *
Sylvain Thery's avatar
Sylvain Thery committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
*                                                                              *
* This library is free software; you can redistribute it and/or modify it      *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your     *
* option) any later version.                                                   *
*                                                                              *
* This library is distributed in the hope that it will be useful, but WITHOUT  *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or        *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License  *
* for more details.                                                            *
*                                                                              *
* You should have received a copy of the GNU Lesser General Public License     *
* along with this library; if not, write to the Free Software Foundation,      *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.           *
*                                                                              *
20
* Web site: http://cgogn.unistra.fr/                                           *
Sylvain Thery's avatar
Sylvain Thery committed
21 22 23 24 25 26
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

namespace CGoGN
{
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
27

Sylvain Thery's avatar
Sylvain Thery committed
28 29 30
namespace Utils
{

31 32 33 34 35 36 37 38 39 40 41
template <typename T>
void VBO::updateData(std::vector<T>& data)
{
	if (m_lock)
	{
		CGoGNerr << "Error locked VBO" << CGoGNendl;
		return;
	}
	m_data_size = sizeof(T) / sizeof(float);
	m_nbElts = data.size();

42
	glBindBuffer(GL_ARRAY_BUFFER, *m_id);
43 44 45
	glBufferData(GL_ARRAY_BUFFER, m_nbElts * sizeof(T), &(data[0]), GL_STREAM_DRAW);
}

Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
46
} // namespace Utils
Sylvain Thery's avatar
Sylvain Thery committed
47

Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
48
} // namespace CGoGN