Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Prelit vertices wont light up

Prelit vertices wont light up

Prelit vertices wont light up

I am trying to learn direct3D and I came across a problem that has me stumped. I created a program that was supposed to display 16 cubes using prelit vertices but whenever I run the program the cubes are pitch black.

My cube class constructor is as follows:
cube::cube(D3DVECTOR origin,D3DVECTOR size,float R,float G,float B)
    verts=new D3DLVERTEX[8];
    D3DVECTOR extent=origin+size;
    D3DCOLOR clr[8];
    float luma[8]={0.7f,1.0f,0.5f,0.8f,0.15f,0.45f,0.35f,0.65f};
    for(int i=0;i<8;i++)clr[i]=D3DRGB(R*luma[i],G*luma[i],B*luma[i]);


I have tried different values for the colors but they are always black

Eventually each cube is draw with:
void cube::draw(LPDIRECT3DDEVICE7 device)

RE: Prelit vertices wont light up

One thing I forgot to mention is I am using DirectX 7 and C++.NET (although I suppose you can guess the directX 7 part because of the LPDIRECT3DDEVICE7).

RE: Prelit vertices wont light up

Never mind, I figured it out. It turns out I had to disable lighting explicitly when initializing direct3D.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close