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. Other Discussions
  3. Clever Code
  4. Confusing Documentation

Confusing Documentation

Scheduled Pinned Locked Moved Clever Code
8 Posts 6 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.
  • S Offline
    S Offline
    StevenWalsh
    wrote on last edited by
    #1

    Directly copy and pasted from the documentation for Direct X.... public class Vertices : Form { // Global variables for this project Device device = null; // Rendering device VertexBuffer vb = null; . . . public void OnCreateDevice(object sender, EventArgs e) { Device dev = (Device)sender; // Now create the vertex buffer vertexBuffer = new VertexBuffer( typeof(CustomVertex.TransformedColored), 3, dev, 0, CustomVertex.TransformedColored.Format, Pool.Default); vertexBuffer.Created += new System.EventHandler(this.OnCreateVertexBuffer); this.OnCreateVertexBuffer(vb, null); } public void OnCreateVertexBuffer(object sender, EventArgs e) { VertexBuffer vb = (VertexBuffer)sender; GraphicsStream stm = vb.Lock(0, 0, 0); CustomVertex.TransformedColored[] verts = new CustomVertex.TransformedColored[3]; . . . vb.Unlock(); } }

    L L M 3 Replies Last reply
    0
    • S StevenWalsh

      Directly copy and pasted from the documentation for Direct X.... public class Vertices : Form { // Global variables for this project Device device = null; // Rendering device VertexBuffer vb = null; . . . public void OnCreateDevice(object sender, EventArgs e) { Device dev = (Device)sender; // Now create the vertex buffer vertexBuffer = new VertexBuffer( typeof(CustomVertex.TransformedColored), 3, dev, 0, CustomVertex.TransformedColored.Format, Pool.Default); vertexBuffer.Created += new System.EventHandler(this.OnCreateVertexBuffer); this.OnCreateVertexBuffer(vb, null); } public void OnCreateVertexBuffer(object sender, EventArgs e) { VertexBuffer vb = (VertexBuffer)sender; GraphicsStream stm = vb.Lock(0, 0, 0); CustomVertex.TransformedColored[] verts = new CustomVertex.TransformedColored[3]; . . . vb.Unlock(); } }

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      Nope, dont see it. Whats the bug?

      **

      xacc.ide-0.2.0.77 - now with C# 3.5 support and Navigation Bar!^
      New xacc.ide release RSS feed^

      **

      M 1 Reply Last reply
      0
      • S StevenWalsh

        Directly copy and pasted from the documentation for Direct X.... public class Vertices : Form { // Global variables for this project Device device = null; // Rendering device VertexBuffer vb = null; . . . public void OnCreateDevice(object sender, EventArgs e) { Device dev = (Device)sender; // Now create the vertex buffer vertexBuffer = new VertexBuffer( typeof(CustomVertex.TransformedColored), 3, dev, 0, CustomVertex.TransformedColored.Format, Pool.Default); vertexBuffer.Created += new System.EventHandler(this.OnCreateVertexBuffer); this.OnCreateVertexBuffer(vb, null); } public void OnCreateVertexBuffer(object sender, EventArgs e) { VertexBuffer vb = (VertexBuffer)sender; GraphicsStream stm = vb.Lock(0, 0, 0); CustomVertex.TransformedColored[] verts = new CustomVertex.TransformedColored[3]; . . . vb.Unlock(); } }

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        it gets even worse in VB.

        Luc Pattyn [Forum Guidelines] [My Articles]


        this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


        1 Reply Last reply
        0
        • S StevenWalsh

          Directly copy and pasted from the documentation for Direct X.... public class Vertices : Form { // Global variables for this project Device device = null; // Rendering device VertexBuffer vb = null; . . . public void OnCreateDevice(object sender, EventArgs e) { Device dev = (Device)sender; // Now create the vertex buffer vertexBuffer = new VertexBuffer( typeof(CustomVertex.TransformedColored), 3, dev, 0, CustomVertex.TransformedColored.Format, Pool.Default); vertexBuffer.Created += new System.EventHandler(this.OnCreateVertexBuffer); this.OnCreateVertexBuffer(vb, null); } public void OnCreateVertexBuffer(object sender, EventArgs e) { VertexBuffer vb = (VertexBuffer)sender; GraphicsStream stm = vb.Lock(0, 0, 0); CustomVertex.TransformedColored[] verts = new CustomVertex.TransformedColored[3]; . . . vb.Unlock(); } }

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          The "global variables" are regular member variables? (CLR doesn't support global variables anyway) I'm guessing vertexBuffer and vb are supposed to be the same member (copy/paste bug)? vertexBuffer.Created is assigned to after the VertexBuffer is created? OnCreateVertexBuffer() is called explicitly?

          --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ I work for Keyser Söze

          S V 2 Replies Last reply
          0
          • L leppie

            Nope, dont see it. Whats the bug?

            **

            xacc.ide-0.2.0.77 - now with C# 3.5 support and Navigation Bar!^
            New xacc.ide release RSS feed^

            **

            M Offline
            M Offline
            mav northwind
            wrote on last edited by
            #5

            I guess it's calling OnCreateVertexBuffer() explicitely after wiring up the event. Depending on when CreateVertexBuffer gets fired I'd assume OnCreateVertexBuffer() gets called more than once.

            Regards, mav -- Black holes are the places where God divided by 0...

            1 Reply Last reply
            0
            • M Michael Dunn

              The "global variables" are regular member variables? (CLR doesn't support global variables anyway) I'm guessing vertexBuffer and vb are supposed to be the same member (copy/paste bug)? vertexBuffer.Created is assigned to after the VertexBuffer is created? OnCreateVertexBuffer() is called explicitly?

              --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ I work for Keyser Söze

              S Offline
              S Offline
              StevenWalsh
              wrote on last edited by
              #6

              Michael Dunn wrote:

              I'm guessing vertexBuffer and vb are supposed to be the same member (copy/paste bug)?

              Small bug... but when you're reading a tutorial that kind of matters :)

              1 Reply Last reply
              0
              • M Michael Dunn

                The "global variables" are regular member variables? (CLR doesn't support global variables anyway) I'm guessing vertexBuffer and vb are supposed to be the same member (copy/paste bug)? vertexBuffer.Created is assigned to after the VertexBuffer is created? OnCreateVertexBuffer() is called explicitly?

                --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ I work for Keyser Söze

                V Offline
                V Offline
                Vikram A Punathambekar
                wrote on last edited by
                #7

                Michael Dunn wrote:

                CLR doesn't support global variables anyway

                Are you sure? I read somewhere that the CLR has nothing against global variables, just that languages like C# don't support them. :~

                Cheers, विक्रम


                Be yourself, no matter what they say. - Sting, Englishman in New York.

                M 1 Reply Last reply
                0
                • V Vikram A Punathambekar

                  Michael Dunn wrote:

                  CLR doesn't support global variables anyway

                  Are you sure? I read somewhere that the CLR has nothing against global variables, just that languages like C# don't support them. :~

                  Cheers, विक्रम


                  Be yourself, no matter what they say. - Sting, Englishman in New York.

                  M Offline
                  M Offline
                  Michael Dunn
                  wrote on last edited by
                  #8

                  No, I'm not sure. :)

                  --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen

                  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