Search Results

Search found 2 results on 1 pages for 'codespeaker'.

Page 1/1 | 1 

  • XNA VertexBuffer.SetData performance suggestions

    - by CodeSpeaker
    I have a 3d world in a grid layout where each grid cell contains its separate vertex and index buffer for the mesh/terrain of that cell. When the player moves outside the boundaries of his cell, i dynamically load more cells in his walking direction based on his viewing distance. This triggers x number of vertex and indexbuffer initializations depending on how many cells that needs to be generated and causes the framerate to drop annoyingly during this time. The generation of terrain data is handled in a separate thread and runs smoothly. The vertex and index buffers are added during the update cycle of the game loop. I´ve tried batching the number of cells to be processed to avoid sending too much data at once into the buffers, which worked ok at a shorter viewing distance (about 9 cells to process), but not as well at greater distances with around 30 cells to process. Any idea how i can optimize this?

    Read the article

  • Sharepoint NewForm adding attachments programatically

    - by CodeSpeaker
    I have a list with a custom form which contains a custom file upload control. As soon as the user selects a file and clicks upload, i want this file to go directly to the attachments list within that listitem. However, when adding the file to SPContext.Current.ListItem.Attachments on a new item, the attachment wont show up in the list after saving. If i instead use item.Update() on the new item after adding the attachment i get an error in Sharepoint, but when i then go back to the list, the item is there with its attachment. It seems like its trying to create 2 new entries at once when i save (item.Update) which results in the second of those crashing. What would be the correct way to add attachments this way? oSPWeb.AllowUnsafeUpdates = true; // Get the List item SPListItem listItem = SPContext.Current.ListItem; // Get the Attachment collection SPAttachmentCollection attachmentCollection = listItem.Attachments; Stream attachmentStream; Byte[] attachmentContent; // Get the file from the file upload control if (fileUpload.HasFile) { attachmentStream = fileUpload.PostedFile.InputStream; attachmentContent = new Byte[attachmentStream.Length]; attachmentStream.Read(attachmentContent, 0, (int)attachmentStream.Length); attachmentStream.Close(); attachmentStream.Dispose(); // Add the file to the attachment collection attachmentCollection.Add(fileUpload.FileName, attachmentContent); } // Update th list item listItem.Update();

    Read the article

1