Simple Error

rifter1818

Junior Contributor
Joined
Sep 11, 2003
Messages
255
Location
A cold dark place
I know this has got to be something stupid im doing that im doing, but i dont know what. Im trying to add in Effects (Pixel/Vertex Shaders) and allong the way ive decided to use createflags.PureDevice or createflags.HardwareVertexProcessing.. I know my device supports them as i have a sample program (Came with the book Kick Start -> Managed Directx 9 Graphics and Game Programming) that uses these flags. But as soon as i change my CFlags over to them, my cFont.DrawText Throws the following exception
"NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.DirectX.Direct3D.Font.DrawText(Sprite sprite, String text, Rectangle rect, DrawTextFormat format, Int32 color)"
This isnt Much fun and it works just fine in SoftwareVertexProcessing....
oh heres my Font Class in case that helps any.. (omiting the unused parts...)
Visual Basic:
imports d = system.drawing
    Public Class cFont
        Inherits Microsoft.DirectX.Direct3D.Font
        Public Color As D.Color
        Private pFontDesc As FontDescription
        Public Sub New(ByRef Device As Device, ByVal Font As D.Font)
            MyBase.New(Device, Font)
        End Sub 
       Public Overloads Sub DrawText(ByVal Text As String, ByVal Rect As D.Rectangle, ByVal Format As DrawTextFormat, ByVal FColor As D.Color)
            MyBase.DrawText(Nothing, Text, Rect, Format, FColor)
        End Sub
    End Class
 
Last edited:
Not sure its my programming

Everytime i change anything the fonts either stop working or work a bit better, such as before each draw text command i added
Visual Basic:
if mFont is nothing then
mFont = new cFont(d3d.device,new D.Font("Arial",12)
debug.writeline("Font was nothing")
end if
This caused 1 of the 2 fonts to work again, however nothing showed up in the debug output, so i removed the line "debug.writline "font was nothing"
and the fonts stopped working?!!!!
 
Back
Top