Jump to content

  • Log In with Google      Sign In   
  • Create Account


asp_kom

Member Since 02 Mar 2012
Offline Last Active Jan 08 2013 04:57 AM
-----

Posts I've Made

In Topic: lib3ds + texture coordinates

03 March 2012 - 09:21 AM

How to rename Topic to mark it as SOLVED ? Posted Image

In Topic: lib3ds + texture coordinates

03 March 2012 - 09:17 AM

Posted Image
Error was here:
    memcpy(&texCoords[FinishedFaces*2+i][0], mesh->texcos[face->index[ i ]], sizeof(float)*2);
shoul'd be:
    memcpy(&texCoords[FinishedFaces*3+i][0], mesh->texcos[face->index[ i ]], sizeof(float)*2);
fail Posted Image

In Topic: lib3ds + texture coordinates

03 March 2012 - 08:51 AM

Compared texture coordinates, verticies and faces loaded by lib3ds and my own 3ds-loader. Everything match.
Checked texture coordinates VBO with gDebugger. Coordinates are wrong ...Posted Image

In Topic: lib3ds + texture coordinates

03 March 2012 - 01:45 AM

Here is rendering code:
shaderProg->use();
shaderProg->setUniform("MVP",float_mvp);
//shaderProg->setUniform("textureMy",(int)GL_TEXTURE0);
shaderProg->setUniform("textureMy",(int)0);
glBindBuffer(GL_ARRAY_BUFFER, ::model->getTexcoordVBO());
int m_texcord_loc = shaderProg->getAttribLocation("texcord");
glEnableVertexAttribArray(m_texcord_loc);
glVertexAttribPointer(m_texcord_loc, 2, GL_FLOAT, GL_FALSE,  0, 0);
::model->bindTexture();
	    //rendering model
::model->Draw();
	    glUseProgram(0);

rendering model:
// Enable vertex and normal arrays
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
// Bind the vbo with the normals
glf_->glBindBuffer(GL_ARRAY_BUFFER, m_NormalVBO);
// The pointer for the normals is NULL which means that OpenGL will use the currently bound vbo
glNormalPointer(GL_FLOAT, 0, NULL);
glf_->glBindBuffer(GL_ARRAY_BUFFER, m_VertexVBO);
glVertexPointer(3, GL_FLOAT, 0, NULL);
// Render the triangles
glDrawArrays(GL_TRIANGLES, 0, m_TotalFaces * 3);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);

PARTNERS