?
Solved

White looks blue and other colors look wrong in DirectX 8.1 using VB

Posted on 2003-03-10
5
Medium Priority
?
297 Views
Last Modified: 2013-12-08
I am using VB 6.0 and DirectX 8.1a to render scenes of 3D primitives.  In order to save the resulting images to file, I am using GetFrontBuffer and SaveSurfaceToFile with a device mode of D3DFMT_A8R8G8B8 (32-bit color).  The problem is that all of my color assignments are off.  My white's are cyan (128,255,255) and my other colors are off.  I imagine this has to do with using 32-bit color and not accounting for the alpha channel.  However, I get red when I give it either &HFFFF0000 or &HFF00FF00 or &HFF0000FF!  I'm obviously a beginner at this and must be missing something basic.  How can I get the colors I expect when assigning long values?  I have tried assigning materials and ambient lights without any effect.
0
Comment
Question by:BlueAlex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:joachimc
ID: 8109420
It seems like you are not using the color values at all. Have you set an FVF that is using vertex colors ?
0
 

Author Comment

by:BlueAlex
ID: 8115047
My FVF declaration is as follows
Public Const FVF = D3DFVF_XYZRHW Or D3DFVF_TEX1 Or D3DFVF_DIFFUSE Or D3DFVF_SPECULAR

I describe my tranformed and lit vertices with
Type TLVERTEX
    x As Single
    y As Single
    z As Single
    rhw As Single
    color As Single
    specular As Long
    tu As Single
    tv As Single
End Type

All of the resultant colors are in the reds and greens with a little blue (as if I am shifted down or losing a few bits).  It seems like I am somehow getting confused with the 32-bit storage for DirectX colors (with the alpha channel).  I updated my graphics card drivers and even tried using DirectX 9 on a Windows 2000 machine but got the same result (so I'm sure it is a bug in my code).  
0
 
LVL 4

Expert Comment

by:joachimc
ID: 8117615
I see that you are using color as Single. That is a floating point number isn't it ? The color should be the same as the specular. A long is a 32 bit unsigned integer ? In that case that is the one you want.

/Joachim
0
 

Author Comment

by:BlueAlex
ID: 8122863
That appears to be exactly the problem. Thanks!
0
 
LVL 4

Accepted Solution

by:
joachimc earned 300 total points
ID: 8125984
and the points ?
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question