Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. DirectX - adding a bitmap to a drawing

DirectX - adding a bitmap to a drawing

Scheduled Pinned Locked Moved C#
graphicsquestiongame-dev
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    melanieab
    wrote on last edited by
    #1

    Hi, I'm new to DirectX so sorry if this is a stupid question. I'm trying to draw stuff and add a bitmap (texture) at the same time. After I draw some rectangles I say: this.OnCreateVertexBuffer(vb, null); device.SetTexture(0, tex); device.VertexFormat = CustomVertex.PositionColoredTextured.Format; device.SetStreamSource(0, vb, 0); device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); but the rectangles vanish just after OnCreateVertexBuffer(); though the bitmap does appear. What do I need to do so that I can have both my rectangles and the texture at the same time? Let me know if you need more of my code to see what I'm screwing up. Thanks so much! :) Mel

    M 1 Reply Last reply
    0
    • M melanieab

      Hi, I'm new to DirectX so sorry if this is a stupid question. I'm trying to draw stuff and add a bitmap (texture) at the same time. After I draw some rectangles I say: this.OnCreateVertexBuffer(vb, null); device.SetTexture(0, tex); device.VertexFormat = CustomVertex.PositionColoredTextured.Format; device.SetStreamSource(0, vb, 0); device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); but the rectangles vanish just after OnCreateVertexBuffer(); though the bitmap does appear. What do I need to do so that I can have both my rectangles and the texture at the same time? Let me know if you need more of my code to see what I'm screwing up. Thanks so much! :) Mel

      M Offline
      M Offline
      melanieab
      wrote on last edited by
      #2

      Accidentally fixed my problem. Just needed to call device.Reset(params); since I'm doing some other things before getting to this stage. Cheers, Mel

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups