Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

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...)

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

Edited by rifter1818
Posted

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

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?!!!!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...