• What do you need help with? V. 3.0
    4,884 replies, posted
[QUOTE=danharibo;33190252]Any JSON pasrser should ignore javascript style comments. i.e. /* */ and //[/QUOTE] No what i mean is make the json writter actually write comments into the json file. if not i will just create a new variable with something like varComment: this is my commet
[QUOTE=Richy19;33190287]No what i mean is make the json writter actually write comments into the json file. if not i will just create a new variable with something like varComment: this is my commet[/QUOTE] I don't remember if it's jsoncpp or libjson, but one of them has support for writing comments. [b]Edit:[/b] Yes, I just looked it up, JsonCpp can write comments.
For you people familiar with the .net version of SFML 2, I'm having a weird recurring bug: when I move the mouse, the screen stops drawing. As soon as I stop moving the mouse, it starts drawing again as if nothing happened. I have no idea what is causing it, as it fixes itself with a system restart, but it starts occurring again soon after.
[QUOTE=FoohyAB;33194497]For you people familiar with the .net version of SFML 2, I'm having a weird recurring bug: when I move the mouse, the screen stops drawing. As soon as I stop moving the mouse, it starts drawing again as if nothing happened. I have no idea what is causing it, as it fixes itself with a system restart, but it starts occurring again soon after.[/QUOTE] If it's not your code then, video driver issues?
[QUOTE=ief014;33194624]If it's not your code then, video driver issues?[/QUOTE] Well I sent it to two of my friends and they eventually got the same issue, and I don't have any graphics troubles on any other games.
[QUOTE=FoohyAB;33194646]Well I sent it to two of my friends and they eventually got the same issue, and I don't have any graphics troubles on any other games.[/QUOTE] I've been using an older version of SFML2. If you're using the latest version of it, is it a bug with SFML itself?
[QUOTE=FoohyAB;33194497]For you people familiar with the .net version of SFML 2, I'm having a weird recurring bug: when I move the mouse, the screen stops drawing. As soon as I stop moving the mouse, it starts drawing again as if nothing happened. I have no idea what is causing it, as it fixes itself with a system restart, but it starts occurring again soon after.[/QUOTE] Code?
[QUOTE=ief014;33194856]I've been using an older version of SFML2. If you're using the latest version of it, is it a bug with SFML itself?[/QUOTE] It very much could be, I googled it and it seems a few (though not many) people had this same problem on a fairly recent version (one revision before the one I'm using). However, their issue was never resolved. [editline]9th November 2011[/editline] [url]http://www.sfml-dev.org/forum/viewtopic.php?p=37358&sid=d02cd43e7094b6ad3d8ef65a606ad9c0[/url] This specifically [editline]9th November 2011[/editline] [QUOTE=Map in a box;33195040]Code?[/QUOTE] [url]http://pastebin.com/DtfeGAxP[/url] I have things spread out into multiple files, but this I would think would be the most relevant.
How can I prevent a tree structure from recursing into itself? Danharibo, I know you use a tree structure with pointers to nodes in your [url=https://github.com/danharibo/nodetree/blob/master/NodeTree.h]NodeTree[/url] implementation, but you don't seem to have any way of detecting and preventing recursion. Have you encountered this issue?
[QUOTE=mechanarchy;33195242]How can I prevent a tree structure from recursing into itself? Danharibo, I know you use a tree structure with pointers to nodes in your [url=https://github.com/danharibo/nodetree/blob/master/NodeTree.h]NodeTree[/url] implementation, but you don't seem to have any way of detecting and preventing recursion. Have you encountered this issue?[/QUOTE]I don't check for reccursion because it's primarily for loading, writing was an afterthought. The format is fairly simple either way so it's not tough to create a Serializer that handles recursion properly [editline]9th November 2011[/editline] While I'm here: I'm having issues with an Intel GPU segfaulting on linux, I have an i5 which has a i915 GPU in it. glxgears works fine, runs at 60fps, xsreensaver's OpenGL screensavers works fine, however Magnetite simply segfaults as soon as it tries to render the world, here's a stack trace for anyone who's got a clue: [code]#0 0x00007ffff5edfab6 in ?? () from /lib/libc.so.6 #1 0x00007ffff0a4c0ac in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so #2 0x00007ffff0a5cb1d in brw_validate_state () from /usr/lib/xorg/modules/dri/i965_dri.so #3 0x00007ffff0a4ae03 in brw_draw_prims () from /usr/lib/xorg/modules/dri/i965_dri.so #4 0x00007ffff06caf43 in ?? () from /usr/lib/libdricore.so #5 0x00007ffff06cb1ed in ?? () from /usr/lib/libdricore.so #6 0x00007ffff06cb2b0 in ?? () from /usr/lib/libdricore.so #7 0x00000000004461b4 in Renderer::_renderChunk (this=0xd19440, chunk=0x1064880) at /home/dan/code/mag/src/source/Renderer.cpp:552 #8 0x0000000000445fe2 in Renderer::_renderNode (this=0xd19440, node=0x10aca60, depth=2) at /home/dan/code/mag/src/source/Renderer.cpp:510 #9 0x0000000000445ffd in Renderer::_renderNode (this=0xd19440, node=0x10aca10, depth=1) at /home/dan/code/mag/src/source/Renderer.cpp:513 #10 0x0000000000445ffd in Renderer::_renderNode (this=0xd19440, node=0x10ac9c0, depth=0) at /home/dan/code/mag/src/source/Renderer.cpp:513 #11 0x0000000000445c0e in Renderer::render (this=0xd19440, dt=0, world=0x1063d30) at /home/dan/code/mag/src/source/Renderer.cpp:450 #12 0x0000000000435d81 in MagnetiteCore::go (this=0x7fffffffd0e0) at /home/dan/code/mag/src/source/MagnetiteCore.cpp:269 #13 0x000000000044155e in main (argc=1, argv=0x7fffffffe878) at /home/dan/code/mag/src/source/Main.cpp:78[/code] I am trying to render using a shader program, however it seems that my drivers have trouble compiling them: [quote]| Error compiling shader (w_vertex.glsl): | 0:1(15): preprocessor error: syntax error, unexpected IDENTIFIER, expecting NEWLINE | Error compiling shader (w_fragment.glsl): | 0:1(15): preprocessor error: syntax error, unexpected IDENTIFIER, expecting NEWLINE [/quote] These errors have turned up nothing on google, and the shaders work find with my AMD card in windows [code] #version 150 core uniform sampler2D worldDiffuse; in vec4 in_p; smooth out float f_light; smooth out vec2 f_coords; void main(void) { f_light = in_p.z; f_coords = in_p.xy; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; } [/code] anyone able to shine some light on the situation?
With Love2D/Lua, is there any way to read and write a .zip file?
In C#, is there any way to show or hide a console created with AllocConsole? I know about FreeConsole(), but subsequent calls to Console.Write give an exception, and I want to be able to show the console again with the console output already there.
[QUOTE=horsedrowner;33198728]In C#, is there any way to show or hide a console created with AllocConsole? I know about FreeConsole(), but subsequent calls to Console.Write give an exception, and I want to be able to show the console again with the console output already there.[/QUOTE] Just FindWindow + ShowWindow(false) FreeConsole really frees the resources of the console (as the name implies)
[QUOTE=danharibo;33198048]These errors have turned up nothing on google, and the shaders work find with my AMD card in windows [code] #version 150 core uniform sampler2D worldDiffuse; in vec4 in_p; smooth out float f_light; smooth out vec2 f_coords; void main(void) { f_light = in_p.z; f_coords = in_p.xy; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; } [/code] anyone able to shine some light on the situation?[/QUOTE] core/compatibility in glsl #version was added in OpenGL 3.0, which your graphics card doesn't support. So make that "#version 150" and remove the "core"
[QUOTE=Felheart;33199096]Just FindWindow + ShowWindow(false) FreeConsole really frees the resources of the console (as the name implies)[/QUOTE] That's what I went with it in the end. GetConsoleWindow instead of FindWindow though. Now there's only the problem of a flashing console window as it gets shown and immediatly hidden.
[QUOTE=raBBish;33199226]core/compatibility in glsl #version was added in OpenGL 3.0, which your graphics card doesn't support. So make that "#version 150" and remove the "core"[/QUOTE]Ok I see, I changed that to #version 120 since according to glxinfo, my Intel card only supports up to GLSL 1.2. Now i'm getting this error: [quote] | Error compiling shader (w_vertex.glsl): | 0:6(1): error: syntax error, unexpected NEW_IDENTIFIER, expecting $end | Error compiling shader (w_fragment.glsl): | 0:4(1): error: syntax error, unexpected NEW_IDENTIFIER, expecting $end [/quote]any idea?
[QUOTE=danharibo;33199400]Ok I see, I changed that to #version 120 since according to glxinfo, my Intel card only supports up to GLSL 1.2. Now i'm getting this error: any idea?[/QUOTE] in/out were added in 1.3, use attribute/varying instead. There are probably lots of things missing in 1.2, but I've only used 330 and above. [url=http://www.lighthouse3d.com/tutorials/glsl-tutorial/]This tutorial[/url] seems to have lots of 1.2 example shaders, might be a good read.
[QUOTE=raBBish;33199542]in/out were added in 1.3, use attribute/varying instead. There are probably lots of things missing in 1.2, but I've only used 330 and above. [url=http://www.lighthouse3d.com/tutorials/glsl-tutorial/]This tutorial[/url] seems to have lots of 1.2 example shaders, might be a good read.[/QUOTE]Aha! awesome :D, I guess targeting GLSL 1.2 is ok if I don't need any advanced features? I'll probably add a check of the card's capabilities and choose a shader that the card supports
What is the best way of launcing an application from another application in C++? That is a way that will work in Win/Linux/Mac. I have seeen you can do it like this: [cpp] #include <stdlib.h> int system(const char *command);[/cpp] So if I have a program called game.exe it would be: [cpp] #include "Game.hpp" #include <stdlib.h> int main() { Game *game = new Game(); game->Run(); bool gameNeedsReset = Game->NeedsReset(); delete game; if(gameNeedsReset) { system("game.exe"); } return 0; } [/cpp] But wouldnt that leave the program hanging untill the "new" game process quits?
[QUOTE=Richy19;33201047]What is the best way of launcing an application from another application in C++? That is a way that will work in Win/Linux/Mac.[/QUOTE] None, unless you do it differently for each platform.
[QUOTE=Richy19;33201047]What is the best way of launcing an application from another application in C++? That is a way that will work in Win/Linux/Mac.[/QUOTE] Why exactly would you need the program to launch itself, instead of, you know, creating a new instance of Game and using that?
[QUOTE=raBBish;33201202]Why exactly would you need the program to launch itself, instead of, you know, creating a new instance of Game and using that?[/QUOTE] Because... I hadnt thought of that approach [editline]9th November 2011[/editline] So it would be: [cpp] #include "Game.hpp" int main() { bool gameNeedsReset = false; do { Game *game = new Game(); game->Run(); gameNeedsReset = game->NeedsReset(); delete game; } while( gameNeedsReset ); return 0; } [/cpp] Just realized that by doing it this way I have to make my asset managers static so that I dont have to reload all the stuff to memory when I restart the game [editline]9th November 2011[/editline] Is there anyway to change the behaviour of std::cout? I want to make all of my cout calls output to a file instead of the console
Is it better to have all class level variables private, and have get and set methods for each? Or is it better to make everything public? I've been taught the first, and I was always told thats how it should be done.
[QUOTE=Darkest_97;33201735]Is it better to have all class level variables private, and have get and set methods for each? Or is it better to make everything public? I've been taught the first, and I was always told thats how it should be done.[/QUOTE] If this is a personal project with only you editing it, then it doesnt make that much difference. The main reason that you make get/set methods is so that people that havent used your code wont fuck stuff up by accident. If this is for some homework or something then use get/set as it is better code writting
[QUOTE=Richy19;33201799]If this is a personal project with only you editing it, then it doesnt make that much difference. The main reason that you make get/set methods is so that people that havent used your code wont fuck stuff up by accident.[/QUOTE] What, no. The main reason for getters and setters is so [B]nobody[/B] fucks up stuff by accident. You won't remember everything in your personal project even if you're the only one writing it. Not saying you always need to use setters and getters, I just mean that if you feel like they're useful, then use them.
[QUOTE=Darkest_97;33201735]Is it better to have all class level variables private, and have get and set methods for each? Or is it better to make everything public? I've been taught the first, and I was always told thats how it should be done.[/QUOTE] It just makes your code look a little neater if you use getters/setters. They're not necessary though if you're only retrieving or assigning members. They are most useful for when you want 'something' to happen when the variable changes value or when something grabs the value.
I'm trying to get some OpenGL 3.2 stuff working on OS X, just to find that nothing is showing up. I looked in OpenGL Profiler to find that I'm getting a GL_INVALID_OPERATION error on glEnableVertexAttribArray, as well as glDrawArrays and glDisableVertexAttribArray. I looked at glEnableVertexAttribAPPLE but have no idea what to put in the GLenum parameter. Here's a screenshot: [IMG]http://i.imgur.com/53W81.png[/IMG]
[QUOTE=jalb;33104243]I have a 3D box. I have a 3D direction vector. I want to rotate this box so that it is "facing" that direction. Specifically, I'm trying to calculate a rotation matrix. [/QUOTE] Finally got this working properly. [cpp]D3DXVECTOR3 up; D3DXVec3Cross(&up, &D3DXVECTOR3(0, 1, 0), &normal); if (D3DXVec3LengthSq(&up) == 0) { D3DXVec3Cross(&up, &D3DXVECTOR3(0, 0, 1), &normal); } D3DXVec3Normalize(&up, &up); D3DXVECTOR3 right; D3DXVec3Cross(&right, &normal, &up); D3DXVec3Normalize(&right, &right); right *= -1; rotate.m[0][0] = right.x; rotate.m[1][0] = up.x; rotate.m[2][0] = normal.x; rotate.m[3][0] = 0; rotate.m[0][1] = right.y; rotate.m[1][1] = up.y; rotate.m[2][1] = normal.y; rotate.m[3][1] = 0; rotate.m[0][2] = right.z; rotate.m[1][2] = up.z; rotate.m[2][2] = normal.z; rotate.m[3][2] = 0; rotate.m[0][3] = 0; rotate.m[1][3] = 0; rotate.m[2][3] = 0; rotate.m[3][3] = 1;[/cpp] Not sure why I have to invert right but it works. v:v:v
-snip, wrong thread-
How would I go about to create simple animations in a platform game with LÖVE? I can't come up with an efficient way to do it since I'm pretty new to game development. Perhaps it is over my skill level but it just looks so boring when the character floats along the ground.
Sorry, you need to Log In to post a reply to this thread.