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

Finished per vertex texturing (2d coordinates)

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8460 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 4b3df7ca
...@@ -177,8 +177,8 @@ availableDrawModes() const { ...@@ -177,8 +177,8 @@ availableDrawModes() const {
if ( mesh_.has_vertex_texcoords2D() ) { if ( mesh_.has_vertex_texcoords2D() ) {
drawModes |= DrawModes::SOLID_TEXTURED; drawModes |= DrawModes::SOLID_TEXTURED;
// if (mesh_.has_vertex_normals()) if (mesh_.has_vertex_normals())
// drawModes |= DrawModes::SOLID_TEXTURED_SHADED; drawModes |= DrawModes::SOLID_TEXTURED_SHADED;
} }
return drawModes; return drawModes;
...@@ -352,7 +352,7 @@ draw(GLState& _state, unsigned int _drawMode) { ...@@ -352,7 +352,7 @@ draw(GLState& _state, unsigned int _drawMode) {
} }
if ( ( _drawMode & DrawModes::SOLID_TEXTURED ) && mesh_.has_vertex_texcoords2D()) if ( ( _drawMode & DrawModes::SOLID_TEXTURED ) && mesh_.has_vertex_texcoords2D())
{ {
///\todo enableTexCoords_ ///\todo enableTexCoords_
enable_arrays(VERTEX_ARRAY | TEXCOORD_VERTEX_ARRAY ); enable_arrays(VERTEX_ARRAY | TEXCOORD_VERTEX_ARRAY );
...@@ -365,6 +365,18 @@ draw(GLState& _state, unsigned int _drawMode) { ...@@ -365,6 +365,18 @@ draw(GLState& _state, unsigned int _drawMode) {
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
} }
if ( ( _drawMode & DrawModes::SOLID_TEXTURED_SHADED ) && mesh_.has_vertex_texcoords2D() && mesh_.has_vertex_normals())
{
enable_arrays(VERTEX_ARRAY | NORMAL_VERTEX_ARRAY | TEXCOORD_VERTEX_ARRAY);
glEnable(GL_TEXTURE_2D);
glEnable(GL_LIGHTING);
glShadeModel(GL_SMOOTH);
glDepthRange(0.01, 1.0);
draw_faces(PER_VERTEX);
glDepthRange(0.0, 1.0);
glDisable(GL_TEXTURE_2D);
}
enable_arrays(0); enable_arrays(0);
// Unbind all remaining buffers // Unbind all remaining buffers
...@@ -421,6 +433,9 @@ draw_faces(FaceMode _mode) { ...@@ -421,6 +433,9 @@ draw_faces(FaceMode _mode) {
typename StripProcessorT<Mesh>::StripsIterator strip_last = stripProcessor_.end(); typename StripProcessorT<Mesh>::StripsIterator strip_last = stripProcessor_.end();
for (; strip_it!=strip_last; ++strip_it) { for (; strip_it!=strip_last; ++strip_it) {
if ( stripProcessor_.perFaceTextureIndexAvailable() )
std::cerr << "Todo : Set right texture before rendering this stip,Check for bound Arrays!" << std::endl;
glDrawElements(GL_TRIANGLE_STRIP, glDrawElements(GL_TRIANGLE_STRIP,
strip_it->indexArray.size(), strip_it->indexArray.size(),
GL_UNSIGNED_INT, GL_UNSIGNED_INT,
......
...@@ -220,18 +220,6 @@ draw(GLState& _state, unsigned int _drawMode) ...@@ -220,18 +220,6 @@ draw(GLState& _state, unsigned int _drawMode)
glDepthRange(0.0, 1.0); glDepthRange(0.0, 1.0);
} }
if ( ( _drawMode & DrawModes::SOLID_TEXTURED_SHADED ) && mesh_.has_vertex_texcoords2D() && mesh_.has_vertex_normals())
{
enable_arrays(VERTEX_ARRAY | NORMAL_ARRAY | TEXTURE_COORD_2D_ARRAY);
glEnable(GL_TEXTURE_2D);
glEnable(GL_LIGHTING);
glShadeModel(GL_SMOOTH);
glDepthRange(0.01, 1.0);
draw_faces(PER_VERTEX);
glDepthRange(0.0, 1.0);
glDisable(GL_TEXTURE_2D);
}
if ( ( _drawMode & DrawModes::SOLID_1DTEXTURED ) && mesh_.has_vertex_texcoords1D()) if ( ( _drawMode & DrawModes::SOLID_1DTEXTURED ) && mesh_.has_vertex_texcoords1D())
{ {
......
Supports Markdown
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