# Jethro_T

Members

129

194 Neutral

• Rank
Member
1. ## Best Way To Calculate Reflection

Edit: No way to delete this thread?
2. ## OpenGL Help Me Find a Solution

I'm trying to figure out the best way to render some per-pixel destructible terrain.  Right now I load my map image into a series of textures (tiles) and keep the raw texture data stored in memory.  When the terrain is destroyed, I simply update my copy of the pixel data and use glTexSubImage2D to update the corresponding textures on the GPU.  Of course this is terrible because I'm wasting memory keeping a copy of the images around.  I'm using OpenGL ES 2.0 so I can't use glGetTexImage to grab the texels from the GPU, update them, then re-upload them.   I think a good solution would be to create and store a bitmask with the dimensions of the map image, with a single bit per pixel and simply store either a 0 or 1 depending on if the pixel has been destroyed or not.  If I do that, I need some sort of method to combine the textures with this bitmask to decide which pixels need to be rendered.  Is there some way I can accomplish this using blending or by uploading my mask to a pixel shader and rendering only the texels that have their mask bit set to 1?   Cheers to whoever can help me figure something out.
3. ## Cryptographic Hash Function Problem

Thanks for the post.  Here's my thinking (please correct me if I'm off track):   The output bits all change seemingly randomly with no visible tie to any of the input bits.   So we are basically looking to find the probability of finding a bit string of length 256 that begins with 50 zeros, in a setting where all possible output cases have equal probability of occuring.   P(50 leading zeros) = (1 / 2^50)   So if we run the hash 2^50 times, we can expect to find a value of t that satisfies our requirement.   Not very rigorous, but yes, that is correct. The easiest way to show it (IMO) is to consider H as a random oracle, such that for distinct inputs X and Y, every bit of H(X) and H(Y) are independent. Then, the probability of any one bit being zero is 1/2, and hence the probability of the first 50 bits being zero is 1/2^50.   On my last paragraph, you can also say, assume H is a secure 256-bit hash function. Then, define a new hash function H', which is simply the hash function H, truncated to the first 50 bits. By the bit independence criterion, H' is a "secure" 50-bit hash function (I use "secure" in quotes because while it technically has the required mathematical properties on 50 bits, it is too short to be secure in practice). Then, your problem is to find a preimage of H' for {0}^50, that is, find X such that:   H'(X) = {0}^50   Which by definition has complexity 2^50.   Note this is a bit out of reach for a single consumer-grade computer, but can be achieved in a few hours/days on a moderately sized cluster (say, 4 to 8 graphics cards).   Thanks a lot.  Very helpful :)
4. ## Cryptographic Hash Function Problem

Thanks for the post.  Here's my thinking (please correct me if I'm off track):   The output bits all change seemingly randomly with no visible tie to any of the input bits.   So we are basically looking to find the probability of finding a bit string of length 256 that begins with 50 zeros, in a setting where all possible output cases have equal probability of occuring.   P(50 leading zeros) = (1 / 2^50)   So if we run the hash 2^50 times, we can expect to find a value of t that satisfies our requirement.
5. ## Cryptographic Hash Function Problem

This is the question I'm trying to ask:
6. ## Cryptographic Hash Function Problem

This is related to my school work, I've basically created an example of a problem that I need to solve to better understand some things.   Say we are given a 128 bit message, m We have a secure hash function H(x) that produces 256 bit output   We want to find a 128 bit value, t, such that H(m || t) gives us a result that has 50 leading zeros.  Note: m || t is m concatenated with t.   The question is, how many times do we need to call the hash function so that we can expect to find at least one value of t that satisfies our requirement.   All help  is appreciated.
7. ## Tail Recursion

I solved my problem this morning before I got a chance to get on the computer to check the replies to my post.  Seemed very easy this morning when I thought outloud "The value of f(n) is the value of the last 4 values of f(n)."  Naturally this made me realize immediately that I simply needed to start from the bottom 4 cases and build up the value of the function by simply keeping track of the previous 4 values of f(n).   My implementation in scheme: [source] (define (q2iterative n)   (define (q2iter n a b c d)     (if (= n 0)       a             (q2iter (- n 1) (+ a (* b 2) (* c 3) (* d 4)) a b c)     )   )     (if (< n 4)       n             (q2iter (- n 3) 3 2 1 0)   ) ) [/source]
8. ## Tail Recursion

Hey guys, I have a function that I implemented easily using regular recursion but I've been trying to figure out how to write it using tail recursion instead, I can't seem to wrap my head around it though at all.   The function is:   if n < 4: f(n) = n   else: f(n) = f(n - 1) + 2(f(n - 2)) + 3(f(n - 3)) + 4(f(n - 4))   Can anyone help me figure out how to solve this using tail recursion?
9. ## CS Honors Project

I'm a 3rd year CS major and former hobby game programmer throughout highschool and during my first year of uni. I have to do an honors project next year so it's time to start thinking of a good topic to work on. I know this forum is filled with great people, so it's the first place I thought I would come to ask for any ideas. I want the project to have a large programming component, but it also needs to have something that is academically interesting. My interests include: 1. Game development, specifically interested in persistent online (not neccessarily massive) multiplayer player worlds 2. Parallel programming, I would love to be able to find something related to games and parallel programming 3. Networking 4. Procedural generation of things related to games, something that is NOT terrain related Does anyone have any ideas that could help me find a topic? I'm open to ideas that aren't related to my posted interests. All input is greatly appreciated!
10. ## Pointers and Booleans

How come it's perfectly fine to do: [source] int* ptr = 0; if (ptr) {} [/source] But I get "Forcing value to bool (performance warning)" when I do: [source] int* ptr = 0; bool isValid() { return ptr; } if (isValid()) {} [/source] I don't understand how these are any different.
11. ## Custom Flash Video Player

Thanks, that was a very informative reply. I'm not sure if my main problem was clear/specific enough though so I'll try to explain it better. - I want to build a simple site that has a custom flash player that has additional functionality - For example, I want my flash player to be able to repeat specified segments of the video (The user enters something like 0:10 to 0:20 and it loops that part of the video) - I want users to be able to enter the address of videos stored on other sites (around 10 or so different sites) - I want the video to play through my custom player as it is streamed from the 3rd party servers to the user (I don't want it downloaded to my server) Is this possible?
12. ## Custom Flash Video Player

Is it possible to build a custom flash video player in a browser that is capable of grabbing video files off of a variety of other sites (YouTube, etc.) and playing them? If this is possible, I'm wondering if ther'e any mechanism that other sites can employ so that I can't play their videos in a custom player on my own site?
13. ## Basic Javascript and Html

I'm trying to learn some web programming and just spent hours trying to get the most basic javascript working. I don't understand where I'm going wrong, I've downloaded similar examples to the code I wrote and they work fine but my own javascript does not work at all! I would really appreciate if someone could take the time to try to help me figure out what I'm doing wrong. event.js [source] document.getElementById("width").onchange = checkDimensions; [/source] checkDim.js [source] function checkDimensions() { document.getElementById("width").value = "HELLO"; return false; } [/source] index.html [source] <?xml version = "1.0" encoding = "utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd[/url]"> <html xmlns = "[url="http://www.w3.org/1999/xhtml"]http://www.w3.org/1999/xhtml[/url]"> <head> <title>Canvas Printing Calculator</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <link rel="stylesheet" href="style.css"/> <script type="text/javascript" src="event.js"> </script> </head> <body> <form action=""> <input type="text" id="width" size="30"/> </form> </body> <script type="text/javascript" src="checkDim.js"> </script> </html> [/source]
14. ## Help with strtok() in C

I keep getting access violations. Can anyone see what I'm doing wrong? I'm trying to split up a first and last name separated by a space character. [source] char buffer[128], firstName[64], lastName[64]; char token = 0; scanf("%s", buffer); fflush(stdin); token = strtok(buffer, " "); if (token) { strcpy(firstName, token); token = strtok(0, " "); if (token) strcpy(lastName, token); else strcpy(lastName, "\0"); } else { strcpy(firstName, "\0"; } [/source]
15. ## Concept Artist job definition

A concept artist comes up with an idea for how something should look, then they draw it. Once your design is approved, a 3D modeller or spriter will create the ingame artwork based off of your concept art.