Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: 11 May 2006 09:15:17 -0700,    group: microsoft.public.win32.programmer.directx.sdk        back       


DirectX SDK - Vertex buffers   
Hi there,

Newbie to directx, and wanted to know if was possible to build a vertex
buffer containing lots of many vertices, each one with a different
texture ?

Below is the code i used to draw a primative (square) currently and
apply a texture, if i have eighty objects to draw, that is a lot of
procedures to go through.  shurely their must eb a better way to do
this by queing all the pimatives i want to draw in a vertex buffer.

Can not seen to find any examples.

Can anyone point me in the right direction please?

Many Regards
Roberto



if
(FAILED(g_pd3dDevice->SetStreamSource(0,pVertexBuffer,0,sizeof(CUSTOMVERTEX))))
		return FALSE;

if (FAILED(g_pd3dDevice->SetFVF(D3DFVF_CUSTOMVERTEX)))
		return FALSE;

if (FAILED(g_pd3dDevice->SetTexture(0, image[imgBackground].l_pTexture
) ))
	return FALSE;

if (FAILED(g_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST,0,2)))
		return FALSE;
date: 11 May 2006 09:15:17 -0700   author:   Roberto

Re: DirectX SDK - Vertex buffers   
No, you can't define te-references insinde a vertex-buffer
(or at least: D3D9 will ignore them).

But objects*tex_sets_per_object*frames_per_second
shouldn't be a much too high number, if you claim
objects=80, assuming tex_sets_per_object<10.

Merely avoid more than a million drawPrimitive calls per second,
or so, not just a few thousand.

But you can still try keeping all your objects in a single vb, 
of couse.

Gruss

Jan Bruns




"Roberto"  schrieb im Newsbeitrag news:1147364117.570745.287340@i40g2000cwc.googlegroups.com...
> Hi there,
> 
> Newbie to directx, and wanted to know if was possible to build a vertex
> buffer containing lots of many vertices, each one with a different
> texture ?
> 
> Below is the code i used to draw a primative (square) currently and
> apply a texture, if i have eighty objects to draw, that is a lot of
> procedures to go through.  shurely their must eb a better way to do
> this by queing all the pimatives i want to draw in a vertex buffer.
> 
> Can not seen to find any examples.
> 
> Can anyone point me in the right direction please?
> 
> Many Regards
> Roberto
> 
> 
> 
> if
> (FAILED(g_pd3dDevice->SetStreamSource(0,pVertexBuffer,0,sizeof(CUSTOMVERTEX))))
> return FALSE;
> 
> if (FAILED(g_pd3dDevice->SetFVF(D3DFVF_CUSTOMVERTEX)))
> return FALSE;
> 
> if (FAILED(g_pd3dDevice->SetTexture(0, image[imgBackground].l_pTexture
> ) ))
> return FALSE;
> 
> if (FAILED(g_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST,0,2)))
> return FALSE;
>
date: Thu, 11 May 2006 21:12:17 +0200   author:   Jan Bruns

Re: DirectX SDK - Vertex buffers   
Thanks Jan,

figured one way of acheiving what i wanted which was to combine my
textures into a single texture, then use every increasing .tu values to
select a different texture to use
e.g. if i have 3 iamges, tu for image 1 would be 0 upto 0.33.
iamge 2 tu 0.33 -> 0.66
iamge 3 tu 0.66->1

Not sure how legitimate this is or whether this kills the graphics card
performance, but seems to work. it means i can preload all of my
primatives into a single vertex  buffer, then change texture positon to
change what texture is displayed on screen.

Any views on this approach would be greatefulyl received :)

Regards
Roberto
date: 11 May 2006 13:45:53 -0700   author:   Roberto

Re: DirectX SDK - Vertex buffers   
One approach you may want to look into is using a 'texture atlas.' 
Simply put, it involves packing a bunch of your textures together into a 
single image, and then fixing up all the texture coordinates of the 
vertices that used to use those textures, and then rendering them all in 
one go. Because they're all in the same image, you can treat them as a 
single texture and so you don't need to switch for each piece.

D3DX contains some utilities for building texture atlases.

- Richard

Roberto wrote:
> Hi there,
> 
> Newbie to directx, and wanted to know if was possible to build a vertex
> buffer containing lots of many vertices, each one with a different
> texture ?
> 
> Below is the code i used to draw a primative (square) currently and
> apply a texture, if i have eighty objects to draw, that is a lot of
> procedures to go through.  shurely their must eb a better way to do
> this by queing all the pimatives i want to draw in a vertex buffer.
> 
> Can not seen to find any examples.
> 
> Can anyone point me in the right direction please?
> 
> Many Regards
> Roberto
> 
> 
> 
> if
> (FAILED(g_pd3dDevice->SetStreamSource(0,pVertexBuffer,0,sizeof(CUSTOMVERTEX))))
> 		return FALSE;
> 
> if (FAILED(g_pd3dDevice->SetFVF(D3DFVF_CUSTOMVERTEX)))
> 		return FALSE;
> 
> if (FAILED(g_pd3dDevice->SetTexture(0, image[imgBackground].l_pTexture
> ) ))
> 	return FALSE;
> 
> if (FAILED(g_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST,0,2)))
> 		return FALSE;
>
date: Sat, 13 May 2006 02:43:45 +0100   author:   Richard Fine [DXMVP]

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us