Sign in to follow this  
a-elnajjar

need Help to Draw Batman 2D logo

Recommended Posts

Hi I need to ask for help because I had problem to sit a coordination of the batman logo I site 11 angles and 11 I posted my code of Rander() if someone can told me what is the problem the code #include <d3d9.h> #include <cmath> #include <d3dx9.h> #pragma comment (lib,"d3dx9.lib") #include "app.hpp" float const radius = 0.8f; //declare logo's angle need 13 angles // Angles float const angleB = D3DX_PI / 2.0f; float const angleC = angleB + 2.0f * D3DX_PI / 11.0f; float const angleA = angleB - 2.0f * D3DX_PI / 11.0f; float const angleD = angleC + 2.0f * D3DX_PI / 11.0f; float const angleF = angleA + 2.0f * D3DX_PI / 11.0f; float const angleE = angleF - 2.0f * D3DX_PI / 11.0f; float const angleG = angleF - 2.0f * D3DX_PI / 11.0f; float const angleH = angleG + 2.0f * D3DX_PI / 11.0f; float const angleI = angleI - 2.0f * D3DX_PI / 11.0f; float const angleJ = angleJ + 2.0f * D3DX_PI / 11.0f; float const angleK = angleA - 2.0f * D3DX_PI / 11.0f; float const nradius = -0.8f; float const xDisp = 0; float const yDisp = 0; //vertse D3DXVECTOR2 A( nradius * cos(angleA), nradius * sin(angleA) ); D3DXVECTOR2 B( nradius * cos(angleB), nradius * sin(angleB) ); D3DXVECTOR2 C( nradius * cos(angleC), nradius * sin(angleC) ); D3DXVECTOR2 D( nradius * cos(angleD), nradius * sin(angleD) ); D3DXVECTOR2 E( nradius * cos(angleE), nradius * sin(angleE) ); D3DXVECTOR2 F( nradius * cos(angleF), nradius * sin(angleF) ); D3DXVECTOR2 G( nradius * cos(angleG), nradius * sin(angleG) ); D3DXVECTOR2 H( nradius * cos(angleH), nradius * sin(angleH) ); D3DXVECTOR2 I( nradius * cos(angleI), nradius * sin(angleI) ); D3DXVECTOR2 J( nradius * cos(angleJ), nradius * sin(angleJ) ); D3DXVECTOR2 K( nradius * cos(angleK), nradius * sin(angleK) ); TVertex vertices[] = { { nradius * cos(angleA), nradius * sin(angleA), 0.5f, D3DCOLOR_XRGB( 0, 0, 0 )}, { nradius * cos(angleB), nradius * sin(angleB), 0.5f, D3DCOLOR_XRGB( 0, 0, 0 )}, { nradius * cos(angleC), nradius * sin(angleC), 0.5f, D3DCOLOR_XRGB( 0, 0, 0 )}, { nradius * cos(angleD), nradius * sin(angleD), 0.5f, D3DCOLOR_XRGB( 0, 0, 0 )}, { nradius * cos(angleE), nradius * sin(angleE), 0.5f, D3DCOLOR_XRGB( 0, 0, 0 )}, { nradius * cos(angleF), nradius * sin(angleF), 0.5f, D3DCOLOR_XRGB( 0, 0, 0 )}, { nradius * cos(angleG), nradius * sin(angleG), 0.5f, D3DCOLOR_XRGB( 0, 0, 0 )}, { nradius * cos(angleH), nradius * sin(angleH), 0.5f, D3DCOLOR_XRGB( 0, 0, 0 )}, { nradius * cos(angleI), nradius * sin(angleI), 0.5f, D3DCOLOR_XRGB( 0, 0, 0 )}, { nradius * cos(angleJ), nradius * sin(angleJ), 0.5f, D3DCOLOR_XRGB( 0, 0, 0 )}, { nradius * cos(angleK), nradius * sin(angleK), 0.5f, D3DCOLOR_XRGB( 0, 0, 0 )} }; /** Render a single frame */ void Render( IDirect3DDevice9* const pdev ) { // clear the back buffer to blue pdev->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB( 0, 0, 128 ), 1.0f, 0 ); D3DXMATRIX proj; float const maxExtent = 2.0f; if( g_clientWidth > g_clientHeight ) { float aspect = static_cast<float>(g_clientWidth) / g_clientHeight; D3DXMatrixOrthoLH( &proj, maxExtent * aspect, maxExtent, -1.0f, 1.0 ); } else { float aspect = static_cast<float>(g_clientHeight) / g_clientWidth; D3DXMatrixOrthoLH( &proj, maxExtent, maxExtent * aspect, -1.0f, 1.0 ); } pdev->SetTransform( D3DTS_PROJECTION, &proj ); pdev->SetRenderState( D3DRS_LIGHTING, FALSE ); if( SUCCEEDED( pdev->BeginScene() ) ) { pdev->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE ); pdev->SetFVF( D3DFVF_XYZ | D3DFVF_DIFFUSE ); DrawLine(pdev, A, B); DrawLine(pdev, B, C ); DrawLine(pdev, C, D ); DrawLine(pdev, D, E ); DrawLine(pdev, E, F ); DrawLine(pdev, J, K ); DrawLine(pdev, K, A ); pdev->EndScene(); } // present the back buffer to user pdev->Present( NULL, NULL, NULL, NULL ); }

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