• What are you working on? v16
    5,004 replies, posted
Got UV mapping inside the vertex shader working. Took me awhile to figure out that glVertexAttribPointer wasn't working correctly when I passed GL_INT as [i]type[/i]. So, I passed GL_FLOAT as [i]type[/i] and it worked fine (even though I was using the data as integers in the shader.) What the hell? Also, added a very simple lighting model. [url=http://eagle.undo.it:8083/img/kintel_17.png][img]http://eagle.undo.it:8083/img/kintel_17_th.png[/img] [i]Click to view uncropped[/i][/url] [b]Edit:[/b] Eh? Media tags didn't work...
[QUOTE=jA_cOp;29370419]Don't use the C++ compiler for C code :sigh:[/QUOTE] It's C++, only that snippet I posted looks like C.
[QUOTE=Chandler;29370811]I don't know if you notice it or not, but he's compiling a .cpp file. The small snippet he's posted just happens to look almost exactly like C because of the stdio function calls. :P[/QUOTE] I know that, but the code is C (as well as C++, incidentally). It's really quite silly to write C code with a C++ compiler.
[QUOTE=jA_cOp;29370419]-funroll-loops.[/QUOTE] [url]http://funroll-loops.info/[/url]
I just got a trigger system working! Every class that implements an interface needs an enum of possible actions to run on a trigger (generics), and you can create a Trigger class with anything that implements that interface, and then store the FireEvent() method in another class's delegate method to be fired whenever. Seems like a significantly cleaner and more dynamic method of doing it than I was on my last project, where we simply subclassed a Cause and an Effect, stored both in a Trigger class, then iterated through a list of Triggers, each of them checking to see if a conditional was true. With every new Cause or Effect that we wanted to add, I'd have to release a new update to my level editor for the rest of the team to use, and I'd have to modify the map format to allow it, then update our parsers. Now it should be all automatically tied to different classes, and I can pull the enum through a method in the interface. [editline]edit[/editline] this will make the camera move forward. I personally find it annoying to have to define both Camera and Camera.CamActions as types, since I have a method in my interface to get the type of the enum used in that class. I'll look into getting something like that working (anyone know how?) TestObject is just a class I created that implements IDrawable so that it would conveniently fit in my drawables List, and it has a delegate method. I pass in an object array to the Trigger because each action will likely require a different number and different types of parameters. [csharp]Trigger<Camera, Camera.CamActions> trig = new Trigger<Camera, Camera.CamActions>(c, Camera.CamActions.Move, new object[] { 10.0f }); testObject.ManuallyTriggered += new DelegateVoid(trig.FireEvent); // ... if (Keyboard[OpenTK.Input.Key.E]) { ((TestObject)drawables[1]).ManuallyFireEvent(); }[/csharp]
[QUOTE=jA_cOp;29370991]I know that, but the code is C (as well as C++, incidentally). It's really quite silly to write C code with a C++ compiler.[/QUOTE] scanf and printf are faster than cin and cout. [editline]23rd April 2011[/editline] [QUOTE=likesoursugar;29362295]Will probably throw my a* pathfinding in the trash can and use some kind of vector based pathfinding instead. So I'll need to add some new features to my map editor. This is a photoshoped picture how it may work. [img_thumb]http://img191.imageshack.us/img191/2941/newpathfinding.png[/img_thumb] [/QUOTE] A* works on graphs so there's no need to trash it. [editline]23rd April 2011[/editline] [QUOTE=Tangara;29366332]Isn't Kento written in C#?[/QUOTE] Yes but I need to simulate memory so my references can work the way I want them to.
[QUOTE=Darwin226;29371089]Yes but I need to simulate memory so my references can work the way I want them to.[/QUOTE] I don't get why you'd need to do that, can you elaborate? [editline]23rd April 2011[/editline] [QUOTE=jA_cOp;29370991]I know that, but the code is C (as well as C++, incidentally). It's really quite silly to write C code with a C++ compiler.[/QUOTE] I only use C++ for informatics stuff, and even then I just use it for the STL. Anyhow, I stripped out the C++ parts from the snippets above and compiled it with GCC and it was still slower with optimizations on.
[QUOTE=Tangara;29371261]I don't get why you'd need to do that, can you elaborate? [/QUOTE] Well to be honest I don't really go into much research when I want to do something and just do the first thing that comes to mind and works. I have a List of Values (everything but Operators derive from Value). Then there are References that hold and Index, pointing to one Value in that list. When the parser reaches something like "a = 5" it first evaluates the Identifier a, since a is not assigned, it makes a new Reference pointing to a new memory location. Then, in the current scope, adds a new <string, Reference> pair so that the new reference can be accessed from code. Then the = operator sets the new reference to a Number (5). Now, when the parser enters a scope, a new Scope object is pushed on the stack on which the identifiers will be registered and when the scope is exited, a "garbage collector" sweep goes through the scope removing all the string-Reference links and then all references that don't have a linked identifier. So that's how it works and it's working fine so far (except for this stupid memory leak that I've been hunting for 3 days) [editline]23rd April 2011[/editline] Oh and naturally, when a reference is removed, it checks if there are any references left pointing to it's location, if there are none, it frees that memory slot.
[img]http://i.imgur.com/cgI7S.png[/img] Pretty inconclusive... [img]http://i.imgur.com/bNhM4.png[/img] And for shits and giggles, the same compiled with the Tiny C Compiler.
I'm gonna be livestreaming on [url]http://www.livestream.com/backwardspy[/url] if anyone wants to come watch. Most likely programming my Otomata-like toy. Feel free to come along and tell me I'm coding everything all wrong :v:
[QUOTE=bootv2;29371060]welcome back, austech.[/QUOTE] I never left.
Haha! You only got 2 post! Sucker!
[QUOTE=Darwin226;29373105]Haha! You only got 2 post! Sucker![/QUOTE] I have a feeling that this post is going to have every single rating in a few moments. EDIT: Called it :smug:
I put this little programming problem site together: [url]http://notorac.charlie.bz/[/url] Some of you guys might enjoy it. Some of the problems are serious problems, the others are very vague riddles. I'm continually adding more problems and if you have an idea for one, please send it to me.
[QUOTE=Night-Eagle;29370820]Took me awhile to figure out that glVertexAttribPointer wasn't working correctly when I passed GL_INT as [i]type[/i]. So, I passed GL_FLOAT as [i]type[/i] and it worked fine (even though I was using the data as integers in the shader.) What the hell?[/QUOTE] Not sure which version of OpenGL you are using, but you may need to use glVertexAttribIPointerEXT instead, it's part of the GPU Shader 4 extension, if you want to use integer attributes in your shader.
[img]http://img405.imageshack.us/img405/8069/workingle20110423151705.jpg[/img] :pcgaming: 1 FPS.
[QUOTE=Tangara;29373585]I put this little programming problem site together: [url]http://notorac.charlie.bz/[/url] Some of you guys might enjoy it. Some of the problems are serious problems, the others are very vague riddles. I'm continually adding more problems and if you have an idea for one, please send it to me.[/QUOTE] Are you planning to add more languages? Java or C# would be great. I suck so hard at C I can't even do the Addition problem. [cpp]#include <stdio.h> int main() { int a, b; scanf("%d", &a); scanf("%d", &b); printf("%d", a+b); }[/cpp] What's wrong with it? :saddowns: It should show the input and the wrong output when the attempt fails.
[QUOTE=Robber;29375617]Are you planning to add more languages? Java or C# would be great. I suck so hard at C I can't even do the Addition problem. [cpp]#include <stdio.h> int main() { int a, b; scanf("%d", &a); scanf("%d", &b); printf("%d", a+b); }[/cpp] What's wrong with it? :saddowns: It should show the input and the wrong output when the attempt fails.[/QUOTE] hi variables a and b don't have a memory address they are "uninitialised variables", they have a random value (well, not really random but not something you can rely on at all), and no memory address. So trying to access the memory address of something that doesnt exist gives strange results :v:
[QUOTE=Icedshot;29375800]hi variables a and b don't have a memory address they are "uninitialised variables", they have a random value (well, not really random but not something you can rely on at all), and no memory address. So trying to access the memory address of something that doesnt exist gives strange results :v:[/QUOTE] I thought they have a memory address on the stack as soon as I declare them but until I initialize (= overwrite) it, it has a "random" value? [cpp]#include <stdio.h> int main() { int a=0; int b=0; scanf("%d", &a); scanf("%d", &b); printf("%d", a+b); }[/cpp] That should work, right? Because it doesn't.
I have a challenge for anyone bored enough to take it up. A project I was working on mysteriously started crashing and I have no idea why. If you have nothing better to do, download it and see if you can find out why it's crashing and, even better, fix it! I haven't got anything to offer you but my eternal gratitude. [url]http://dl.dropbox.com/u/6661951/Programming/ma_src.zip[/url] Needs to be linked with SFML2 Edit: I should add that me and Austech and BlkDucky (mostly Austech) sat on my livestream for hours trying to figure it out, with nothing found at the end of it all. Very mysterious!
When you declare variables, they always have a memory address. It doesn't matter if they're not initialised, they still exist in memory - they just hold a random value. What part of your code is not working? It should spit out 2 seemingly random integers, and then 0.
[QUOTE=thomasfn;29376140]When you declare variables, they always have a memory address. It doesn't matter if they're not initialised, they still exist in memory - they just hold a random value.[/quote] That's what I thought too, I don't see why it's not working. Is it possible that turb's site isn't working properly? Because I can't test it on my own PC because I don't have a C/C++ compiler and his site says it works for 2 out of 3 cases. [QUOTE=thomasfn;29376140]What part of your code is not working? It should spit out 2 seemingly random integers, and then 0.[/QUOTE] Why the two random numbers? I thought scanf was to read, not to write? [b]Edit:[/b] I just looked it up, and yes, I'm doing it right: [url]http://www.cplusplus.com/reference/clibrary/cstdio/scanf/[/url] [cpp]int n; scanf ("%d",&n);[/cpp]
[QUOTE=Chris220;29376091]I have a challenge for anyone bored enough to take it up. A project I was working on mysteriously started crashing and I have no idea why. If you have nothing better to do, download it and see if you can find out why it's crashing and, even better, fix it! I haven't got anything to offer you but my eternal gratitude. [url]http://dl.dropbox.com/u/6661951/Programming/ma_src.zip[/url] Needs to be linked with SFML2 Edit: I should add that me and Austech and BlkDucky (mostly Austech) sat on my livestream for hours trying to figure it out, with nothing found at the end of it all. Very mysterious![/QUOTE] Il give it a go if you can also give me the SFML2 libs for V2010
[QUOTE=Chris220;29376091]I have a challenge for anyone bored enough to take it up. A project I was working on mysteriously started crashing and I have no idea why. If you have nothing better to do, download it and see if you can find out why it's crashing and, even better, fix it! I haven't got anything to offer you but my eternal gratitude. [url]http://dl.dropbox.com/u/6661951/Programming/ma_src.zip[/url] Needs to be linked with SFML2 Edit: I should add that me and Austech and BlkDucky (mostly Austech) sat on my livestream for hours trying to figure it out, with nothing found at the end of it all. Very mysterious![/QUOTE] That might be the SFML-crashing-on-ATI-cards bug. Download this DLL and place it in the same folder as your EXE and see if it works: [url]http://www.kn00tcn.net/kn-atigktxx-10.4.zip[/url] I had the exact same problem with my game, so...
[QUOTE=Chris220;29376091]Edit: I should add that me and Austech and BlkDucky (mostly Austech) sat on my livestream for hours trying to figure it out, with nothing found at the end of it all. Very mysterious![/QUOTE] One could say I didn't help at all. And they'd be right. :v:
Oh I didn't notice it was scanf. My bad.
[QUOTE=Icedshot;29375800]variables a and b don't have a memory address[/QUOTE]Yes they do. [QUOTE=Robber;29375857]I thought they have a memory address on the stack as soon as I declare them but until I initialize (= overwrite) it, it has a "random" value? [cpp]#include <stdio.h> int main() { int a=0; int b=0; scanf("%d", &a); scanf("%d", &b); printf("%d", a+b); }[/cpp] That should work, right? Because it doesn't.[/QUOTE] You're very close, change them to long doubles and you've got it. [cpp] #include <stdio.h> int main (int argc, const char * argv[]) { long double a=0.0f; long double b=0.0f; scanf("%Lf", &a); scanf("%Lf", &b); printf("%1.0Lf", a+b); return 0; } [/cpp]
[QUOTE=Epic Sandwich;29376764]Yes they do. You're very close, change them to long doubles and you've got it. [cpp] #include <stdio.h> int main (int argc, const char * argv[]) { long double a=0.0f; long double b=0.0f; scanf("%Lf", &a); scanf("%Lf", &b); printf("%1.0Lf", a+b); return 0; } [/cpp][/QUOTE] If that's truly the answer, what the fuck? That was mentioned nowhere.
[QUOTE=Epic Sandwich;29376764]You're very close, change them to long doubles and you've got it.[/QUOTE] Thanks. The problem description sucks though. There is no mention of decimal numbers (is that the right term?) and huge numbers. The sample is 1+2!
The problem with this site is that not enough info is provided as to how the data will be entered. Will it be from a file, or from user input? What file do you read from? etc.
Sorry, you need to Log In to post a reply to this thread.