FIXED - my mistake in Blender. Topic can be deleted
---
hello,
my problem: I have ball object rendered In Blender. I set texture from file file png 1024x800 and one img cover whole "ball"
after convert into ball.h and included into project Ball generate "on screen" correctly but with texture I have problem. There is no single img on ball but 2880 images on every small triangle surface :(
ball.h here is part of it:
unsigned int fNumVerts = 2880; float fVerts [] = { // f 92/1 1/2 482/3 -1.24481327942899e-08, -0.5, 4.25311203573586e-08, 0.0956704875518672, -0.4903925, -0.0190299574688796, 0.0975449875518672, -0.4903925, 4.25311203573586e-08, // f 468/1 15/2 76/3 0.0975449875518672, 0.4903925, 4.25311203573586e-08, 0.0956709875518672, 0.4903925, -0.0190299574688796, -1.24481327942899e-08, 0.5, 4.25311203573586e-08, // f 15/1 16/2 76/3 0.0956709875518672, 0.4903925, -0.0190299574688796, 0.0901199875518672, 0.4903925, -0.0373289574688796, -1.24481327942899e-08, 0.5, 4.25311203573586e-08, ... .... ..... float fTexCoords [] = { // f 92/1 1/2 482/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 468/1 15/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 15/1 16/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 30/1 1/2 92/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 92/1 31/2 30/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 16/1 45/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 45/1 46/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 92/1 60/2 31/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 92/1 61/2 60/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 46/1 75/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 75/1 77/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 92/1 91/2 61/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 92/1 93/2 91/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 77/1 107/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 107/1 108/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 92/1 122/2 93/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 92/1 123/2 122/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 108/1 137/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 137/1 138/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 92/1 152/2 123/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 92/1 153/2 152/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 138/1 167/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 167/1 168/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 92/1 182/2 153/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 92/1 183/2 182/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 168/1 197/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 197/1 198/2 76/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 92/1 212/2 183/3 0.000000, 1, 1.000000, 1, 1.000000, 0, // f 92/1 213/2 212/3 0.000000, 1, 1.000000, 1, 1.000000, 0, ... ... ...
and cpp file part:
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &fVerts[0]); glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &fTexCoords[0]); glEnableVertexAttribArray(vertexHandle); glEnableVertexAttribArray(textureCoordHandle); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, thisTexture1->mTextureID); glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjection.data[0] ); // draw data glDrawArrays(GL_TRIANGLES, 0, fNumVerts);
I know this topic is really old, but can you tell me what had you done to fix this problem? I've been having it for weeks and I have no idea what to do to solve it.
Best Regards,
Renan.