void Direct3D::CreateRMCubes()
{
D3DRMGROUPINDEX group;
unsigned vertorder[] = { 0,1,3,2, 4,5,7,6, 8,9,11,10,
12,13,15,14, 16,17,19,18, 20,21,23,22 };
// Copy vertex to vertexlist
D3DRMVERTEX vertexlist[24];
memset(vertexlist, sizeof(D3DRMVERTEX)*24, 0);
for(int i=0; i<24; i++)
memcpy(&vertexlist<i>, g_App.m_Vertices.fVertex+(i*8), sizeof(float)*8);
// Load texture
LPDIRECT3DRMTEXTURE3 texture = NULL;
if(g_App.m_Option.bTexture)
if(m_pD3DRM->LoadTexture(g_App.m_chBmpName, &texture) != D3DRM_OK)
SHOW("Failed to load texture");
// create cube mesh
LPDIRECT3DRMMESH lpCubeMesh;
m_pD3DRM->CreateMesh(&lpCubeMesh);
if(lpCubeMesh->AddGroup( 24, 6, 4, vertorder, &group ) != D3DRM_OK)
SHOW("Failed to add group");
if(lpCubeMesh->SetVertices( group, 0, 24, vertexlist) != D3DRM_OK)
SHOW("Failed to SetVertices");
if(lpCubeMesh->SetGroupTexture(group, (LPDIRECT3DRMTEXTURE) texture) != D3DRM_OK)
SHOW("Failed to set group texture");
// create cube frames
m_pCube = new LPDIRECT3DRMFRAME3[g_App.m_usCubes];
for(i=0; i<g_App.m_usCubes; i++)
m_pD3DRM->CreateFrame(m_pScene, &m_pCube<i>);
for(int h=0; h<g_App.m_usCubes; h++)
{
// Improves render speed
lpCubeMesh->SetGroupQuality(D3DRMGROUP_ALLGROUPS, D3DRMRENDER_GOURAUD);
// Improves texture mapping
if(g_App.m_Option.bTexture)
if(lpCubeMesh->SetGroupMapping(D3DRMGROUP_ALLGROUPS,
D3DRMMAP_PERSPCORRECT ) != D3DRM_OK)
SHOW("Failed to set group mapping");
// Add mesh to cube
m_pCube[h]->AddVisual( (LPDIRECT3DRMVISUAL) lpCubeMesh );
}
/* HERE IS THE FOX! Is this really neccesary?
If I un-comment this everything is fine and the textures shows up! */
//if(strcmp(g_App.m_DeviceMode.m_d3dDevices[g_App.
// m_DeviceMode.m_iCurrentDevice].strDesc, "Direct3D HAL") == 0)
//lpCubeMesh->AddGroup( 24, 6, 4, vertorder, &group );
// release objects.
if(lpCubeMesh) {lpCubeMesh->Release(); lpCubeMesh=0;}
if(texture) {texture->Release(); texture = NULL;}
}
Thanks for reading.
Edited by - Gandalf on 6/21/00 7:32:51 AM
Edited by - Gandalf on 6/21/00 7:33:43 AM
Edited by - Gandalf on 6/21/00 7:34:25 AM
Edited by - Gandalf on 6/21/00 7:34:59 AM
Edited by - Gandalf on 6/21/00 7:35:26 AM
Edited by - Gandalf on 6/21/00 7:36:01 AM
Edited by - Gandalf on 6/21/00 7:36:49 AM
Strange problem in Direct3D Retained Mode
I get crazy!
In D3DRM I´m trying get textures on some objects, but here is a VERY strange thing!
I must do one extra AddGroup() call after I have created all the objects, else the texture
will not show up! And this is only neccesary in Direct3D HAL, not in RGB Emulation!
It´s driving me crazy!
What the is wrong with this setup process?
1. Building up the vertex structure.
2. Loading a texture.
3. Creating a group with 24 vertex, 6 sides and 4 vertex per side.
4. Set vertex position.
5. Set texture to the group.
6. Creating 90 frames.
7. Add mesh to every frame.
(se details above)
Edited by - Gandalf on June 21, 2000 9:51:53 AM
1. Building up the vertex structure.
2. Loading a texture.
3. Creating a group with 24 vertex, 6 sides and 4 vertex per side.
4. Set vertex position.
5. Set texture to the group.
6. Creating 90 frames.
7. Add mesh to every frame.
(se details above)
Edited by - Gandalf on June 21, 2000 9:51:53 AM
May I make a suggestion? Switch to IM. You could do D3DX and it would be a lot better since it will be supported in the future. I wish I could help you, but I didn''t really study RM. Not many people here know how to use RM so it would be hard to ask for help.
------------------------
Captured Reality
------------------------
Captured Reality
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement