Jump to content

  • Log In with Google      Sign In   
  • Create Account

vertice array


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Dannyli   Members   -  Reputation: 135

Like
0Likes
Like

Posted 20 May 2013 - 05:17 PM

CUSTOMVERTEX vertices[] =
    {
		{ 100.0f, 400.0f, 0.5f, 1.0f, 0xffff0000, },
        { 300.0f,  50.0f, 0.5f, 1.0f, 0xff00ff00, }, 
        { 500.0f, 400.0f, 0.5f, 1.0f, 0xff0000ff, },
    };

 

what means "  0xffff0000," ?    I know 100.0f, 400.0f, 0.5f, 1.0f, means the point



Sponsor:

#2 mhagain   Crossbones+   -  Reputation: 8001

Like
1Likes
Like

Posted 20 May 2013 - 05:19 PM

It's the colour expressed as a 32-bit hexadecimal unsigned int; you can derive these values yourself using the D3DCOLOR_ARGB macro.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#3 menohack   Members   -  Reputation: 216

Like
1Likes
Like

Posted 20 May 2013 - 05:22 PM

You can lay out your CUSTOMVERTEX however you want but I am assuming that the first 4 floats correspond to the position as a float4(x,y,z,w) and the last integer is a vertex color 0xRRGGBBAA for red, green, blue and transparency. In the first one it is probably the color teal.

 

Your input layout determines all of these (D3D11_INPUT_ELEMENT_DESC).



#4 Dannyli   Members   -  Reputation: 135

Like
0Likes
Like

Posted 20 May 2013 - 05:40 PM

So this sample draw a triangle with three color points, or a blending color triangle?

HRESULT InitVB()
{
	//user's data of the points
    CUSTOMVERTEX vertices[] =
    {
		{ 100.0f, 400.0f, 0.5f, 1.0f, 0xffff0000, },
        { 300.0f,  50.0f, 0.5f, 1.0f, 0xff00ff00, }, 
        { 500.0f, 400.0f, 0.5f, 1.0f, 0xff0000ff, },
    };

	//creat the point buffer area
    if( FAILED( g_pd3dDevice->CreateVertexBuffer( 3*sizeof(CUSTOMVERTEX),
                                                  0, D3DFVF_CUSTOMVERTEX,
                                                  D3DPOOL_DEFAULT, &g_pVB, NULL ) ) )
    {
        return E_FAIL;
    }

	//blend
    VOID* pVertices;
    if( FAILED( g_pVB->Lock( 0, sizeof(vertices), (void**)&pVertices, 0 ) ) )
        return E_FAIL;
    memcpy( pVertices, vertices, sizeof(vertices) );
    g_pVB->Unlock();

    return S_OK;
}


#5 mhagain   Crossbones+   -  Reputation: 8001

Like
1Likes
Like

Posted 21 May 2013 - 03:23 AM

No, that sample draws nothing.  What that sample does is create a vertex buffer and fill it with the data you supply.  It's probably copy and pasted from a tutorial that uses SetFVF with D3DFVF_XYZRHW | D3DFVF_DIFFUSE.  Since it's using SetFVF the actual blending mode (or lack thereof) will depend on the SetTextureStageState calls elsewhere in the tutorial.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#6 L. Spiro   Crossbones+   -  Reputation: 13629

Like
1Likes
Like

Posted 21 May 2013 - 03:54 PM

menohack, on 21 May 2013 - 08:13, said:
the last integer is a vertex color 0xRRGGBBAA for red, green, blue and transparency. In the first one it is probably the color teal.

The format is 0xAARRGGBB, so the first color is red. Always use the D3DCOLOR_ARGB() macro when composing colors.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#7 Dannyli   Members   -  Reputation: 135

Like
0Likes
Like

Posted 21 May 2013 - 05:20 PM

Thanks for help, I've figured them out.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS