Daily Archives

Articles indexed Friday November 8 2013

Page 16/17 | < Previous Page | 12 13 14 15 16 17  | Next Page >

  • SharpDX: Render to bitmap using Direct2D 1.1

    - by mwhouser
    I have a command line application that I am currently using SharpDX (Direct2D 1.0) to render to PNG files. This is a window-less application. It's currently creating a SharpDX.WIC.WicBitmap, a WicRenderTarget, then rendering to that. I then save the WicBitmap to the PNG file. For various reasons, I need to migrate to Direct2D 1.1 to take advantage of some of the effects available in 1.1. I'm trying to get a SharpDX.Direct2D1.Bitmap that I can save as PNG. I cannot use FromWicBitmap because that copies the bitmap, it does not share it. I see CreateSharedBitmap in the Direct2D1 API that takes a IWICBitmapLock. However, I do not see this implemented as a constructor of SharpDX.Direct2D.Bitmap. This is what I'm trying to do: // Bunch of setup var d2dDevice = new SharpDX.Direct2D1.Device(dxgiDevice); var d2dDeviceContext = new SharpDX.Direct2D1.DeviceContext(d2dDevice, SharpDX.Direct2D1.DeviceContextOptions.None); using (var wicFactory = new SharpDX.WIC.ImagingFactory()) { using (SharpDX.WIC.Bitmap wicBitmap = new SharpDX.WIC.Bitmap(wicFactory, 500, 500, SharpDX.WIC.PixelFormat.Format32bppPBGRA, SharpDX.WIC.BitmapCreateCacheOption.CacheOnDemand)) { var wicLock = wicBitmap.Lock(SharpDX.WIC.BitmapLockFlags.Write); var props = new SharpDX.Direct2D1.BitmapProperties1(); props.BitmapOptions = SharpDX.Direct2D1.BitmapOptions.Target; var bitmap = new SharpDX.Direct2D1.Bitmap1(d2dDeviceContext, wicLock, props); // This is not available d2dDeviceContext.Target = bitmap; // Do the drawing // Save the PNG } } Is there a way to do what I'm trying to accomplish?

    Read the article

  • Flickering when accessing texture by offset

    - by TravisG
    I have this simple compute shader that basically just takes the input from one image and writes it to another. Both images are 128/128/128 in size and glDispatchCompute is called with (128/8,128/8,128/8). The source images are cleared to 0 before this compute shader is executed, so no undefined values should be floating around in there. (I have the appropriate memory barrier on the C++ side set before the 3D texture is accessed). This version works fine: #version 430 layout (location = 0, rgba16f) uniform image3D ping; layout (location = 1, rgba16f) uniform image3D pong; layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in; void main() { ivec3 sampleCoord = gl_GlobalInvocationID.xyz; imageStore(pong, imageLoad(ping,sampleCoord)); } Reading values from pong shows that it's just a copy, as intended. However, when I load data from ping with an offset: #version 430 layout (location = 0, rgba16f) uniform image3D ping; layout (location = 1, rgba16f) uniform image3D pong; layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in; void main() { ivec3 sampleCoord = gl_GlobalInvocationID.xyz; imageStore(pong, imageLoad(ping,sampleCoord+ivec3(1,0,0))); } The data that is written to pong seems to depend on the order of execution of the threads within the work groups, which makes no sense to me. When reading from the pong texture, visible flickering occurs in some spots on the texture. What am I doing wrong here?

    Read the article

  • What are some ways to texture map a terrain?

    - by ApocKalipsS
    I'm working with XNA on a 3D Game, and I'm trying to have a proper and nice environnement. I actually followed a tutorial to create a terrain from a heightmap. To texture it, I just apply a grass texture on it and tile it a number of times. But what I want to do is to have a really realistic texturing, but also generate it automatically (for example if I want to use Perlin noise to generate a terrain and then texture it). I already learned about multi-texturing, loading a map file with different colors for different textures, but I don't think this is really efficient, for instance for cliffs or very steep areas it will tile a texture badly as it's a view from the top. (Also, I don't know how I'll draw roads or dirt paths with that.) I'm looking for an efficient solution to realistically texture mapping procedurally-generated terrain.

    Read the article

  • How can I post scores to Facebook from a LibGDX android game?

    - by Vishal Kumar
    I am using LibGDX to create an android game. I am not making the HTML backend of the game. I just want it to be on the Android Google Play store. Is it possible to post the scores to Facebook? And if so, how can I do it. I searched and found the solutions only for web-based games. For LibGDX, there is a tutorial for Scoreloop. So, I am worried whether there is a way to do so. Any Suggestion will be welcome.

    Read the article

  • Heightmap and Textures

    - by Robert
    Im trying to find the "best way" to apply a texture to a heightmap with opengl 3.x. Its really hard to find something on google because tutorials are olds and they're all using different methods, im really lost and i dont know what to use at all. Here is my code that generates the heightmap (its basic) float[] vertexes = null; float[] textureCoords = null; for(int x = 0; x < this.m_size.width; x++) { for(int y = 0; y < this.m_size.height; y++) { vertexes ~= [x, 1.0f, y]; textureCoords ~= [cast(float)x / 50, cast(float)y / 50]; } } As you can see, i dont know how to apply the texture at all (i was using / 50 for my tests). Result of that code : I would like to have something very basic like : (you can find more pics in his blog) Edit : my texture size is 1024x1024.

    Read the article

  • Drawing different per-pixel data on the screen

    - by Amir Eldor
    I want to draw different per-pixel data on the screen, where each pixel has a specific value according to my needs. An example may be a random noise pattern where each pixel is randomly generated. I'm not sure what is the correct and fastest way to do this. Locking a texture/surface and manipulating the raw pixel data? How is this done in modern graphics programming? I'm currently trying to do this in Pygame but realized I will face the same problem if I go for C/SDL or OpenGL/DirectX.

    Read the article

< Previous Page | 12 13 14 15 16 17  | Next Page >