Archived

This topic is now archived and is closed to further replies.

NeXe tutorials

This topic is 5621 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

In reference to the main tutorial series on nexe. I have a couple of questions about it, mainly on the vertices and the vertex buffer. Why are there two vertex classes i.e. CVertex + CProcessedVertex Instead of having CProcessedVertex can''t it all be done in the CVertex class, i.e. changing the create function to.
void Create(float fp_fX,float fp_fY,float fp_fZ, float fp_fRHW,DWORD dwColor,float fp_fU, float fp_fV); 
Meaning that only one FVF would be required??
const DWORD D3DFVF_CVertex = D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE; 
And then when one wanted to create a vertex it could be done like so.
CVertex* vtxQuad;
Vertices.Create(&d3dWindow,4,D3DFVF_CVertex,
              D3DPT_TRIANGLESTRIP,sizeof(CVertex));
vtxQuad = (CVertex*)Vertices.GetMemoryPointer();
 
vtxQuad[0].Create(0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), 1.0f,0.0f);
vtxQuad[1].Create(0.0f, 1.0f,0.0f, 1.0f, D3DCOLOR_XRGB(0, 255, 0), 0.0f,1.0f);
vtxQuad[2].Create(1.0f,1.0f,0.0f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), 1.0f,0.0f);
vtxQuad[3].Create(1.0f,0.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), 1.0f,0.0f); 
In seans code he trys to fill the vertex buffer after its been locked.
d3dWindow.Clear(D3DCOLOR_XRGB(0, 0, 0));
d3dWindow.BeginScene();
Vertices.FillProcessedBuffer(&d3dWindow, &Vertices, 4);  //By here
Vertices.Render(&d3dWindow, 2);
d3dWindow.EndScene();
d3dWindow.Present(); 
How is that possible???? I''ve made some alterations to the code, i.e. when creating the above vertices I expected to get a small square in the upper left corner of the screen, except it does zip. A bit much to ask but would someone mind taking a quick look at my Project files and see where I''m going wrong. Cos I''ve seen some other people code create vertices in a similar format like this.
(250.0f,100.0f,0.5f,1.0f,D3DCOLOR_XRGB(255,0,0) 
Now If I were to stick to seans original code then these co-ords don''t seem to show, i.e. sean used co-ords of (0,0) (0,1) (1.25,0) (1.25,1) , now I would of thought that would have made a very small square in the upper left of the screen, instead it makes quite a large square in the top right quadrant of the screen. Help!!!!!!!!!!!! I is very confused. Paul.

Share this post


Link to post
Share on other sites
The Difference between the CVERTEX and CProcessedVertices vertex classes is that one is for unprocesse vertices and the other is for processe vertices. You an tell which one is which by looking to see which vertex FVF has the D3DFVF_XYZRHW tag to it.

Eric Wright o0Programmer0o




Share this post


Link to post
Share on other sites