By fooshi
on Fri, 03/08/2013 - 15:01
Hi, I have converted an .obj but i have a problem with the texture which is not well mapped ! Here is my source code : // Clear colour and depth buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); // Lumiere glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_LIGHT1); glEnable(GL_LIGHT2); glEnable(GL_LIGHT3); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_SRC_COLOR);glCullFace(GL_BACK); // OpenGL 2 QCAR::Matrix44F modelViewProjection; // Roulette Fixe ShaderUtils::translatePoseMatrix(0.0f, 0.0f, 0.0f, &modelViewMatrix.data[0]); ShaderUtils::scalePoseMatrix(RFScale, RFScale, RFScale , &modelViewMatrix.data[0]); ShaderUtils::multiplyMatrix(&qUtils.projectionMatrix.data[0], &modelViewMatrix.data[0], &modelViewProjection.data[0]); glUseProgram(shaderProgramID); glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)RouletteFixe.vertices); glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)RouletteFixe.normals); glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)RouletteFixe.texCoords); glEnableVertexAttribArray(vertexHandle); glEnableVertexAttribArray(normalHandle); glEnableVertexAttribArray(textureCoordHandle); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, [RouletteFixe.texture textureID]); glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (const GLfloat*)&modelViewProjection.data[0]); glUniform1i(texSampler2DHandle, 0 /*GL_TEXTURE0*/); glDrawArrays(GL_TRIANGLES, 0, RouletteFixe.numVertices); Here a screenshot of the problem : http://hpics.li/631cd45 Thank you for your help !
Problem with the texture
Hi, it could be that you need to flip your texture vertically (we have seen this issue other times);
just edit your image with any image editor and flip it upside down.
Chances are that it will fix the problem.
Problem with the texture
Thank you !! It has fixed my problem !! :-)
Problem with the texture
You're welcome ;-)