Blitz 1.88

Blitz3D Forums/Blitz3D Programming/Blitz 1.88

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Very simple example (hey, it works! :), changing the render style from gourad to flat shaded:

http://www.tomspeed.com/rendertest.zip

Put the .decls & .dll in userlibs
Const D3DSHADE_FLAT	= 1
Const D3DSHADE_GOURAUD	= 2
Const D3DSHADE_PHONG	= 3

Graphics3D 800,600,32,2

Direct3D7=SystemProperty$("Direct3D7")
Direct3DDevice7=SystemProperty$("Direct3DDevice7")
DirectDraw7=SystemProperty$("DirectDraw7")
DirectInput7=SystemProperty$("DirectInput7")
AppHWND=SystemProperty$("AppHWND")
AppHINSTANCE=SystemProperty$("AppHINSTANCE")

cam=CreateCamera()
PositionEntity cam,0,0,-4

light=CreateLight()
RotateEntity light,60,30,0
sphere=CreateSphere()

While Not KeyHit(1)
Text 0,0,"Press 1,2 or 3 to change the Render Style"
If KeyHit(2) ChangeRenderStyle Direct3DDevice7,D3DSHADE_FLAT
If KeyHit(3) ChangeRenderStyle Direct3DDevice7,D3DSHADE_GOURAUD
If KeyHit(4) ChangeRenderStyle Direct3DDevice7,D3DSHADE_PHONG

RenderWorld
Flip
Wend
End



C++
#define BBDECL extern "C" _declspec(dllexport)
#define BBCALL _stdcall

#include <d3d.h>

BBDECL void BBCALL ChangeRenderStyle(IDirect3DDevice7 *lpDev, unsigned int mode)
{
	int hr = lpDev->SetRenderState(D3DRENDERSTATE_SHADEMODE, mode);
}