Click here to Skip to main content
15,925,181 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: String Error Pin
jmkhael8-Oct-02 0:46
jmkhael8-Oct-02 0:46 
GeneralRe: String Error Pin
Steve S8-Oct-02 1:06
Steve S8-Oct-02 1:06 
GeneralRe: String Error Pin
jmkhael8-Oct-02 1:06
jmkhael8-Oct-02 1:06 
GeneralDownload resume Pin
obr7-Oct-02 23:49
obr7-Oct-02 23:49 
GeneralRe: Download resume Pin
Jon Hulatt8-Oct-02 2:37
Jon Hulatt8-Oct-02 2:37 
GeneralCCriticalSection problems Pin
s_k7-Oct-02 23:33
s_k7-Oct-02 23:33 
GeneralRe: CCriticalSection problems Pin
Anonymous8-Oct-02 6:25
Anonymous8-Oct-02 6:25 
GeneralI'm new to DirectX 8, plz hlp! Pin
sagmam7-Oct-02 23:15
sagmam7-Oct-02 23:15 
Hi, I just started with DX8, and I'm trying to make a point light source over a small flat square (2 triangles). All parameters seem be make sense, but I get a black square, as if no light is applied. I've changed the background color to sth brighter than 0.0, to make sure that the square is actually rendered (and not culled for example).


I have my vertex setup using the XYZ | NORMAL flags, and my vertex struct looks like this:

struct MYVERTEX
{
float x,y,z;
float nx,ny,nz;
};

My vertex buffer is two triangles stuck together facing "up", and they create a small square on "the floor". As use can see, they are defined clockwise, like they're supposed to:

{-2.0f,0.0f,-2.0f, 0.0f,1.0f,0.0f},
{-2.0f,0.0f,2.0f, 0.0f,1.0f,0.0f},
{2.0f,0.0f,2.0f, 0.0f,1.0f,0.0f},

{-2.0f,0.0f,-2.0f, 0.0f,1.0f,0.0f},
{2.0f,0.0f,2.0f, 0.0f,1.0f,0.0f},
{2.0f,0.0f,-2.0f, 0.0f,1.0f,0.0f}


I initialize the light after initializing the device.
This is a snippet of my GameInit() function:

...
light.Type = D3DLIGHT_POINT;
light.Diffuse = D3DXCOLORVALUE(1.0f,1.0f,1.0f,1.0f);
light.Position = D3DXVECTOR3(0.0f,10.0f,0.0f);
light.Range = 100.0f;
pDev->SetLight(0, &light);
pDev->LightEnable(0, TRUE);
...

Notes:
the D3DXCOLORVALUE is just a wrapper for the D3DCOLORVALUE struct, that supplies a ctor
'pDev' is a HAL rendering device with software vertex processing.
I'm working in windowed mode
Backface culling NOT disabled.


This is another snippet, from my Render() function, to show what material I use:

...
// initialize material:
static D3DMATERIAL8 mat;
ZeroMemory(&mat, sizeof(mat));
mat.Ambient = D3DXCOLORVALUE(1.0f,1.0f,1.0f,1.0f);
mat.Diffuse = D3DXCOLORVALUE(1.0f,0.0f,0.0f,1.0f);
pDev->SetMaterial(&mat);
...

I even added a small feature to help me control the light position in real time, so that I see how changes in its distance from the square affect the lighting, but no matter how close or how far I bring it, the square stays black!

Well, that's about it. Like I said, I don't get any light. Any ideas? I'm sure the normals are correct and so is everything else. Please help.... Thanks!

/=/=/=/=
Deus
/=/=/=/=
GeneralRe: I'm new to DirectX 8, plz hlp! Pin
Le centriste8-Oct-02 4:04
Le centriste8-Oct-02 4:04 
GeneralSockets & Events Pin
Jon Hulatt7-Oct-02 22:59
Jon Hulatt7-Oct-02 22:59 
GeneralRe: Sockets & Events Pin
Jon Hulatt7-Oct-02 23:34
Jon Hulatt7-Oct-02 23:34 
GeneralMatrix dimensions Pin
MFC is the Best7-Oct-02 22:22
MFC is the Best7-Oct-02 22:22 
GeneralRe: Matrix dimensions Pin
jmkhael7-Oct-02 22:32
jmkhael7-Oct-02 22:32 
GeneralRe: Matrix dimensions Pin
MFC is the Best8-Oct-02 21:32
MFC is the Best8-Oct-02 21:32 
GeneralRe: Matrix dimensions Pin
Roger Allen8-Oct-02 0:18
Roger Allen8-Oct-02 0:18 
GeneralProblem with <map> memory allocation Pin
fordge7-Oct-02 20:55
fordge7-Oct-02 20:55 
GeneralRe: Problem with <map> memory allocation Pin
Joaquín M López Muñoz7-Oct-02 20:59
Joaquín M López Muñoz7-Oct-02 20:59 
GeneralRe: Problem with <map> memory allocation Pin
fordge7-Oct-02 21:11
fordge7-Oct-02 21:11 
GeneralRe: Problem with <map> memory allocation Pin
Joe Woodbury7-Oct-02 21:39
professionalJoe Woodbury7-Oct-02 21:39 
GeneralRe: Problem with <map> memory allocation Pin
Joaquín M López Muñoz7-Oct-02 21:50
Joaquín M López Muñoz7-Oct-02 21:50 
GeneralRe: Problem with <map> memory allocation Pin
fordge7-Oct-02 21:59
fordge7-Oct-02 21:59 
GeneralRe: Problem with <map> memory allocation Pin
jhwurmbach7-Oct-02 22:34
jhwurmbach7-Oct-02 22:34 
GeneralWrong icons (enabled/disabled) in the command bar! Pin
Daniel Strigl7-Oct-02 20:27
Daniel Strigl7-Oct-02 20:27 
GeneralBatch file (*.BAT) Pin
Jerome Conus7-Oct-02 20:24
Jerome Conus7-Oct-02 20:24 
GeneralRe: Batch file (*.BAT) Pin
jmkhael7-Oct-02 22:38
jmkhael7-Oct-02 22:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.