# Mindar

Member

57

126 Neutral

• Rank
Member
1. ## Tiling with matrices...

I think i figured it out. I just made an array of vertex buffers and use those good ol' for loops to initialize them all and then I use some homemade algorithms to map textures and such onto each one. IM A GENIUS!!!! Atleast, I think it will work (^_^). Cheers!
2. ## Tiling with matrices...

Well im using direct x 8, so DirectDraw is gone, and I find that matrices are alot easier to manipulate. But I dont want to make a billion of these: m_pD3DDevice->CreateVertexBuffer(4 * sizeof(PANELVERTEX), D3DUSAGE_WRITEONLY, D3DFVF_PANELVERTEX, D3DPOOL_MANAGED, &m_pTitleVertex); PANELVERTEX* pTitleVertices = NULL; m_pTitleVertex->Lock(0, 4 * sizeof(PANELVERTEX), (BYTE**)&pTitleVertices, 0); //Set all the colors to white pTitleVertices[0].color = pTitleVertices[1].color = pTitleVertices[2].color = pTitleVertices[3].color = 0xffffffff; //Set positions and texture coordinates pTitleVertices[0].x = pTitleVertices[3].x = -200.0f; pTitleVertices[1].x = pTitleVertices[2].x = 200.0f; pTitleVertices[0].y = pTitleVertices[1].y = 36.0f; pTitleVertices[2].y = pTitleVertices[3].y = -36.0f; pTitleVertices[0].z = pTitleVertices[1].z = pTitleVertices[2].z = pTitleVertices[3].z = 1.0f; pTitleVertices[1].u = pTitleVertices[2].u = 1.0f; pTitleVertices[0].u = pTitleVertices[3].u = 0.0f; pTitleVertices[0].v = pTitleVertices[1].v = 0.0f; pTitleVertices[2].v = pTitleVertices[3].v = 1.0f; m_pTitleVertex->Unlock(); Would it be possible to maybe create a function that creates alot of different matrice quads in a loop instead? I need like 400 different quads, and it would take FOREVER to actually code 400 of the quads. Please someone help!!!
3. ## Tiling with matrices...

Im going to bed and to school tomarrow, so if someone leaves an answer I wont be able to leave a response for around another 20 hours. Cheers!
4. ## Tiling with matrices...

Hey, Im back again! I was wondering how one would go about using matrices for a tiling engine? Whats the fastest way? The only way I can think of would be to create lots and lots of matrice quads and then choose a part of a texture to use on them. This doesnt seem very efficient though, because you would have to initalize all of the little squares and thats like a billion lines of code. Any tutorials or examples would be great! Cheers, Scott
5. ## Texture Coordinate Transformations?

Thanks Namethatnobodyelsetook! It works, though it is kindof inconvienent to have to say not to translate every texture that I dont want to be translated. EDIT: Nvm, I just put m_pD3DDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); after the translation and it works fine. Thanks again.
6. ## Texture Coordinate Transformations?

Well that kinda worked, except for that the texture just wrapped back arround and all the other texture's coordinates were transformed as well.
7. ## Texture Coordinate Transformations?

Heh, well actually Im going to just use the keyboard, but I still cant get just half of a texture to show using this code: m_pD3DDevice->SetTexture(0, m_pSqs); D3DXMATRIX TexPosition; m_pD3DDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); D3DXMatrixTranslation(&TexPosition, 1.0f, 0.5f, 0.0f); m_pD3DDevice->SetTransform(D3DTS_TEXTURE0, &TexPosition); m_pD3DDevice->SetVertexShader(D3DFVF_PANELVERTEX); m_pD3DDevice->SetStreamSource(0, m_pSqsVertex, sizeof(PANELVERTEX)); m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2); The whole texture still shows, so I dont think im doing it correctly
8. ## Texture Coordinate Transformations?

Ok, thanks! But I dont think im doing this right... m_pD3DDevice->SetTexture(0, m_pSqs); D3DXMATRIX TexPosition; m_pD3DDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); D3DXMatrixTranslation(&TexPosition, 1.0f, 5.0f, 0.0f); m_pD3DDevice->SetTransform(D3DTS_TEXTURE0, &TexPosition); m_pD3DDevice->SetVertexShader(D3DFVF_PANELVERTEX); m_pD3DDevice->SetStreamSource(0, m_pSqsVertex, sizeof(PANELVERTEX)); m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2); am I doing it in the right order? (Im also rendering the textured quad as well, so I can have the Texture Transformationa along with the rendering of the quad, tell me if i cant do this) Thanks again!
9. ## Texture Coordinate Transformations?

Hello, Im making a game menu and I want to use one texture for a button, but have a rollover and a regular image within the same image..., for example: I have two images that are both 200x50 pixels, one is a rollover and one is a regular texture, I then combine them into one picture. Then I want to use Texture Coordinates to chose which part of the texture I want to use. The only problem is... I cant figure out how to do Texture Coordinate Transformations. I googled it and everything and I couldnt find anything. I looked in the DirectX 8 documentation, but it didnt help that much. If anyone can point me to a good tutorial or just explain it here, it would be greatly appreciated. (I know how to do Matrice Coordinate Transformations and everything, so I get the general math behind it and everything, so you dont have to explain that much, I just need an example). Thanks!!!!
10. ## Text Methods....

can you use custom bitmaps? I like being able to make my own fonts. If so, can someone point me towards a good tutorial?
11. ## Text Methods....

Actually I have a nifty book that I found that explains how to use surfaces for tilling a map for an rpg, but I dont think there would be a difference for text. I'll post the snippet of the code later, but my grandma just came. Ttyl.
12. ## Text Methods....

Yea, thats what I was thinking of doing, but i was wondering if there was a more optimized way of doing it.
13. ## Text Methods....

Hey, I was wondering what are some different methods to make some text functions to display text on the screen using a bitmap with letters on it. The search isnt working right now, so I cant really find anything that way. I was wondering if you would create an image surface, some matrices, or some other method. If someone could point me towards some tutorials, that would be great. Thanks!
14. ## Moving Meshes without locking and unlocking?...

So I guess thats not as hard on the system and resources. Thanks! EDIT: Hmm, prototype, when I removed the CeateVertexBuffer function and moved it to the init function, it caused my stary background to have a shimmer effect, which is cool, but not what I need. One more question: I dont want to make a new thread for it, but how would I set the 'layer' or something of the sort for a set of vertices so I can have a fade effect (creating a big sqare with a black texture and then change the alpha)? The last time I tried, the square was behind everything else, which didnt do much good. And how I would I change the alpha each frame (I have the psudocode (Spelling?) algorithm, but I dont know the D3D functions.) Thanks again!
15. ## Moving Meshes without locking and unlocking?...

Thanks! I guess I need to read more tutorials on other things such as vectors and matrices :D. Merry Christmahanuquanza (or whatever ;p).