D3DLVERTEX

Started by
2 comments, last by crazy166 24 years ago
sorry to keep posting such similar questions, but someone''s gotta know. this example works fine (draws a "square" centered in viewport): D3DVERTEX verts[4]; verts[0] = D3DVERTEX( v1, n, 0.0f, 0.0f ); verts[1] = D3DVERTEX( v2, n, 1.0f, 0.0f ); verts[2] = D3DVERTEX( v3, n, 0.0f, 1.0f ); verts[3] = D3DVERTEX( v4, n, 1.0f, 1.0f ); device->DrawPrimitive( D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX, (LPVOID)verts, 4, 0); of course, i have to set a material and a light, but it works great. now if i change to: D3DLVERTEX verts[4]; verts[0] = D3DLVERTEX( v1, RGB_MAKE(255,255,255),RGB_MAKE(0,0,0), 0.0f, 0.0f ); ... //etc for verts[1]-[3] device->DrawPrimitive( D3DPT_TRIANGLESTRIP, D3DFVF_LVERTEX, (LPVOID)verts, 4, 0); nothing ever gets drawn. i also remove material and light info, since lit vertices ''shouldn''t'' need that info. all matrices and settings remain the same. what''s the deal? i thought D3DLVERTEX was just a vertex with lighting info instead of a normal. i just think that letting d3d light vertices was wasteful (and time-consuming w/o tnl) for my app (i used to use TLverts, i just wanted to let d3d handle transforms since tnl could be available and my transforms weren''t much faster than HAL anyway). i know there isn''t a special renderstate to set to use lit verts, since the ''wonderful'' sdk would have said "in order to use D3DLVERTEX, set the ... renderstate to ..." thanks, crazy166 some people think i'm crazy, some people know it
Advertisement
Hi

Yes this wonderfull SDK is really funny, there is one interessting sentence :

By default, Direct3D performs lighting calculations on all vertices, even those without vertex normals.

Funny isn''t it the SDK say, that you shuld disable the Lighting Calculations, by setting the D3DRENDERSTATE_LIGHTING Renderstate to FALSE.
I don''t know if that cures your Problem ?

If that doesen''t Work, you should try to set the specular Value an other than Black, maybe Direct3D interpretes that Value even if specular lighting is disabled (it is disabled is it?)
As an Test, if it Draws something, clear your Background with an other color than black, maybe it there is an other Error. So when the Square is drawn in Black you know at least, it is an coloring Problem.

Lars
--------> http://www.larswolter.de <---------
Another thing you could do is try turning off back face culling (SetRenderState(D3DRENDERSTATE_CULLMODE,D3DCULL_NONE).

altair
altair734@yahoo.com
biggins.mit.edu/altair734
altairaltair734@yahoo.comwww.geocities.com/altair734
that''s a great idea with the different bg, i''ll try it. i''m sure it''s not culling, since it works ok if i let d3d light it.
i thought the default was lighting off, but i guess not.
does disabling specular have an effect if you''re lighting your own polys, i didn''t think so, but it''s definitely worth checking out?
i thought maybe i had switch specular and ''regular'' originally, and thought "how stupid!" but when i switched them it wasn''t that (unless they both need to be non-zero).

thanks, i''ll try these suggestions out
crazy166

some people think i'm crazy, some people know it

This topic is closed to new replies.

Advertisement