Jump to content
  • Advertisement
Sign in to follow this  
winsoft2003

OpenGL Some transformation Between Direct3D and OPENGL.

This topic is 4764 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

HI,I am referencing a terrain example written by OPENGL.The following is some fragment of code... ...................... glActiveTextureARB(GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_txt.GetTxtID()); //Activate the second texture ID and bind the fog texture to it glActiveTextureARB(GL_TEXTURE1_ARB); glEnable(GL_TEXTURE_2D); //Here we turn on the COMBINE properties and increase our RGB //gamma for the detail texture. 2 seems to work just right. glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); //Bind the detail texture glBindTexture(GL_TEXTURE_2D, m_cTxtDetail.GetTxtID()); # I know these code set the terrain texture,but I don't know which Direct3d interface could realize the following effect? " glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); " who can tell me? ============================================== The following is about texture coordinate transformation, which is written by OPENGL. //Now we want to enter the texture matrix. This will allow us //to change the tiling of the detail texture. glMatrixMode(GL_TEXTURE); //Reset the current matrix and apply our chosen scale value glLoadIdentity(); glScalef((float)32, (float)32, 32); I rewrote in Direct3D,Is it right?It does not work. // D3DXMATRIX matTexture; D3DXMatrixIdentity( &matTexture ); matTexture._11 = 32.0f; matTexture._22 = 32.0f; matTexture._33 = 32.0f; pD3DDevice->SetTransform( D3DTS_TEXTURE0, &matTexture ); Thanks!

Share this post


Link to post
Share on other sites
Advertisement
1) The texel value scaling would by achieved by passing the D3DTOP_MODULATE2X as an argument to SetTextureStageState.

2) There is a convenience function for this, google for D3DXMatrixScaling. Also, you realise you have to actually multiply your transformation matrices with this scaling matrix, and then set it through D3DDevice->SetTransform, right?

Share this post


Link to post
Share on other sites

Thank Pauljan!
I just want to expand the texture coordinate,I wrote the following code:

D3DXMATRIX matTexture;
D3DXMatrixIdentity( &matTexture );
D3DXMatrixScaling( &matTexture, 32.0f, 32.0f, 32.0f );
pD3DDevice->SetTransform( D3DTS_TEXTURE0, &matTexture );

But it still doesn't work.Should I pay attention to the calling position of these function? I Call these function, then DrawPrimitiveUp( ).Is there any problem?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!