u better learn how 2 do conversions on the fly. ur gonna be doing alot of it every day u program LOL
[QUOTE=W00tbeer1;35856465]There is always at least 1 question converting between binary and hexadecimal and stuff, I always guess and get it wrong erry time. Doing this as a self-study and I feel it would take too long and too much effort for just one question. If anybody feels like they can explain it to me easily I could post the question for you.[/QUOTE]Each hexadecimal digit is equal to 4 bits since 2 to the 4th power is 16, the number of possible digits in hex. So, if you have hex 0xFF that's binary 11111111, and 0xF0 would be 11110000.
0 is the lowest hex value with a binary value of 0 (0000), and F is the highest with a value of 15 (1111), for the values in between just count up.
For going backwards (binary to hex), just convert every 4 bits into decimal (0-15) then convert it to a hex digit. 9 would be 9, "A" would be ten, and "F" would be 15. The rest should be pretty self explanatory.
[QUOTE=Mr_Razzums;35856937]u better learn how 2 do conversions on the fly. ur gonna be doing alot of it every day u program LOL[/QUOTE]
Wow, thanks for the advice! I will treasure it, always.
[editline]7th May 2012[/editline]
Close to my heart.
[QUOTE=voodooattack;35857009]Wow, thanks for the advice! I will treasure it, always.
[editline]7th May 2012[/editline]
Close to my heart.[/QUOTE]
Rated [img]http://www.facepunch.com/fp/ratings/heart.png[/img]. Get that [img]http://www.facepunch.com/fp/ratings/tick.png[/img] out of here, the heart needs to be closer to voodooattack.
[QUOTE=Mr_Razzums;35856937]u better learn how 2 do conversions on the fly. ur gonna be doing alot of it every day u program LOL[/QUOTE]
I could argue you would be doing a lot of spelling and putting proper sentences together. But I don't have any proof to back it up. (Not every programmer deals with bits, bytes and decimal/hexadecimal conversions, especially not in their head.)
[QUOTE=Topgamer7;35857037]I could argue you would be doing a lot of spelling and putting proper sentences together[b], but[/b] I don't have any proof to back it up. (Not every programmer deals with bits, bytes and decimal/hexadecimal conversions, especially not in their head.)[/QUOTE]
Fixed.
[b]Edit:[/b]
I'll post content soon.
Anyways, think of binary like counting, except in binary, you count to 1. So there are only two possible values, 0 and 1.
For example, 4 in binary is 100.
To count to 4 you start at 0, move to 1, then 2, then 3, then 4. Wa-la 4.
Now to do so in binary, start at 0, move to 1, then 10, then 11, then 100.
Now every digit in a number has a specific value. For example the number 4561.
The value of the 4 is 4 times 10 to the power of the index of the number. So 4's value is
4 x 10^3.
So the composition of 4561 is 4x10^3 + 5x10^2 + 6x10^1+1x10^0.
The same principal applies to binary composition, except you multiply times 2 to the power of the index.
1 x 2^2 + 0x10^1 + 0x10^0 = 4
And still applies to hexadecimal. Except that values range from 0 to F (15 in decimal).
So all the base numbers in hexadecimal is 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F.
So the composition of some number in hex, for example FEB9 is:
15 x 16^3 + 14 x 16^2 + 11 x 16^1 + 9 x 16^0 = 65,209.
Coincidentally the conversion from hex to binary is easy, because both are 2 to the power of
something, hex translate quite easily to binary.
F in binary is 1111, E is 1110, B is 1011, 9 is 1001. (you can find these by counting, if you take a
low level course, you'll probably end up memorizing most of them). So you can just append them together.
FEB9 = 1111 1110 1011 1001.
Now just to get decimal to binary, you can just continally divide by 2 (with a remainder).
take 49 for example.
49/2 = 24 remainder 1
24/2 = 12 remainder 0
12/2 = 6 remainder 0
6/2 = 3 remainder 0
3/2 = 1 remainder 1
1/2 = 0 remainder 1
49 in binary is 110001 (start bottom to top).
Wa-la you can convert in binary, hex and dec.
[code]main:
(3, 3)add
:
add:
+
:[/code]
Woot woot, this example now works correctly. The (),s are just eye candy, ignored by the interpreter, but it's useful to look at things in such a manner.
[QUOTE=W00tbeer1;35856465]AP Computer Science is on Tuesday... just took my final practice test.[/QUOTE]
Ah, I remember the AP CS test. What a waste..
I was especially intrigued by one of the previous AP CS tests which included a free response asking you to write a class to take a string of digits and treat it as an arbitrary length integer, and implement operations like add and subtract. I just wrote a class that wrapped BigInteger and neither I nor my teacher at the time could find any reason, in the directions or elsewhere, for this answer to be marked incorrect :v:
I don't have AP CS at my school, but it seems like a total waste to know how to convert from binary to hex. No where in my programming have I ever needed to know how to do that, and if I did I just googled the needed conversions. It seems like the test postulates that programming is a one way, you can only put in what you know and have no outside help. In my opinion, that's pretty close minded and counterproductive. However I know nothing about the test save the conversions part so I may be wrong.
[QUOTE=W00tbeer1;35856465]AP Computer Science is on Tuesday... just took my final practice test.
[t]http://i49.tinypic.com/23rqrn5.png[/t]
There is always at least 1 question converting between binary and hexadecimal and stuff, I always guess and get it wrong erry time. Doing this as a self-study and I feel it would take too long and too much effort for just one question. If anybody feels like they can explain it to me easily I could post the question for you.[/QUOTE]
Can't wait for Tuesday! I haven't prepared really because my Computer Science teacher didn't teach me, as I was the only one in the AP class. I showed him that I knew C++, so he recommended I took the AP Computer Science course. As a learning project, I made an Android App which later allowed me to get the PlayBook for free. Anyway, good luck to you!
[QUOTE=Lexic;35852191]I found GLFW to be perfect, except for the fact that it doesn't have any kind of debugging information what so ever. Apparently she's fixed that in v3 though.
What do you need the window position for?[/QUOTE]
To determine mouse-position in windowed mode without locking the mouse.
Removed the Randoms from my physics calculation method and put the random mult in the physbox object instead (I randomize it when I create the object) and now 32768 particles is being run in under 0ms :v:
[QUOTE=dije;35858959]in under 0ms :v:[/QUOTE]
I somehow doubt that
[QUOTE=Maurice;35858967]I somehow doubt that[/QUOTE]Only boundary calculations so far
[editline]7th May 2012[/editline]
Basically just doing velocity and gravity and then forcing the position to be within the bounds
[editline]7th May 2012[/editline]
I now run 32k particles on each Worker and I get about 3ms average operation time.
[QUOTE=dije;35858975]Only boundary calculations so far
[editline]7th May 2012[/editline]
Basically just doing velocity and gravity and then forcing the position to be within the bounds
[editline]7th May 2012[/editline]
I now run 32k particles on each Worker and I get about 3ms average operation time.[/QUOTE]
And that happens faster than instantly? < 0ms?
[QUOTE=Maurice;35858983]And that happens faster than instantly? < 0ms?[/QUOTE]3ms, I got the wrong numbers
[QUOTE=Mordi;35858933]To determine mouse-position in windowed mode without locking the mouse.[/QUOTE]
void glfwGetMousePos( int *xpos, int *ypos )
That works for that exact purpose? It returns mouse position in relation to the upper-left bound of the window. Works flawlessly (just tested it).
edit: here's a pretty barebones example. Just make sure to have a console attached to it.
[code]#include <iostream>
#include "GL/glfw.h"
void windowsettings(){
glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 0); //full screen antialiasing
glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE, GL_FALSE); // false = resizable window
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); //version 3 of openGL
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2); //version 3.2 of openGL
}
int main(){
if(!glfwInit()){
return EXIT_FAILURE;
}
int mouseX = 0;
int mouseY = 0;
windowsettings();
// Open an OpenGL window
if(glfwOpenWindow(0, 0, 0, 0, 0, 0, 16, 0, GLFW_WINDOW)){
glfwSetWindowTitle("Beep boop it's a title");
} else{ //oh fuck we failed
glfwTerminate();
return EXIT_FAILURE;
}
while(glfwGetWindowParam(GLFW_OPENED))
{
if(glfwGetWindowParam(GLFW_ACTIVE)){ //do we have focus?
glClear( GL_COLOR_BUFFER_BIT );
glfwSwapBuffers(); // Swap front and back rendering buffers
if(glfwGetKey(GLFW_KEY_ESC)) glfwCloseWindow();
glfwGetMousePos( &mouseX, &mouseY);
std::cout << "Mouse: {" << mouseX << ", " << mouseY << "}\n";
}else{ //we don't have focus, so we sleep
glfwSleep(.5);
glfwPollEvents(); //tell OS that we are alive!
}
}
glfwTerminate(); // Close window and terminate GLFW
return EXIT_SUCCESS; // Exit program
}[/code]
My maths teacher found these while cleaning out a cupboard and thought I'd be interested:
[img]http://i.imgur.com/L9Ea9h.jpg[/img]
[img]http://i.imgur.com/FKknHh.jpg[/img]
[QUOTE=swift and shift;35859122]My maths teacher found these while cleaning out a cupboard and thought I'd be interested:[/QUOTE]
Relevant wiki articles:
[url]http://en.wikipedia.org/wiki/MONECS[/url]
[url]http://en.wikipedia.org/wiki/Mark_sense[/url]
[vid]http://dl.dropbox.com/u/41041550/videos/Particles.webm[/vid]
[editline]7th May 2012[/editline]
This is 8192 particles run on one worker, lagging because of compression and fraps
[QUOTE=swift and shift;35859122]-fortran-[/QUOTE]
I find really old computer stuff fascinating.
To see the differences between modern and the modern-not-that-long-ago.
Makes me wonder where computers will be by the time I'm old.
[QUOTE=Icedshot;35855824]I've been inadvertently learning some opengl in the whole opencl -> opengl interop thing
Is it just me, or is the whole concept of immediate mode (in terms of performance) obviously flawed? Pushing your vertices every frame to the graphics card is asking for performance issues.
Plus, it's difficult to find resources on opengl which aren't deprecated (ie immediate mode). The interface is ugly, and everything seems a little bit.. randomly named/functioning. I also dislike the fact that it works as a state machine, because that means having to unnecessarily bind and unbind textures and everything else everytime you think about using them, as well as all the matrices and etc that you might want to associate with them. It makes the code a complete, obtuse scattering of functions
The whole thing is a mess of deprecated and non deprecated functions. Someone needs to scrap all of it and go for a new, cleaner and much simpler standard
I would love to hear any counterarguments against any of my points. Perhaps i've missed a particularly helpful resource page, or maybe I haven't quite grasped something. But currently my opinion of OpenGL is that it is pretty awful[/QUOTE]
Immediate mode is from the 90s.
Try these:
[url=http://www.amazon.co.uk/dp/0321712617]OpenGL SuperBible[/url] (Explains [B]everything[/B]) [url=http://www.opengl-tutorial.org/]OpenGl-Tutorial[/url] (good 'getting started' guide, no real info) [url=http://www.arcsynthesis.org/gltut/]Learning Modern 3D Graphics Programming[/url] (Looks good, I haven't read it)
[QUOTE=Lexic;35859193]Immediate mode is from the 90s.
Try these:
[url=http://www.amazon.co.uk/dp/0321712617]OpenGL SuperBible[/url] (Explains [B]everything[/B]) [url=http://www.opengl-tutorial.org/]OpenGl-Tutorial[/url] (good 'getting started' guide, no real info) [url=http://www.arcsynthesis.org/gltut/]Learning Modern 3D Graphics Programming[/url] (Looks good, I haven't read it)[/QUOTE]
Or maybe just [url=http://open.gl]open.gl[/url]?
[QUOTE=ZenX2;35859210]Or maybe just [url=http://open.gl]open.gl[/url]?[/QUOTE] Oh man, he's going to be able to open the most non-deprecated blank window ever!
Now my engine supports looped background music!
[QUOTE=dije;35859149]*video*
This is 8192 particles run on one worker, lagging because of compression and fraps[/QUOTE]
Everytime I watch it, as soon as the particles spawn, my eyes go all fucking spastic. But nice work nonetheless.
[QUOTE=Lexic;35859193]Immediate mode is from the 90s.
Try these:
[url=http://www.amazon.co.uk/dp/0321712617]OpenGL SuperBible[/url] (Explains [B]everything[/B]) [url=http://www.opengl-tutorial.org/]OpenGl-Tutorial[/url] (good 'getting started' guide, no real info) [url=http://www.arcsynthesis.org/gltut/]Learning Modern 3D Graphics Programming[/url] (Looks good, I haven't read it)[/QUOTE]
More specifically 1992. Immediate mode is 20 years old. DirectX 1.0 was released in 1995 and DirectX 8 was released in 2000, for the person who said immediate mode = DirectX 8.
The reason immediate mode was used initially was because back then, the overhead of a method call was nothing compared to the time the vertex processor took (plus the number of vertices rendered was tiny compared to today's models). OpenGL 1.1, released in the same year, added support for vertex arrays. That means that immediate mode was the exclusive way to render with OpenGL for less than a year.
In addition to the OpenGL SuperBible (which I have a copy of, immensely useful both as a guide and a reference) and the two online guides you posted, both of which I usually recommend, this: [url]http://www.swiftless.com/opengltuts/opengl4tuts.html[/url]
With modern OpenGL, most of the "state" is gone. No matrix state, no lighting/material state, etc. The only state you'll ever deal with are things you'll typically enable once and leave on (depth testing, blending, etc), (un)binding buffers/textures, and enabling/disabling vertex attributes.
Oh, and a tip to keep in mind when learning about modern OpenGL: As graphics technology evloved, more triangles could be drawn in less time. At some point that time got so small that the time a method call takes became significant. Because of this, the way to optimize rendering is to do as much as possible during initialization, store it, and call it during the main loop.
So when you see something like VAOs, realize that they're made only to offset as much work as possible to initialization.
I made this scanner thing
[vid]http://dl.dropbox.com/u/3077939/scanner_1.webm[/vid]
[QUOTE=Foda;35853959]I doubt we will ever see XNA 5.0[/QUOTE]
Hmm? Why do you say that. The next generation Xbox will likely have a hobbyist API and XNA 5.0 seems the natural progression. Also Visual Studio 11 won't integrate with XNA 4.0, so unless they just do 4.0 refresh 2... Even if there isn't XNA 5.0, nothing to stop MonoGame taking it further, they've pretty much got everything except the content pipeline compile integrated now.
Sorry, you need to Log In to post a reply to this thread.