Browse Source

gpu: fix the core scene renderer.

legacy
Sam Hocevar sam 12 years ago
parent
commit
560d5cc6be
3 changed files with 8 additions and 7 deletions
  1. +0
    -2
      src/gpu/vertexbuffer.cpp
  2. +1
    -1
      src/gpu/vertexbuffer.h
  3. +7
    -4
      src/scene.cpp

+ 0
- 2
src/gpu/vertexbuffer.cpp View File

@@ -231,8 +231,6 @@ void VertexDeclaration::SetStream(VertexBuffer *vb, ShaderAttrib attr1,
int type_index = m_streams[attr_index].stream_type; int type_index = m_streams[attr_index].stream_type;
if (type_index < 0 || type_index >= sizeof(tlut) / sizeof(*tlut)) if (type_index < 0 || type_index >= sizeof(tlut) / sizeof(*tlut))
type_index = 0; type_index = 0;
Log::Error("Size %d Type %d Stride %d offset %d\n", tlut[type_index].size,
tlut[type_index].type,stride,offset);


glVertexAttribPointer((GLint)reg, tlut[type_index].size, glVertexAttribPointer((GLint)reg, tlut[type_index].size,
tlut[type_index].type, GL_FALSE, tlut[type_index].type, GL_FALSE,


+ 1
- 1
src/gpu/vertexbuffer.h View File

@@ -44,7 +44,7 @@ struct VertexUsage
BlendWeight, BlendWeight,
BlendIndices, BlendIndices,
Normal, Normal,
PSize,
PointSize,
TexCoord, TexCoord,
Tangent, Tangent,
Binormal, Binormal,


+ 7
- 4
src/scene.cpp View File

@@ -380,6 +380,9 @@ void Scene::Render() // XXX: rename to Blit()
vertex + 18 * (j - i), texture + 12 * (j - i)); vertex + 18 * (j - i), texture + 12 * (j - i));
} }


data->bufs[buf]->Unlock();
data->bufs[buf + 1]->Unlock();

stdshader->Bind(); stdshader->Bind();


/* Bind texture */ /* Bind texture */
@@ -391,17 +394,17 @@ void Scene::Render() // XXX: rename to Blit()


/* Draw arrays */ /* Draw arrays */
#if defined USE_D3D9 || defined _XBOX #if defined USE_D3D9 || defined _XBOX
g_d3ddevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, (n - i) * 6);
g_d3ddevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, (n - i) * 2);
#else #else
glDrawArrays(GL_TRIANGLES, 0, (n - i) * 6); glDrawArrays(GL_TRIANGLES, 0, (n - i) * 6);


# if defined HAVE_GL_2X && !defined __APPLE__ # if defined HAVE_GL_2X && !defined __APPLE__
glBindVertexArray(0);
//glBindVertexArray(0);
# endif # endif
# if !defined __CELLOS_LV2__ // Use cgGLEnableClientState etc. # if !defined __CELLOS_LV2__ // Use cgGLEnableClientState etc.
# else # else
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
//glDisableClientState(GL_VERTEX_ARRAY);
//glDisableClientState(GL_TEXTURE_COORD_ARRAY);
# endif # endif
#endif #endif
} }


Loading…
Cancel
Save