How on earth does that work then
I have a few hours experience in SFML.
I'm going to try to make a tile engine.
THIS SHALL END WELL
edit: failed already
Our first exercise session (for 2nd year College Physics) in C++ was already using classes and all that stuff. Skipped the Hello World stuff right away.
Test out if given the opportunity, or sit back and enjoy what you can of the course. I think this upcoming semester I'll have time to take intro to C++, and while I don't see it being very entertaining, it'll give me the chance to blow time outside of the house.
In case anyone here cares, http://travis-ci.org just added python and perl to their list of supported languages. I set it up for my build system (yeah I'm just gonna trudge through with it. I think I also figured out my performance issue), and it's really neat. One of the PITA issues with python is getting a decent continuous integration system that "just works" and doesn't require the JVM to run, or a simple config system.
I kind of wish they would use tox for generating information, but oh well. It works with python 3.2, that's good enough for me. I figured some of you here might want to use it for unit-tests or something.
I'm surprised you're still in the win32 world then.
The heady world of GUI Linux coding is so full of excessively complex required configuration that you'd probs pop a boner every time you opened your personally compiled and tweaked copy of vim/emacs with all your hand written plugins and cfg files.
Just out of curiosity, why should the texture loading routines be avoided?
I already have a loader for uncompressed tga (written in C) and png (through libpng) images, and I can salvage my libjpeg, etc, code from another project. However, using the GLFW provided functions would shrink my codebase and it is appealing to me to make the most of the fewest number of libraries possible.
At first I was concerned that GLFW might not be able to handle sRGB textures, but it looks like you can decode the images with GLFW separately and manually load the data into OpenGL.
Are you positive that something wasn't being optimized out? The compiler optimizes out anything that's unused.
Output:Code:#include <windows.h> #include <iostream> #include <iomanip> using std::cout; using std::endl; using std::setprecision; double PCFreq = 0.0; __int64 CounterStart = 0; void StartCounter() { LARGE_INTEGER li; if(!QueryPerformanceFrequency(&li)) cout << "QueryPerformanceFrequency failed!\n"; PCFreq = double(li.QuadPart)/1000000.0; QueryPerformanceCounter(&li); CounterStart = li.QuadPart; } double GetCounter() { LARGE_INTEGER li; QueryPerformanceCounter(&li); return double(li.QuadPart-CounterStart)/PCFreq; } int main() { int m = 1; int a = 0; double l1 = 0.0; double l2 = 0.0; cout << "% 2 loop: "; for(int i = 0; i < 4; i++) { m = 1; StartCounter(); while(m != 0) { a += ((m % 2) != 0); //modulo can also return -1, so we do this to make both loops always add the same things. m += 1; } l1 += GetCounter(); } cout << setprecision (15) << (l1/4.0) <<" microseconds\n\n"; cout << "& 1 loop: "; for(int i = 0; i < 4; i++) { m = 1; StartCounter(); while(m != 0) { a += ((m & 1) != 0); //See the comment in the first loop. m += 1; } l2 += GetCounter(); } cout << setprecision (15) << (l2/4.0) << " microseconds\n"; m+=a; cout << a << endl; return 0; }
Ignore the 0 printed, I just have that so it doesn't optimize the loops out.Code:% 2 loop: 5100429.43656247 microseconds & 1 loop: 2637060.52375372 microseconds 0
Timing code from: http://stackoverflow.com/questions/1...ormancecounter
The code may not be great, but it shows that there is a measurable difference between "& 1" and "% 2", with "& 1" being much faster.
Edited:
This is with signed numbers, an unsigned "m" would result in the "% 2" and "& 1" being pretty much identical.
Edited:
Also, if you keep "m" signed but only deal with positive numbers(so it doesn't have to execute all the other instructions to preserve the sign), the "% 2" loop is ~3x slower. So, you should only use "% 2" when the dividend is unsigned.
I like coding shaders more than coding programs now...
Please help me :c
http://glsl.heroku.com/e#1770.4
I guess I do it because you can do more with less code, I mean 31 lines for this, including comments!
Also since when did Gran PC have a green name?
They can't deal with file errors or any format other than uncompressed targa. You also don't get any kind of response to such errors (or anything like "file not found") other than GL_FALSE.
stb_image on the other hand can load all common file formats, has several different levels of error reporting and is compiled into your project as a single .c file.
Edited:
(Also it plays nicely with PhysFS which is useful c:)
Don't. Write. X11.
Use SDL or SFML.
DO NOT WRITE X11.
Use GLUT.
FUCKING LISTEN TO ME DON'T FUCK WITH X11.
Linux isn't like Win32, you don't have a monolithic blob. X11 creates windows, but you still need to contact the window manager about fullscreen windows, and Xrandr about changing resolutions, and then catch segmentation faults to make sure you reset the resolution or you fuck up the desktop, and you have to make sure you don't grab input or you fuck up window managers, and lots of other shit.
Edit: I'm not trying to stress that you shouldn't write X11 code. I'm stressing that you musn't.
Edit 2: If it helps, I'm sure Hitler drafted the X11 specification.
Post #3172
Snip first part.
Keep the other.
Also, world editing is fun. Made a small town.
Adding more tiles is also really easy. Whenever I run out of empty tiles in the tileset I just expand it and change a number in the code.
And right click on a tile to select that texture.
Just finished my Arduino/C# network monitor. It is basically a line of LEDs lighting up as my download speed increases. The C# program allows you to choose which NIC you want to monitor and which serial port the Arduino is connected to. The speed is transmitted in Kb/s which is then mapped by the Arduino to fit the 7 LEDs.
It is probably very inaccurate and all that jazz, but it works!
Yo, MSVC homies, I gotta problem. More of what I was doing last night:
This is really starting to piss me off because this shit makes me run around in circles (sometimes literally, in code speak) and doesn't point at the actual problem. Generally what I see is a manifestation of an issue elsewhere (invalid casting, etc.).
When debugging, (and I'm sure this is probably a 2005-exclusive issue) I get shit like this. Data looks valid to the code, and doesn't segfault, and this occurs whilst my debugger says it's null or just invalid data, etc.
Can anyone explain to me why this occurs, and if it occurs outside of Source projects? Perhaps the pointer it's showing me is to memory that it found earlier on but not an exact representation of the pointer as it is right where my breakpoint is or wherever I'm stepping?
hm, I guess I have to retry it. I was pretty sure that % was faster but of course it wouldn't make sense as % does divide the number and that is significantly more work for a CPU than just byte operations
but then again I was just too busy drawing my new higher resolution sprites:
![]()
Haha, I know a lot of programmers are like this (myself included), but one could then argue that you should write the matrix and vector math yourself as well. And, as was stated by someone earlier, X11 is so horrific that no sane Linux developers touch it directly.
By the way, Maurice...
Get to work!
Remeber a few days ago I asked about mono and SFML speed? well turns out its almost at C++ speed for simple stuff
http://www.facepunch.com/threads/115...1#post34897694
its slow due to my laptop but both programs (C++ and C#) take around te same time to draw and such.
Might give some people something to think about :P
"Never" is a little extreme. How about "not any time soon"?
Im with null here, sure games might make a move from C++ to an easier language (like java or C#) but C/C++ wont be completelly forgotten.
Look at assembly, it still has its uses
This. X11 sucks. All the libraries that speak X11 suck. Xlib sucks.
XCB is about as good as it gets while still implementing X11.
But in general you shouldn't even think about touching X11 unless you're writing a window manager or a keylogger.
Edited:
Oh. I'm not terribly concerned with error reporting, but no png/jpeg support is a dealbreaker.
It's actually pretty useless at that point, since anyone could implement a TGA loader in ~20 lines of code. It's practically raw image data :\
Hey look I made a thing! :D
http://glsl.heroku.com/e#1780.1
Best JSON library for c/c++? Anyone got any opinions?
http://code.google.com/p/rapidjson/ Because its fast and i never used any other ones.
Wait, you're telling me there's stuff that still isn't already in Emacs by default ?
If you're comparing the two languages those benchmarks are silly. The only thing they really test of the native languages is how fast strings concatenate. Since the vast majority of the work done per frame is in the graphics drivers it doesn't matter at all how fast C# or C++ is.
json_spirit, it uses boost and works really well, i messed with many different libs and none of them was really clear to me but json_spirit works really well and straight out of the box(if you got boost which i assume you do)
whatever tickles your pickle
at the end of the day, if you're writing a game and you want to compile it for multiple devices (especially mobile devices), i guarantee you're gonna go with C or C++
I hate boost but thanks
It's my first time using OpenGL seriously and I'm having trouble translating things. In my Draw function I wanted to position a quad however the translating adds onto the last translate sending the quad speeding off in the direction.
Here's the code being run in the Draw function:
is there a way to... clear? the translation? i have no idea...Code:glTranslatef( -10.0f, 0.0f, 0.0f ); // do the rendering glBegin( GL_QUADS ); glVertex3f( (0-width), (0-height), 0.0f ); // top left glVertex3f( (0-width), (0+height), 0.0f ); // top right glVertex3f( (0+height), (0+height), 0.0f ); // bottom right glVertex3f( (0+height), (0-height), 0.0 ); // bottom left glEnd();
You can glTranslatef with reversed values (10, 0, 0).
Shameless plug
https://github.com/Zguy/Jzon
Oh god why did i not think of that...
Cheers!
Saving/loading is finished.
It can also save persistant data and send it to Lua upon loading, as demonstrated by the constant value in the video.
I just spent a half hour trying to figure out why a java school assignment wasn't working. I was using == to compare 2 strings instead of .equals().
It was a bad time.
I hate that about java
Just out of interest, why?
I've never actually used it, but it seems like a pretty damn useful set of tools. What about it do you dislike?
glPushMatrix(whatever)
glTranslatef(x, y, z)
/* draw */
glPopMatrix(whatever)
Small note that this is legacy OpenGL. We're moving away from immediate mode.
I'm guessing the fact it's an absolute monster to download / compile / use.
Spent today trying to figure out why SFML2 won't render my custom opengl shit or clear buffers. Decided to update to the latest version of SFML2, what harm could it do? Turns out quite a lot lol, the API has changed so I spent the rest of the day rejigging my code, only to find GWEN doesn't support this version. I then rejigged GWEN a bit and ended up with this:
Initial results suggest the newer version of sfml fixes my existing bugs, but it's broken GWEN![]()