Jump to content
  • Advertisement

ZeroWalker

Member
  • Content Count

    52
  • Joined

  • Last visited

Community Reputation

124 Neutral

About ZeroWalker

  • Rank
    Member
  1. ZeroWalker

    LibJpegTurbo, PInvoking C#

    Yes i have. It´s Okay, but Libjpeg is likely much better. But sadly, there is no wrapper available.   EDIT: But well if someone can/has Libjpeg-Turbo working in C#, i would gladly like to know how. Or any other Libjpeg for that matter.
  2. ZeroWalker

    LibJpegTurbo, PInvoking C#

    The only thing i really need is something that beats the .Net Jpeg, cause it isn´t that great in terms of quality/size/speed. Especially Quality. Unsafe code is not a problem. The other part however is, my skills doesn´t really allow for it. I don´t want to (or more like Can) write much code, just to set it to encode an image. I can understand the settings like (RGB,YUV etc) Quality, and all that stuff. But not the way it works (as i tried to use it in C/C++ and couldn´t get it to work. And well i don´t even get anything to really work in C++). But what i got was that, it needs to create a compress, decompress etc, and then destroy them as the end. I am used to more, simple stuff, like. Jpegencoder.Encode (Byte[]); well, something towards that. But as said, i am not limited to just wanting to get JpegTurbo, but i want something that´s is fast with imagecompression, in terms of encoding and decoding (and the only thing i can think of, is Jpeg, as there seems to be a standstill when it comes to new image formats).
  3. ZeroWalker

    LibJpegTurbo, PInvoking C#

    The thing i am asking is, I don´t understand C++, and i wondered if someone could help me PInvoke it to call the compress/decompress features. I can´t even get it working with C++ alone, it´s just to different from C# even if they look alike.
  4. ZeroWalker

    How do i use PureDevice?

    Good, but, i am only creating the texutre one time when i start it, the render thread. I am then keeping it all the time.  I am only disposing them if i end the thread, and then i also end other stuff in the other thread. Or is it a problem with doing that? Cause i try to always only have disposable objects when i need them.     EDIT: I don´t know how i am supposed to initialze them on startup, as Sprite needs Device, and Device needs a form. And a form needs to be created on the thread it´s used on.
  5. Is anyone familiar to using LibJpegTurbo with C/C++? If so, are you able to make a PInvoke for use with C#? As i myself am totally crap at C/C++, i can´t even get LibJpegTurbo to work in it at all, so i do all my work in C#. But as would really need to get that Jpeg to work, as the inbuilt .Net jpeg Encoder/Decoder isn´t something to kill for. I don´t think much need´s to be done, as the work is already there, C# can just import the C code more or less i guess. Well, any thought about this is appreciated as well. Thanks
  6. ZeroWalker

    How do i use PureDevice?

    A question, do i need to really Dispose of surface ever loop? Can´t i just do like this: using (var texture = new Texture(device, wid, heg, 0, Usage.None, Format.X8R8G8B8, Pool.Default)) using (var surface = texture.GetSurfaceLevel(0)) using (var sprite = new Sprite(device)) { SharpDX.Windows.RenderLoop.Run(form, () => { if (CTS.IsCancellationRequested) form.Dispose(); if (Queue.TryTake(out TextureData, 300)) { device.BeginScene(); sprite.Begin(SpriteFlags.None); Surface.FromFileInMemory(surface, TextureData, SharpDX.Direct3D9.Filter.None, 0); sprite.Draw(texture, new ColorBGRA(0xffffffff)); } }); } Or is there an issue with doing like this?
  7. ZeroWalker

    How do i use PureDevice?

    Okay probably solved it, i had made a mistake (hopefully) with a PInvoke that i use. dc2 = NativeMethods.GetWindowDC(hwnd); I called that all the time, so eventually, it would break causing the program to fail some way or the other. But now i moved it from the loop, and added this for safety:   if (dc2 != null) NativeMethods.ReleaseDC(hwnd, dc2); dc2 = NativeMethods.GetWindowDC(hwnd);   So hopefully that will solve it and Release if necessary. Not the first time i make mistakes;)
  8. ZeroWalker

    How do i use PureDevice?

    Okay, will do, have isolated the problem so far to being at the receiving part, it locks the Thread waiting for new data (even though data is being sent), so will have to solve it somehow;P Well, it´s all Around thread;) Love how the Topic of the Thread was solved in the beginning, and now it´s a whole different story;P
  9. ZeroWalker

    How do i use PureDevice?

    Seems correct, it does return false. hmm. which means it´s the other loop which is the netwrok. But nothing is happening there either. My sendind loops are continuing like normal, so the connection isn´t broken. IT´s just that the Receiver doesn´t take the data that´s being sent i guess. Very Weird. Yes Listening is set to false if i uncheck a button (and true if i check it). Ah will install that.
  10. ZeroWalker

    How do i use PureDevice?

    Hmm for some reason, the Surface method seems to cause it to stop at some point. I get no exception or anything, it just jumpt out of the Form for some reason. Is there anything wrong with this:   SharpDX.Windows.RenderLoop.Run(form, () => { if (!listening) form.Dispose(); if (Queue.TryTake(out TextureData, 150)) { Stoptimer = new Stopwatch(); Stoptimer.Start(); device.BeginScene(); sprite.Begin(SpriteFlags.None); //form.Text = "Test " + Queue.Count + ": Delayed Frames"; try { using (var surface = texture.GetSurfaceLevel(0)) { Surface.FromFileInMemory(surface, TextureData, SharpDX.Direct3D9.Filter.None, 0); } sprite.Draw(texture, new ColorBGRA(0xffffffff)); } catch (Exception ex) { MessageBox.Show(ex.Message, "Rendering: Texture"); } sprite.End(); device.EndScene(); device.Present(); Stoptimer.Stop(); Console.WriteLine(Stoptimer.ElapsedTicks); } }); Listening is True all the time, and the Form does Not exit, it just stop at the last image, very weird.     Worth noting is, i check the Timer, and it goes slower and slower for some reason. It can start at about 60-75k ticks. Then go slowly up to around 80-95k, and eventually stops (when the loop ends, for some reason i don´t get).
  11. ZeroWalker

    How do i use PureDevice?

    Is that a the same kind of surface i am talking about? I mean just the buffer. As the only thing i am showing i 1 texture. Meaning, i don´t care what the buffer has, i don´t need depth or anything, just 1 image. So i could rather just put my image As the buffer or something. Ah nice, thanks for the links:) Don´t have the SDK, never got to install it, installed Windows SDK, it said DirectX was with it, and well, it wasn´t;P
  12. ZeroWalker

    How do i use PureDevice?

    I actually, think i can have solved it. At least by getting the texture size before. I simply make a texture before the loop, get the data , get size and everything, set the form and buffer size, and also pass it to the texture. Though, i can´t use a Dynamic texture for that, though i don´t see a difference? Will it be faster with Dynamic texture or what? Cause the only difference for me with it, is that i can´t choose any size, except stuff like 1024x1024, which i guess makes it bound by the power of 2. Though again, this makes me wonder, do i really even need a texture? If i can get a surface, can´t i just put the image on the Buffer/device surface or something?
  13. ZeroWalker

    How do i use PureDevice?

    Nice i finally got an image;D! Now it´s starting to go forward:)   The problem now is, the size of the image, as now i can´t set it to -2 which got the size for me, and have to set it to something Valid, which seems to be Power of 2 only. So not sure how to do that, maybe if it´s possible to choose something higher than the resolution, and just ignore the non-used stuff, and have the image crop to what´s used?
  14. ZeroWalker

    How do i use PureDevice?

    Well that´s good to hear:)   Yeah that´s what i want to do, as i currently create/dispose, which just takes power for stuff that could be reused. But i don´t get how to show the new Texture surface, i have done something like: //texture.LockRectangle(0, LockFlags.Discard); using (var surface = texture.GetSurfaceLevel(0)) { Surface.FromFileInMemory(surface, TextureData, SharpDX.Direct3D9.Filter.Point, 0); } //texture.UnlockRectangle(0); sprite.Draw(texture, new ColorBGRA(0xffffffff)); And well, it doesn´t do anything except throw errors here and there. And well, a growing Thread is a good thing, means someone is feeding it;P
  15. ZeroWalker

    How do i use PureDevice?

    Wait, what is the theTexture supposed to be? Is it my Dynamic Texture: using (var texture = new Texture(device, 512, 512, 1, Usage.Dynamic, Format.X8R8G8B8, Pool.Default)) and i guess theStream is my MemoryStream with jpeg (is it possible to get it from Memory instead (Byte[], so i don´t need to convert)? Okay, existed FromMemory, so that was easy enough:) And, as the surface is disposed of, should i draw the texture/surface while it´s alive, and if so, how do i do that (only used Textures so far). Many Thanks
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!