您可以将结构加载到成员变量为私有的 vbo 中吗?
更新
这个问题很笼统,没有样本,因为我不知道如何提出具体问题。下面的答案正是我所寻找的。但对于那些不想看到引发问题的代码的人来说:
#ifndef POINT2D_H_INCLUDED
#define POINT2D_H_INCLUDED
#include <glext.h>
namespace glext
{
/*! \class Point 2D class geometry based
* \brief This class defines a 2D point_2d
*
* Some details about the Test class
*/
template <typename T>
class point_2d
{
private:
/// The first element in the ordered pair
T _x;
/// The second element in the ordered pair
T _y;
public:
/*! \brief default constructor sets both elements in ordered pair to 0
*/
point_2d();
/*! \brief constructor sets both elements to the paramaters provided
*/
point_2d(const T &x, const T &y);
/*! \brief copy constructor sets both elements in ordered pair to 0
*/
point_2d(const point_2d &rhs);
/*! \brief destructor
*/
~point_2d();
/*! \brief assignment uses copy-swap idiom
*/
point_2d &operator=(point_2d rhs);
/*! \brief setter for x element
*/
void x(const T &x);
/*! \brief setter for y element
*/
void y(const T &y);
/*! \brief setter for both x and y element
*/
void x_and_y(const T &x, const T &y);
/*! \brief swizzle for both x and y returns a copy of a point_2d
*/
point_2d xy() const;
/*! \brief swizzle for x element returns a copy of a point_2d
*/
point_2d xx() const;
/*! \brief swizzle for y element returns a copy of a point_2d
*/
point_2d yy() const;
/*! \brief swizzle for reverse of y and x returns a copy of a point_2d
*/
point_2d yx() const;
/*! \brief getter for x element returns a reference to x of type T
*/
T& x() const;
/*! \brief getter for y element returns a reference to y of type T
*/
T& y() const;
};
template <typename T>
void swap(point_2d<T> &lhs, point_2d<T> &rhs);
template <typename T>
bool operator<(const point_2d<T> &lhs, const point_2d<T> &rhs);
template <typename T>
bool operator>(const point_2d<T> &lhs, const point_2d<T> &lhs);
template <typename T>
bool operator==(const point_2d<T> &lhs, const point_2d<T> &rhs);
template <typename T>
bool operator!=(const point_2d<T> &lhs, const point_2d<T> &rhs);
}
#include "type_point_2d_2d.inl"
#endif