Hard Light Productions Forums

General FreeSpace => FreeSpace & FreeSpace Open Support => Topic started by: Commander Zane on July 01, 2011, 06:48:22 am

Title: Copy / paste codes
Post by: Commander Zane on July 01, 2011, 06:48:22 am
After having to fix the codes (Started with HUD codes) that I get off of threads one time too many, I've reached my last nerve.
When I select the code to paste into Notepad, rather than appear as it does in the code field, it comes out as such:

This is part of the new bloom code that I wanted to look at, and surprise surprise it comes out like this instead of how it should.
Quote
varying float blurSize;uniform sampler2D tex;// Gaussian Blur// 512x512 and smaller textures give best results// 2 passes requiredvoid main(){   // Echelon9 - Due to Apple not implementing array constructors in OS X's    // GLSL implementation we need to setup the arrays this way as a workaround   float BlurWeights[11];   BlurWeights[0] = 0.0402;   BlurWeights[1] = 0.0623;   BlurWeights[2] = 0.0877;   BlurWeights[3] = 0.1120;   BlurWeights[4] = 0.1297;   BlurWeights[5] = 0.1362;   BlurWeights[6] = 0.1297;   BlurWeights[7] = 0.1120;   BlurWeights[8] = 0.0877;   BlurWeights[9] = 0.0623;   BlurWeights[10] = 0.0402;   vec4 sum = texture2D(tex, gl_TexCoord[0].xy) * BlurWeights[0];#ifdef PASS_0   for (int i = 1; i < 11; i++) {      sum += texture2D(tex, vec2(clamp(gl_TexCoord[0].x - float(i) * (blurSize/2), 0.0, 1.0), gl_TexCoord[0].y)) * BlurWeights;      sum += texture2D(tex, vec2(clamp(gl_TexCoord[0].x + float(i) * (blurSize/2), 0.0, 1.0), gl_TexCoord[0].y)) * BlurWeights;   }#endif#ifdef PASS_1   for (int i = 1; i < 11; i++) {      sum += texture2D(tex, vec2(gl_TexCoord[0].x, clamp(gl_TexCoord[0].y - float(i) * (blurSize/2), 0.0, 1.0))) * BlurWeights;      sum += texture2D(tex, vec2(gl_TexCoord[0].x, clamp(gl_TexCoord[0].y + float(i) * (blurSize/2), 0.0, 1.0))) * BlurWeights;   }#endif   gl_FragColor = sum;}

With the HUD code since it does this it does not work (As I figured out when I had the initial problem of the Port HUD not displaying with Port MVPs), which forces me to waste time hitting Enter and Tab over and over until the code is as it should be. My question is since apparently copy / paste into Notepad leads to botched code, what it is that I'm apparently missing in the process.
Title: Re: Copy / paste codes
Post by: Jeff Vader on July 01, 2011, 07:20:30 am
Use Notepad++ (http://notepad-plus-plus.org/). Regularass Notepad has severe issues with newlines. And sucks in other regards, too.
Title: Re: Copy / paste codes
Post by: Commander Zane on July 01, 2011, 07:39:39 am
Just gave it a try, doesn't seem like the data is pasted any differently. Unless there needs to be specific settings applied to the program.
Title: Re: Copy / paste codes
Post by: Jeff Vader on July 01, 2011, 08:11:09 am
Uh... weird. Step-by-step, how exactly are you copying and pasting the codes? And what browser are you using? I just tested by using the latest Notepad++ and the latest Chrome/the latest Firefox/Opera 11.10, and copying the codes both by selecting them with the mouse and selecting them with the "Select" button, then copying and pasting into Notepad++. It worked. Every time. As far as I know, there shouldn't be any setting that you need to consider for the process to work.
Title: Re: Copy / paste codes
Post by: Commander Zane on July 01, 2011, 08:17:45 am
I'm also using the newest Notepad++, just downloaded it an hour ago. I'm on IE9, I hit "Select" on the information with the code tag, select Copy, then Paste.
It turns out the problem is IE, the code is pasted properly on FF5, so this problem is solved. :D

Edit: Didn't know just typing one part of a post command automatically made a second half. :nervous:
Title: Re: Copy / paste codes
Post by: Macfie on July 01, 2011, 01:01:46 pm
Noticed the same problem with notepad.  So I used wordpad instead and it works.