I swear the highlights keep getting better. I really like Robbers line drawing terrain renderer from the last thread.
Also I dig the titles.
And first!1!!1
Facepunch is a talented bunch. I like the perlin noise terrain generator for minecraft a lot.
My ASCII engine is slowly working its way back, I'll soon get some screenshots actually worthwhile.
Awesome OP rank, I guess it doesn't matter if we argue the hell out of what's left of the old thread now.. :hist101:
best thing to happen to the programming forum
Couldn't agree more. I think it has made people a lot friendlier and helpful aswell. It use to be beginner threads with tiny mistakes and 10 page flamewars, which seems to have toned down.
git-bisect
A++ OP would read again several times
@s0ul0r if you're still here
Nop, using a system that uses the distance of the border from the middle of the shape (at every angle) to determine if they're inside one frame then outside the next, or touching the border in the current frame.s0ul0r posted:
Love the OP :buddy:
And I am the top highlight :smug:
Fresh new WAYWO threads always motivate me to get back to programming.
But then I remember it's exam season :(
Fixed. :smug:
I give you a gold star for that OP.
![]()
Real stylish OP, I like it.
Damn, the lack of mediatags for images destroyed my highlight :(
What on earth are you talking about? You start debugging the current codebase that's crashing, fix it and commit. Optionally, if you're working in a team and might need to work on some unrelated portion of the code, you might want to make a branch to work on so that you can switch to the current master with no problem.nullsquared posted:
Regarding the revision numbers vs. hashes, it's not that much of an issue - the distributed nature of Git comes with the limitation that there is no possibility to have a linear revision number. However, you don't need to enter the full hashes, but only small portions of them to find the revision you want.
Thanks for highlighting two of my posts :buddy:
Could you please replace
http://www.facepunch.com/showpost.ph...&postcount=789
with this post
http://www.facepunch.com/showpost.ph...postcount=1464
It has a screenshot of the newest version and a download link.
Edit: And you broke the second image in the post with the rotating heightmap.
Awesome OP, and I reaklly didn't think I'd make it.
Edited:
Nullsquared, may I ask you how you generate the APNGs? By hand? Or do you have a little tool that puts pictures together? (That would be handy for me)
Wrote a blog on my experiences with Beanstalk if anyone's interested:
http://www.garry.tv/?p=1498
The thing which shows the differences between files is really cool.
I really don't really see what's the big deal about a prettier version of diff along with easier integration with twitter, but cool for those who don't know how to setup their own server I suppose.
You could open the recorded video file in VirtualDub and export it as animated GIF and convert that to an APNG.
You would lose the huge benefit of quality which comes with apngs...
Can we have a five posts per flamewar rule? It would allow us to indulge our opinions, but would clamp down on some of the endless streams of "no u"?
All I can work with is pictures, really. I'm plotting in gnuplot as most stuff I do is more numerical than graphical and Fortran doesn't have any fancy graphics libraries.
What is a good way to turn OpenGL context width/height and some pixel offsets + pixel width/height into a quad, assuming I don't want anything off the screen due to 2D rendering?
So far, I have this non-working piece of cra
Code:for(unsigned int i = 0; i < artList.size(); i++) { SCursesArtOpenGL* artGL = artList[i]; // Need to do some funky maths to make is so the coordinates start // at top-left, not the center and to make it so 1 unit is one pixel. float x = artGL->startPosX / screenWidth; float y = artGL->startPosY / screenHeight; float w = artGL->width / screenWidth; float h = artGL->height / screenHeight; glBindTexture(GL_TEXTURE_2D, artGL->texture); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex3f(x, y, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(x + w, y, 0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(x + w, y + h, 0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(x, y + h, 0.0f); glEnd(); }Code:struct SCursesArtOpenGL { ICursesArt* art; GLuint texture; int startPosX; int startPosY; int width; int height; };The x,y,w,h floats all turn to 0.Code:videoLayer->attachArt(CRectI(CVector2DI(32, 32), CVector2DI(128, 256)), art);
Aww yeah. I made it into the OP Summary...Twice!
My life feels complete now.
Ok this time I am doing the "Drunken Ant".
Basically, you set a pixel in the middle of a grid.
Then you randomly generate a coordinate in the outer rim of said grid, the coordinates has to have a certain distance to the middle. Then you randomly let the coordinates "wander" around the grid. When they get to far away, you get a new pairir of coordinates.
When they reach any point in the grid where ne of the neigbours already IS a set pixel, they stay there and set the current pixel.
Here is the result:
The code is Fortran, sorry.
Code:program root integer,allocatable,dimension(:,:)::u real,dimension(1,2)::v,w integer::i,j,k,l,m,success,find,outer_border,inner_border,seize,middle,hit,direct1,direct2 real(8)::rand1,rand2,rand3 seize=1000 outer_border=seize/3 inner_border=seize/6 middle=seize/2 allocate(u(seize,seize)) u=0 !Setting the middle coordinate to 1, the rest is zero u(middle,middle)=1 success=0 call random_seed !saving the coordinates of the middle for later w(1,1)=middle w(1,2)=middle do while(success<5000) call random_number(rand1) call random_number(rand2) rand1=rand1*seize rand2=rand2*seize v(1,1)=rand1 v(1,2)=rand2 m=Abs(Sqrt( (v(1,1)-w(1,1))**2+(v(1,2)-w(1,2))**2)) if(m>inner_border.and.m<outer_border)then hit=0 !Propagate do while(hit==0) call random_number(rand1) call random_number(rand2) if(rand1<0.5) then direct1=1 else direct1=-1 endif if(rand2<0.5) then direct2=1 else direct2=-1 endif v(1,1)=v(1,1)+direct1 v(1,2)=v(1,2)+direct2 m=Abs(Sqrt( (v(1,1)-w(1,1))**2+(v(1,2)-w(1,2))**2)) if(m<outer_border)then if(u(v(1,1)+1,v(1,2))==1 .or. u(v(1,1)-1,v(1,2)) .or. u(v(1,1),v(1,2)+1)==1 & .or.u(v(1,1),v(1,2)-1)==1) then u(v(1,1),v(1,2))=1 hit=1 success=success+1 write(*,*)success endif else exit endif enddo endif enddo !This just writes the foield down so I can plot it later with gnuplot do i=1,seize do j=1,seize if (u(i,j)==1) then write(8,*)i,j endif enddo enddo end program root
I'm a little confused as to what you are asking. Are you trying to draw in opengl with units of pixel size? And the origin in one of the corners of the screen or something?
If so, then it's time to work with matrices.
Code://Get the current viewport dimensions int v_dim [4]; glGetIntegerv(GL_VIEWPORT, v_dim); //The last 2 values in v_dim hold the viewport width and height respectively //Set up the projection matrix so that a unit in world coordinates corresponds to a pixel's dimension glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0,v_dim[3], 0,v_dim[4], -1, 1); //Origin in the lower-left corner of the screen glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //Draw the scene here
I want to set it so 1 unit in OpenGL is a pixel and it starts at top-let. Sorry, I'm not good at maths.
Ok, fine. My code that I provides does that, but you need to change some of the arguments for glOrtho. Look up that function in the documentation.
You can also use glVertex2f when doing 2d stuff in opengl. It is exactly the same as glVertex3f(x, y, 0), but it involves less traffic over the bus, and smaller memory footprint in calllists.
As if I would leave this forum over night :smugdog:
I just read up on regular expressions and I think I'm in love, they are awesome. For example rather than using some complicated if statements to parse a phone number, now I can just do "^\D*(\d{5})\D*(\d{6})$" and it will get the area code and number for me.
But what about quads?
I find them god awefull to understand.
True but don't overuse regex if you don't have to, if you know where the phone number starts it's most likely quicker to substring the next 5 characters.
What about them? Setting up the projection matrix should make everything happy for your dimensions, so you can just treat openGL coordinates as the size of pixels.
Code:float x = artGL->startposX; float y = artGL->startposY; float w = artGL->width; float h = artGL->height; glBindTexture(GL_TEXTURE_2D, artGL->texture); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex2f(x, y); glTexCoord2f(1.0f, 0.0f); glVertex2f(x + w, y); glTexCoord2f(1.0f, 1.0f); glVertex2f(x + w, y + h); glTexCoord2f(0.0f, 1.0f); glVertex2f(x, y + h); glEnd();
I agree, but what if you don't know? I think thats where it becomes more useful, for user input ect.
I want to release the library I was gradually writing over the last months open source, but I can't decide on a license. I didn't think that it would be that hard. I just want a license where they can do whatever they want except make money and they have to give credit.
All the licenses I found either allow making money or they have to open source their changes/their program too.
Yes yes your example was fine. I would argue that "some 12345 numbers 123456" isn't a valid phone number though ha.