-
Question about texture display
Hi, I meet a problem in rendering a textured train.
When I use material I can get the image like the left image.
But when I change to use a texture the image is right image.
I use one light in my scene, set the Ambient=0.1, Diffuse=0.2, Specular=0.1
For Texture para
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glEnable(GL_LIGHTING)
What is the problem? How can I get the right result!
Thanks for all!
-
Super Moderator
OpenGL Lord
Re: Question about texture display
Do you define correct texture coordinates for the train interior ?
-
Re: Question about texture display
Yes, I modeled the train by 3DMax, and render it right in Max, using 3ds to export to my application!
-
Member
Regular Contributor
Re: Question about texture display
Replace GL_DECAL with GL_MODULATE, like this:
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
Re: Question about texture display
Thanks,
I did as you told, then get the fellowing image
For clearly, I give the opengl codes here:
glPushAttrib(GL_LIGHTING_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_HINT_BIT);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_LIGHTING);
glDisable(GL_NORMALIZE);
glShadeModel(GL_SMOOTH);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glBind(GL_TEXTURE_2D,iTexID);
glBegin(GL_TRIANGLE_STRIP);
for(j = 0; j < wptPoint; j++)
{
glTexCoord2fv((float*)&pSupScene->m_pTexCoord[*((WORD*)&pSupScene->m_pPoly3Mat[i].pMemBlock[iOffset + iTexSize])]);
glNormal3fv((float*)&pSupScene->m_pNormals[*((WORD*)&pSupScene->m_pPoly3Mat[i].pMemBlock[iOffset + iNormalSize])]);
glVertex3fv((float*)&pSupScene->m_pVertices[*((WORD*)&pSupScene->m_pPoly3Mat[i].pMemBlock[iOffset])]);
iOffset += iVertexSize;
}
glEnd();
All of these included in a display list
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules