Sign in to follow this  
White Scorpion

Simple D3D questions ( mostly vertex buffering )

Recommended Posts

Hi everyone ! I've continued reading the MSDN's tutorial on D3D and here are some questions I have so far: What is the adapter ? ( i.e. GetAdapterDisplayMode( ) ... ) What is the difference between hardware acceleration and software acceleration ? What is a vertex buffer ? What is it used for ? Could someone explain me that code that I took from MSDN's tutorial on vertex buffers please ?
VOID* pVertices;
if( FAILED( g_pVB->Lock( 0, sizeof(g_Vertices), (BYTE**)&pVertices, 0 ) ) )
    return E_FAIL;
memcpy( pVertices, g_Vertices, sizeof(g_Vertices) );
g_pVB->Unlock();

And finally ( for now ) what is the rhw parameter ?

Share this post


Link to post
Share on other sites
Newbie, so answers might be off, or wrong.

Adapter- Isn't that just whatever video card is being used?

Hardware vs software- Hardware acceleration is done on the video card, software is done by the general CPU [think an emulator]

Vertex Buffer- A vertex buffer is a buffer that holds vertex information. Verteces are just points of a polygon. Thus a vertex buffer is a bunch of polygon points which describe a shape [or multiple shapes].

Code-

First, Lock the vertex buffer memory so nothing else in the system will fubar the process. If it fails, return. Then, copy the bunch of vertex information into the buffer. Then unlock the buffer since we're done.

RHW- rhw probably stands for something, but it's basically something to say that the vertex information is not 3d [an object in space] but 2d, with z representing windowing order [an object on the screen]. The actual rhw variable in the vertex information I've always set to 1. I don't know what it does.

Share this post


Link to post
Share on other sites
Thank you.
Is it me or this line:
memcpy( pVertices, g_Vertices, sizeof(g_Vertices) );

is just plain stupid... you copy things from the empty vertices to the one that contains stuff... I never used that function but IntelliSense says that the 2nd parameter is const so it will not have its values copied so obviously it's the "copier" and the 1st is the one to receive copies but anyway... I think I'll have to read a lot more before I get those lines

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this