Commit 5342c08c authored by Jan Möbius's avatar Jan Möbius
Browse files

Fixed wrong number of elements

Use different allocation

closes #1231

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15833 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 43e33317
......@@ -62,15 +62,9 @@ GLPrimitive::GLPrimitive() :
vbo_(0)
{
VertexElement elemArray[] = { {GL_FLOAT, 3, VERTEX_USAGE_POSITION, 0, {0} },
{GL_FLOAT, 3, VERTEX_USAGE_NORMAL, 0, {12} },
{GL_FLOAT, 2, VERTEX_USAGE_TEXCOORD, 0, {24} }};
vertexDecl_.addElements(3, elemArray);
// vertexDecl_.addElement(GL_FLOAT, 3, VERTEX_USAGE_POSITION);
// vertexDecl_.addElement(GL_FLOAT, 3, VERTEX_USAGE_NORMAL);
// vertexDecl_.addElement(GL_FLOAT, 2, VERTEX_USAGE_TEXCOORD);
vertexDecl_.addElement(GL_FLOAT, 3, VERTEX_USAGE_POSITION);
vertexDecl_.addElement(GL_FLOAT, 3, VERTEX_USAGE_NORMAL);
vertexDecl_.addElement(GL_FLOAT, 2, VERTEX_USAGE_TEXCOORD);
}
//------------------------------------------------------------------------
......
......@@ -79,13 +79,16 @@ void VertexDeclaration::addElement(unsigned int _type,
const char* _shaderInputName,
unsigned int _byteOffset)
{
VertexElement ve;
ve.type_ = _type;
ve.numElements_ = _numElements;
ve.usage_ = _usage;
ve.shaderInputName_ = _shaderInputName;
ve.byteOffset_ = _byteOffset;
addElement(&ve);
VertexElement* ve = new VertexElement();
ve->type_ = _type;
ve->numElements_ = _numElements;
ve->usage_ = _usage;
ve->shaderInputName_ = _shaderInputName;
ve->byteOffset_ = _byteOffset;
addElement(ve);
delete ve;
}
......@@ -272,7 +275,7 @@ void VertexDeclaration::activateShaderPipeline(GLSL::Program* _prog) const
unsigned int numElements = getNumElements();
unsigned int vertexStride = getVertexStride();
for (unsigned int i = 0; i < 1; ++i)
for (unsigned int i = 0; i < numElements; ++i)
{
const VertexElement* pElem = &elements_[i];
......
......@@ -283,4 +283,4 @@ private:
#endif // ACG_VERTEXDECLARATION_HH defined
\ No newline at end of file
#endif // ACG_VERTEXDECLARATION_HH defined
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment