• What are you working on? v19
    6,590 replies, posted
[img]http://www.facepunch.com/fp/ratings/funny2.png[/img] ?
No, :v:
Framebuffers are neat. [media]http://www.youtube.com/watch?v=ugHoC7GD_y4[/media]
Anyone here ever used frogatto for inspiration on code design? Can someone tell me if the design is any good? Or froids design?
[QUOTE=Darwin226;32143494]Hey. I was thinking about how you said you sort triangles based on their average z value. Are you sure that will always give correct results? Let's say that you have a triangle with two points close to each other and the third one pointing far towards the screen and far up. It's average z would be close to the screen. Now if you have another normal triangle that's below the long one, further away from the screen than the last point of the longer one, but closer to the screen than the other two points. It's average z would be further away from the screen than the long ones, yet it should be rendered on top of the long one.[/QUOTE] Ive changed the method through which everything works, so what happens now is it draws (and fills) triangles to a colour and depth buffer, and does a per pixel depth check to see whether or not it should be drawing a pixel from that triangle there or not based on the average depth of the triangle. So, this wont work in all cases, like the one you described, but it will still work 95% of the time, which is good enough for me.
[QUOTE=Anonim;32144500]I did this in Java once. To find the inverse, it augments the identity matrix to the right of the original one, rref's the resulting matrix, and the result contains the inverse of the original matrix in its right half. Here's how it works in code. [code] // attempts to construct and return the inverse of current matrix. public Matrix inverse() { if (M != N) throw new RuntimeException("Matrix is not square."); Matrix I = Matrix.identity(M); Matrix augrref = augment(I).rref(); double[][] data = new double[M][N]; for (int i = 0; i < M; ++i) { for (int j = 0; j < N; ++j) { data[i][j] = augrref.data[i][j+M]; } } Matrix inv = new Matrix(data); return inv; } // augments matrix B to the right of matrix A and returns resulting matrix C. public Matrix augment(Matrix B) { Matrix A = this; if (B.M != A.M) throw new RuntimeException("Illegal matrix dimensions."); double[][] data = new double[M][A.N+B.N]; for (int i = 0; i < M; ++i) { for (int j = 0; j < A.N; ++j) { data[i][j] = A.data[i][j]; } for (int k = 0; k < B.N; ++k) { data[i][A.N+k] = B.data[i][k]; } } Matrix C = new Matrix(data); return C; } // finds and returns the row reduced echelon form of current matrix. public Matrix rref() { Matrix A = new Matrix(this); int lead = 0; for (int i = 0; i < A.M; ++i) { if (A.N <= lead) { return A; } int k = i; while (A.data[i][lead] == 0) { ++k; if (k == A.M) { k = i; ++lead; if (lead == A.N) return A; } } if (k != i) A.swap(i,k); A.times(i, 1.0/A.data[i][lead]); for (int u = 0; u < A.M; ++u) { if (u != i) { double t = A.data[u][lead]; for (int j = 0; j < A.N; ++j) { A.data[u][j] = A.data[u][j] - t * A.data[i][j]; } } } ++lead; } return A; }[/code] In hindsight, I probably should've made this more readable. Oh, who am I kidding, I'll never do that anyway.[/QUOTE] Ye that's how I learned to do it by hand at first, but it's incredibly boring to do Gauss-Jordan by hand on large matrices. Especially when the values are not integers. Then again, that is not a problem for the computer, so thanks :D
[QUOTE=NovembrDobby;32125793]Awwwww yeah, demo's out and I was invited to join their new [url=http://www.desura.com/games]pre-order program[/url] (click alphafunding). [hd]http://www.youtube.com/watch?v=NkV2enmmkKE[/hd] [url=http://www.desura.com/games/rotion][img]http://button.desura.com/play/outline/games/12485/741.png[/img][/url] ^ gets you the demo [url=http://www.desura.com/games/rotion][img]http://button.desura.com/play/outline/games/12485.png[/img][/url] ^ gets you alpha access right now (+future builds +final game when it's done) I feel spammy, time to make my own thread perhaps?[/QUOTE] thats an absolutely sexy game. I've just been working on writing a screenshot app. ([url]www.snip.so[/url])
With regex how do I match this[x, y] == null but not this[x, y] == null && somethingelse == null I first tried this, but it matched both of them. this\[.+, .+\] == null Then I tried this. this\[[^,]+, [^\]]+\] == null but sometimes there are , and ] inside the brackets.
[QUOTE=high;32147475]With regex how do I match this[x, y] == null but not this[x, y] == null && somethingelse == null I first tried this, but it matched both of them. this\[.+, .+\] == null Then I tried this. this\[[^,]+, [^\]]+\] == null but sometimes there are , and ] inside the brackets.[/QUOTE] You wanna make it lazy so this\[.+?, .+?\] == null
When I get home from college today, I'm pushing out another update. [IMG]http://i944.photobucket.com/albums/ad281/andrewmcwatters/Half-Life%202%20Sandbox/loadeffects.png[/IMG] Scripted effects.
Design question. I'm wrapping some OpenGL stuff in C# and I was wondering it it's a good idea to handle deleting of unused buffers/textures it their destructors. Would that cause performance issues, and does the GC know if the buffer is still used on the GPU or not, or will it consider it eligible for clean up when there are no references to the object. (Talking about a Buffer class or a Texture class)
[QUOTE=Darwin226;32147776]Design question. I'm wrapping some OpenGL stuff in C# and I was wondering it it's a good idea to handle deleting of unused buffers/textures it their destructors. Would that cause performance issues, and does the GC know if the buffer is still used on the GPU or not, or will it consider it eligible for clean up when there are no references to the object. (Talking about a Buffer class or a Texture class)[/QUOTE] You really should be doing that stuff manually afaik.
[QUOTE=Darwin226;32147776]Design question. I'm wrapping some OpenGL stuff in C# and I was wondering it it's a good idea to handle deleting of unused buffers/textures it their destructors. Would that cause performance issues, and does the GC know if the buffer is still used on the GPU or not, or will it consider it eligible for clean up when there are no references to the object. (Talking about a Buffer class or a Texture class)[/QUOTE] I presume by destructor you mean the Dispose method? I think it gets called either if the GC decides to clean it up, or if you manually call obj.Dispose(). I'm not completely sure, but I've been putting my GL.DeleteTextures and suchlike in the Dispose method and it's been working fine. It might be worth experimenting a bit with it.
[QUOTE=thomasfn;32147926]I presume by destructor you mean the Dispose method? I think it gets called either if the GC decides to clean it up, or if you manually call obj.Dispose(). I'm not completely sure, but I've been putting my GL.DeleteTextures and suchlike in the Dispose method and it's been working fine. It might be worth experimenting a bit with it.[/QUOTE] No. Dispose is called manually or after the using statement AFAIK. C# does have destructors. [url]http://msdn.microsoft.com/en-us/library/66x5fx1b.aspx[/url]
[QUOTE=Richy19;32145857]Anyone here ever used frogatto for inspiration on code design? Can someone tell me if the design is any good? Or froids design?[/QUOTE] If anything, I wouldn't recommend using Froid's engine design for your game. (unless you want to deal with 21 managers)
[QUOTE=Darwin226;32148128]No. Dispose is called manually or after the using statement AFAIK. C# does have destructors. [url]http://msdn.microsoft.com/en-us/library/66x5fx1b.aspx[/url][/QUOTE] Oh dear. Is it bad I've been using C# for ~2 years and I didn't even know this?
[QUOTE=thomasfn;32148152]Oh dear. Is it bad I've been using C# for ~2 years and I didn't even know this?[/QUOTE] I've only learned about it recently. Not surprising to be honest. Apart from external stuff GC has no control of you don't really need them.
[QUOTE=NovembrDobby;32125793]Awwwww yeah, demo's out and I was invited to join their new [url=http://www.desura.com/games]pre-order program[/url] (click alphafunding). [hd]http://www.youtube.com/watch?v=NkV2enmmkKE[/hd] [url=http://www.desura.com/games/rotion][img]http://button.desura.com/play/outline/games/12485/741.png[/img][/url] ^ gets you the demo [url=http://www.desura.com/games/rotion][img]http://button.desura.com/play/outline/games/12485.png[/img][/url] ^ gets you alpha access right now (+future builds +final game when it's done) I feel spammy, time to make my own thread perhaps?[/QUOTE] Ran the demo, got this: [code] !!Couldn't dump the console (Adgang til stien 'condumps' blev nægtet.)!! Adgang til stien 'C:\Program Files\Desura\Common\Rotion\rotion.cfg' blev nægtet. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.StreamWriter.CreateFile(String path, Boolean append) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize) at System.IO.StreamWriter..ctor(String path) at ×.¤() at ×.LoadContent() at Microsoft.Xna.Framework.Game.Initialize() at ×.Initialize() at Microsoft.Xna.Framework.Game.Run() at ¬.Main(String[] args) [/code] Adgang nægtet = Acces denied
Something I learned recently about Dispose is how you properly implement it. [csharp]class DisposeMe : IDisposable { ~DisposeMe() { Dispose(false); } protected virtual void Dispose(bool disposing) { if (disposing) { //Dispose managed resources here } //Free unmanaged resources here } public void Dispose() { Dispose(true); GC.SupressFinalize(this); } }[/csharp] [url]http://msdn.microsoft.com/en-us/library/b1yfkh5e%28v=VS.100%29.aspx[/url]
[img]http://dl.dropbox.com/u/11401644/Images/framebuffers1.png[/img] [img]http://dl.dropbox.com/u/11401644/Images/framebuffers2.png[/img] Deferred shading, here I come! :D
Wait, does that program hook to another binary and let you view any objects loaded in the context of said program?
Yes, vertex buffers, framebuffers, textures, shader sources, pretty much every OpenGL object there is I believe.
[QUOTE=esalaka;32148338]Wait, does that program hook to another binary and let you view any objects loaded in the context of said program?[/QUOTE] Yep, you might also want to check out AMD's GPU PerfStudio and nVidia's PerfHUD.
[QUOTE=dajoh;32148302][img]http://dl.dropbox.com/u/11401644/Images/framebuffers1.png[/img] [img]http://dl.dropbox.com/u/11401644/Images/framebuffers2.png[/img] Deferred shading, here I come! :D[/QUOTE] Depth looks wrong, unless you're doing some crazy reconstruction. Also, where are you storing lighting information (material parameters)? PS: Have fun.
What was that plugin for Gimp that created normal maps for images?
[QUOTE=T3hGamerDK;32148274]Ran the demo, got this: [code] !!Couldn't dump the console (Adgang til stien 'condumps' blev nægtet.)!! Adgang til stien 'C:\Program Files\Desura\Common\Rotion\rotion.cfg' blev nægtet. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.StreamWriter.CreateFile(String path, Boolean append) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize) at System.IO.StreamWriter..ctor(String path) at ×.¤() at ×.LoadContent() at Microsoft.Xna.Framework.Game.Initialize() at ×.Initialize() at Microsoft.Xna.Framework.Game.Run() at ¬.Main(String[] args) [/code] Adgang nægtet = Acces denied[/QUOTE] geel got that too, not sure why...I don't know why an app installed to program files wouldn't be allowed to write to its own folder.
Im trying to follow this [url]https://github.com/LaurentGomila/SFML/wiki/TutorialGQE-Engine[/url] to get a better grasp of how to design the game code, but im getting confused with the forward declaration bit. Can someone explain it?
Does anyone know of any tutorials explaining how HLSL shaders work in 2d? I understand how to apply them in 3D yet somehow I can't get my head around how they'd work with, say, 2d lighting.
[QUOTE=Richy19;32148929]Im trying to follow this [url]https://github.com/LaurentGomila/SFML/wiki/TutorialGQE-Engine[/url] to get a better grasp of how to design the game code, but im getting confused with the forward declaration bit. Can someone explain it?[/QUOTE] No need to cross-post from WDYNHW. Anyways, forward deceleration, [URL="http://en.wikipedia.org/wiki/Forward_declaration"]this[/URL] Wikipedia article best describes it. You're already using it when defining classes in header files and their member functions in .cpp files. [editline]6th September 2011[/editline] [QUOTE=chaz13;32149103]Does anyone know of any tutorials explaining how HLSL shaders work in 2d? I understand how to apply them in 3D yet somehow I can't get my head around how they'd work with, say, 2d lighting.[/QUOTE] The same as 3D. You can just ignore the z-component, or use it differently.
[QUOTE=Richy19;32148789]What was that plugin for Gimp that created normal maps for images?[/QUOTE] [URL="http://code.google.com/p/gimp-normalmap/"]This one?[/URL] There are quite a few.
Sorry, you need to Log In to post a reply to this thread.