Textures Only Halfway Appear on Object

Started by
13 comments, last by zedzeek 18 years, 2 months ago
I have a wierd bug which is causing my textures to only partially apply to the objects they are supposed to attach to. Here are some screenshots of the problem: ex1.jpg (a floor) ex2.jpg (a flag) ex3.jpg (the wall of a building) If anyone knows what might cause that I would greatly appreciate it.
Regards,Braden
Advertisement
Hard to say without source code, but you might check if you are specifying your texture coords correctly.
Hmm, from the look of your screenshots all those surfaces seem to consist of two triangles, and only one of them is getting textured. You'd probably want to revise your rendering code. Hard to tell anything else from the given information

Hope this helps

Regards,
/Omid
Best regards, Omid
Well, I am importing objects from a Lightwave Object File and mostly I am getting values of zero (which I am pretty sure I shouldn't be) and some where the uv values are out of range. Then, of course, there are the ones that are correct.


Correct Value (uv_x,uv_y vertice_x,vertice_y,vertice_z):

0.499769,0.030978 -0.209296,5.080000,-0.156972
0.964398,0.933453 -4.419600,3.553767,-4.377104
0.035139,0.943386 -4.419600,3.594134,4.063160


Texture Not Appearing Value (uv_x,uv_y vertice_x,vertice_y,vertice_z):

0.000000,0.000000 -0.209296,5.080000,-0.156972
0.000000,0.000000 -4.419600,3.594134,4.063160
0.000000,0.000000 -4.419600,3.553767,-4.377104


Out of Range Value (uv_x,uv_y vertice_x,vertice_y,vertice_z):

0.275434,0.001534 -4.583527,-0.254022,3.810000
0.275434,0.998466 -4.435033,-0.219739,3.962400
-42201683186052844000000000000000000000.000000,1.001327 -4.583527,-0.254022,3.962400


What might I look for which would cause that value to be so far out of range?

Regards,Braden
Did you write the parser yourself? I would guess you are parsing the file incorrectly.
i would bet 10$ that you you are doing one of these things wrong:

1. you are specifying texture coordinates AFTER vertex coordinate, in that case the coordinate will apply to NEXT vertex, you need to call gltexcoord BEFORE glvertex.

2. you have array of data, which has a off by 1 error when you reference data inside it.

if none of above applies post us your rendering code - the code between glbegin and glend.

Projects: Top Down City: http://mathpudding.com/

I will have to debug my code to see if I have the off by 1 error, but I do have glTexCoord before glVertex. Here is a small snippet of my rendering code. If you need me to post the whole code for the function I can.


			if(global->lwo[object].polygon.numberOfVertices==3) glBegin(GL_TRIANGLES);			if(global->lwo[object].polygon.numberOfVertices==4) glBegin(GL_QUADS);			if(global->lwo[object].polygon.numberOfVertices>=5) glBegin(GL_POLYGON);			for(j=0; j<global->lwo[object].polygon.numberOfVertices; j++)			{				if(global->lwo[object].polygon.vertice[j].drawNormals==1)				{					glNormal3f(global->lwo[object].polygon.vertice[j].normal.x * normalScaler,global->lwo[object].polygon.vertice[j].normal.y * normalScaler,global->lwo[object].polygon.vertice[j].normal.z * normalScaler);				}				if(global->lwo[object].polygon.image!=-1) glTexCoord2f(global->lwo[object].polygon.vertice[j].uv_x,global->lwo[object].polygon.vertice[j].uv_y);				glVertex3f(global->lwo[object].polygon.vertice[j].x,global->lwo[object].polygon.vertice[j].y,global->lwo[object].polygon.vertice[j].z);			glEnd();
Regards,Braden
If, as you say, the data coming from your parser is already incorrect, that must be fixed first. No amount of debugging your rendering code will fix a parse problem.
Is it possible, that you render one of the triangles with the front face to the camera and the other with the back face? actually i am not sure if this generally might be a problem, but maybe it's worth a look :-/
Quote:Original post by gold
If, as you say, the data coming from your parser is already incorrect, that must be fixed first. No amount of debugging your rendering code will fix a parse problem.


I will check the parser, but I am using the Lightwave SDK basecode for the lwo file import, so it can't be too far off base.
Regards,Braden

This topic is closed to new replies.

Advertisement