1. Post #1
    Gold Member
    r4nk_'s Avatar
    April 2005
    2,023 Posts













    I've been toying around with Ogre3D recently, I think things are turning out

    quite nice at the moment.

    Here's some freaky reptile men that I modelled hanging around the backlots of a city :P

    The compass you see is just a little HUD test thingy, it basically always points north. In first person

    I have it so that your head can be moved independently from the body, the green footsteps show where

    your body is facing.

    Third person camera:


    Normal mapping:


    First person view (I can see my toes!):


    Pre-lit buildings:


    Updated my render code to have a nice little cone of view depending on where

    the player is (the moving box in this case). I had a small problem arise that I need to fix as well.




    Man, so little progress so many annoying/boring stuff to make >_<

    finished partially animation blending



    Edited:

    Before you ask, yes, he can shoot with his sword.


    No update today but I am getting closer. Added snow map type and other map

    types. I have done a lot of back end improvements which has improved load times. Lot of small fixes like

    the bear attack animation. yep still working on it...


    content:



    We are adding multiple views

    Progress is pretty slow as we don't have much motivation :frown:


    Another important milestone was reached today:
    Motionblur post-process effects!

    The method isn't as accurate as multiple interpolated passes, but the post-process effect is a lot

    cheaper and pretty convincing. The clip-space velocity of every point in the scene is recorded in a

    frame buffer and that is referenced by the post-process filter to smear samples from the color buffer

    around.

    Edited:


    glTexImage2D only works with the currently bound texture object. The framebuffer is a different thing,

    but you can have texture objects attached to the framebuffer via attachment points. The entire reason

    you use a framebuffer object is so you can do render-to-texture and not have to upload the image from

    system memory to the graphics card. With an FBO, you render the scene directly into one or more

    textures. That's how I do my post-process effects.



    No update yet. Here is a screen shot of the desert map. It is showing a lot of

    new things. Like being able to select multiple units.(mouse is not shown D:)




    It's not my fault, some alien dude stole my spacecamera.


    That area is supposed to be really big but that texture makes it feel smaller than my backyard so I'm

    gonna make it look better and add some more textures.
    The terrain is pretty smooth so I'm going to play around a little with the generation to get a more

    earthlike feeling. (Mountains, valleys, etc)

    There's also some strange artifacts from the atmosphere calculations I have to fix.



    Working on the lighting system. Got Point Light's doing their thing in the

    editor..



    Edited:

    And that light is in the table so it's kinda broke haha - only screenshot I'd took





    Edited:

    You draw the "destruction" with the Mouse at the moment, as there are no weapons.

    Edited:

    Also: New Map I stole the cheese from a Worms World Party screenshot and tiled it.




    The Arcane, Stealth & Power alpha version is now released! I've been working on this game a lot and

    you've probably seen it in previous "What are you working on" threads so this should be a nice surprise

    present.

    http://www.namelezz.net/xmaspresent2009

    Been working on something for about 30 minutes before abandoning it: ASCII Hero


    Basically reads a track from a txt and makes it scroll to the left, you have to hit the O's by pressing

    the right frets and strumming. Like Guitar Hero.
    Those lower case o's (You can barely recognize them) are hammer-ons, and they actually work.
    If you miss a note, it also keeps going, while they disappear if you hit them.

    I also programmed beatlines and flexible design in; but I couldn't find something easily recognizable.



    Worked surprisingly well for ASCII.

    Edited:
    Here's a gif! It fucked up the timing a little.



    I've been implementing an idea I had for a little game in XNA.



    The player has to move into the middle of the 'structures' to remove them one by one, whilst each shape

    rotates and moves and stuff. It's hard to explain without a video but I can't really make one (on my

    netbook (which incidentally is all I've used to develop it so far)) so I'll just upload the game so

    far instead.





    Keys:
    -F to toggle fullscreen (might be buggy with shape positions)
    -Escape to quit
    -C to clean (remove) dead structures
    -P to skip level if stuff breaks (there are ~17 levels in this, you'll know when it's done because they

    all turn red)
    -D to toggle debug

    Some points and ideas:
    -There are a few bugs and stuff, no sound yet.
    -I'll probably make levels timed
    -It wasn't originally meant to be only circles in structures, I might add more shapes but I think it

    works quite well at the moment/is easy to implement.
    -I tried to make the camera zoom in on the player when he/she gets inside a structure, but that got all

    messy and kept breaking.
    -I might make bosses (massive structures) and some kind of vague combat system, where the player can get

    rid of certain shapes on certain structures by shooting them.
    -I'll add bonuses like slower shape movement etc.


    Had a play with terrain rendering today. Well not so much terrain as

    displacements, but I'm working towards the possibility of something more.. better.

    Got it rendering randomized, texturing and normals are fucked.



    Fixed normals, binormal, tangent..


    A basic version of my sonar battle game is playable now. You can shoot pings to find your opponent, rockets to kill him and use the noise bubble to see your surroundings and possibly your opponent too. It's possible to loose or win.
    It's only playable when you have a friend to play with, it should work over internet, but I didn't test that yet. You can play alone when you start two instances of the game and use one as the server and one as the client.


    Screenshot:


    Original idea:
    http://www.squidi.net/three/entry.php?id=85

    Download:
    http://dl.dropbox.com/u/1106779/SonarBattle_Release.zip


    Just about finished my simple puzzle game. Altered the rules and graphics a bit

    along the way.



    How to Play:

    * Like minesweeper, try and work out where the mines are in the grid without clicking on them.

    * When you click on a tile, it will give you two pieces of information:

    - The colour of the tile tells you where the nearest mine is. A green tile is touching a mine, and a

    blue one is 2 tiles away from a mine.

    - The number(s) on the tile tell you how many mines are near it. The green number tells you how many

    mines are in the neighbouring 6 tiles, and the blue number tells you how many mines are two tiles away

    from it.

    - If you mouse over a tile, you will see two rings of tiles lit up around it, blue and green. This helps

    you see which tiles are next to the one you moused over, and which are two tiles away.

    * If you want to remember where you worked out a mine is, right click on it to flag it. While flagged,

    you can't accidentally blow it up.

    * If you find that you mistakenly flagged a tile, just right click on it again to de-flag it.

    * If you click on a mine, you lose 50 points.

    * The game ends when the mines are all located.

    Download
    http://www.robertandsherman.co.uk/do...puzzle-0-1.zip - ( 1.22 mb )





    Chromified version of the FP ticker, has a basic filtering scheme; it only shows threads you've read and

    posts to your own threads, I'm adding the ability to bulk monitor certain forum sections right now.

    Too lazy to add eyecandy for the moment, but we'll see about that later.

    On with the content script! :hist101:



    So.. ok,

    which one looks best then =/
    Don't care if unnatural or not, it's all for the looks





    ---
    Vote :

    Agree for the First one
    Disagree for the Second one



    Just made some particle stuff to play around with (yes, I was VERY bored):

    http://ul.to/j8x6bv

    XNA 3.0 required.



    K now I have great performance, and it's pretty fun to play with:


    http://ul.to/kyyewr



    Cool. Come back and show me when you finish.

    Edited:

    Little zombie chase with portals: (view in Firefox or anything else that supports APNGs)

    Yes, it looks very ugly right now. Obviously this is only a path finding test so far, nothing too

    interesting game-wise, yet.



    Well, here it is :D

    (view in Firefox or anything else that supports APNGs)

    What happens there is that the zombie "explores" the map and therefore does not know the perfect path

    immediately. It tends to hug the wall because its vision radius is 1 right now - I plan on making it 3

    maybe 4, that way it won't hug the wall the entire time. You can also see that the zombie will notice a

    portal and use it effectively.


    Finished off the terrain system today (As much as I need to right now). Wrapped it

    up so you can define the terrain via an XML file..






    I made this as an experiment. It takes any image (although only heightmaps don't look like shit) and

    generates the frames for this animation. It is not 3D. It's all rendered with Java's 2D API.


    Been a while since I posted anything about Arcane, Stealth & Power. I loved

    your input when I released the Christmas-themed Wizard Alpha version of AS&P so here's screenshots about

    what's to come.





    Full pedestrian randomization and I can stuff 600 pedestrians on a single layout without a hitch. They

    don't have varied clothes yet but they do have varied headwear.

    There's also guards who will escort you out of the city if they see you (they think you're an assassin

    because I've told them to do so). There's one in the second screencap with the exclamation point over

    them (Metal Gear - style)!

    I'm simulating a 2D Particle-Spin grid near the critical temperature.
    I'm on linux and there is no fancy animation to be shown as I can't be arsed to do a .gif but here you

    can see the spinfield below critical temperature:


    Those pockets get smaller the further the simulation goes which is just right.

    Edited:

    Magnetization:



    Green is how the analytic formula behaves, red is the simulated one.

    Sure it's not very accurate but it's good enough.



    made some graphical 'improvements'



    Edited:

    lol



    (not planning on keeping the yellow ones)

    new thread soon :D














    Version 6

    Version 5

    Version 4

    Version 3

    Version 2

    Version 1




    So...WHAT ARE YOU WORKING ON?
    Reply With Quote Edit / Delete Australia Show Events Friendly Friendly x 14Artistic Artistic x 5Useful Useful x 2 (list)

  2. Post #2
    Gold Member
    Jallen's Avatar
    December 2007
    7,584 Posts
    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
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 5Optimistic Optimistic x 1Friendly Friendly x 1Funny Funny x 1 (list)

  3. Post #3
    Gold Member
    r4nk_'s Avatar
    April 2005
    2,023 Posts
    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.
    Reply With Quote Edit / Delete Australia Show Events Agree Agree x 5Friendly Friendly x 1 (list)

  4. Post #4
    Eleventeen's Avatar
    August 2008
    1,261 Posts
    My ASCII engine is slowly working its way back, I'll soon get some screenshots actually worthwhile.
    Reply With Quote Edit / Delete Australia Show Events Dumb Dumb x 4Funny Funny x 1 (list)

  5. Post #5
    voodooattack's Avatar
    October 2009
    1,994 Posts
    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:
    Reply With Quote Edit / Delete Egypt Show Events Funny Funny x 3 (list)

  6. Post #6
    Gold Member
    raccoon12's Avatar
    November 2008
    3,175 Posts
    best thing to happen to the programming forum
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 10 (list)

  7. Post #7
    Gold Member
    r4nk_'s Avatar
    April 2005
    2,023 Posts
    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.
    Reply With Quote Edit / Delete Australia Show Events Informative Informative x 1 (list)

  8. Post #8
    tjl
    tjl's Avatar
    February 2006
    327 Posts
    And if a specific version of the feature you wrote crashes? How do you debug that?
    git-bisect
    Reply With Quote Edit / Delete United States Show Events Dumb Dumb x 3Informative Informative x 1Agree Agree x 1 (list)

  9. Post #9
    NovembrDobby's Avatar
    April 2007
    1,157 Posts
    A++ OP would read again several times


    @s0ul0r if you're still here

    s0ul0r posted:
    Are you using per-pixel collision now?
    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.
    Reply With Quote Edit / Delete United Kingdom Show Events Funny Funny x 1 (list)

  10. Post #10
    COMEDY POLICE
    Xerios3's Avatar
    January 2009
    1,773 Posts
    Love the OP :buddy:
    Reply With Quote Edit / Delete Belgium Show Events Agree Agree x 7Optimistic Optimistic x 1 (list)

  11. Post #11
    I survived Camp FP 2010
    Mattz333's Avatar
    June 2007
    1,662 Posts
    Love the OP :buddy:
    And I am the top highlight :smug:
    Reply With Quote Edit / Delete United States Show Events Friendly Friendly x 2 (list)

  12. Post #12
    Gold Member
    gilly_54's Avatar
    June 2006
    260 Posts
    Fresh new WAYWO threads always motivate me to get back to programming.
    But then I remember it's exam season :(
    Reply With Quote Edit / Delete Kuwait Show Events

  13. Post #13
    Gold Member
    r4nk_'s Avatar
    April 2005
    2,023 Posts
    And I am the top highlight :smug:
    Fixed. :smug:
    Reply With Quote Edit / Delete Australia Show Events Funny Funny x 12Informative Informative x 1 (list)

  14. Post #14
    Paid for a title.
    Maurice's Avatar
    June 2005
    6,175 Posts
    I give you a gold star for that OP.
    Reply With Quote Edit / Delete Germany Show Events Friendly Friendly x 4Agree Agree x 3Optimistic Optimistic x 2 (list)

  15. Post #15
    Gold Member
    dezek's Avatar
    November 2005
    195 Posts
    Real stylish OP, I like it.

    Damn, the lack of mediatags for images destroyed my highlight :(
    Reply With Quote Edit / Delete Sweden Show Events Friendly Friendly x 2 (list)

  16. Post #16

    June 2009
    119 Posts
    nullsquared posted:
    And if a specific version of the feature you wrote crashes? How do you debug that?
    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.

    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.
    Reply With Quote Edit / Delete Finland Show Events Agree Agree x 2 (list)

  17. Post #17
    Gold Member
    Robber's Avatar
    January 2006
    6,206 Posts
    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.
    Reply With Quote Edit / Delete Austria Show Events

  18. Post #18
    Voted WORST Gold Member 2012
    Killuah's Avatar
    August 2005
    15,751 Posts
    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)
    Reply With Quote Edit / Delete Germany Show Events

  19. Post #19
    garry's Avatar
    September 2001
    12,435 Posts
    Wrote a blog on my experiences with Beanstalk if anyone's interested:

    http://www.garry.tv/?p=1498
    Reply With Quote Edit / Delete Show Events Informative Informative x 2Funny Funny x 1 (list)

  20. Post #20
    Gold Member
    Jallen's Avatar
    December 2007
    7,584 Posts
    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.
    Reply With Quote Edit / Delete United States Show Events

  21. Post #21
    Gold Member
    gparent's Avatar
    January 2005
    3,949 Posts
    Wrote a blog on my experiences with Beanstalk if anyone's interested:

    http://www.garry.tv/?p=1498
    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.
    Reply With Quote Edit / Delete Show Events Dumb Dumb x 4Agree Agree x 3 (list)

  22. Post #22
    Gold Member
    Robber's Avatar
    January 2006
    6,206 Posts
    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)
    You could open the recorded video file in VirtualDub and export it as animated GIF and convert that to an APNG.
    Reply With Quote Edit / Delete Austria Show Events Funny Funny x 2Dumb Dumb x 1 (list)

  23. Post #23
    Gold Member
    Jallen's Avatar
    December 2007
    7,584 Posts
    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...
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 3Dumb Dumb x 1 (list)

  24. Post #24
    Gold Member
    TheBoff's Avatar
    September 2006
    660 Posts
    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"?
    Reply With Quote Edit / Delete Russian Federation Show Events Dumb Dumb x 6 (list)

  25. Post #25
    Voted WORST Gold Member 2012
    Killuah's Avatar
    August 2005
    15,751 Posts
    You could open the recorded video file in VirtualDub and export it as animated GIF and convert that to an APNG.
    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.
    Reply With Quote Edit / Delete Germany Show Events

  26. Post #26
    Eleventeen's Avatar
    August 2008
    1,261 Posts
    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;
    	};
    Code:
    videoLayer->attachArt(CRectI(CVector2DI(32, 32), CVector2DI(128, 256)), art);
    The x,y,w,h floats all turn to 0.
    Reply With Quote Edit / Delete Australia Show Events

  27. Post #27
    Neigh
    CarlBooth's Avatar
    June 2007
    28,550 Posts
    Aww yeah. I made it into the OP Summary...Twice!

    My life feels complete now.
    Reply With Quote Edit / Delete United Kingdom Show Events Informative Informative x 1Disagree Disagree x 1 (list)

  28. Post #28
    Voted WORST Gold Member 2012
    Killuah's Avatar
    August 2005
    15,751 Posts
    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
    Reply With Quote Edit / Delete Germany Show Events Artistic Artistic x 1 (list)

  29. Post #29
    Gold Member
    Cathbadh's Avatar
    March 2006
    1,071 Posts
    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;
        };
    Code:
    videoLayer->attachArt(CRectI(CVector2DI(32, 32), CVector2DI(128, 256)), art);
    The x,y,w,h floats all turn to 0.
    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
    Reply With Quote Edit / Delete United States Show Events

  30. Post #30
    Eleventeen's Avatar
    August 2008
    1,261 Posts
    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.
    Reply With Quote Edit / Delete Australia Show Events

  31. Post #31
    Gold Member
    Cathbadh's Avatar
    March 2006
    1,071 Posts
    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.
    Reply With Quote Edit / Delete United States Show Events

  32. Post #32
    Gold Member
    s0ul0r's Avatar
    September 2006
    993 Posts
    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.
    As if I would leave this forum over night :smugdog:
    Reply With Quote Edit / Delete Germany Show Events Agree Agree x 2 (list)

  33. Post #33
    Gold Member
    iPope's Avatar
    October 2008
    1,774 Posts
    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.
    Reply With Quote Edit / Delete United Kingdom Show Events Late Late x 2 (list)

  34. Post #34
    Eleventeen's Avatar
    August 2008
    1,261 Posts
    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.
    But what about quads?
    Reply With Quote Edit / Delete Australia Show Events

  35. Post #35
    quincy18's Avatar
    September 2007
    1,018 Posts
    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.
    I find them god awefull to understand.
    Reply With Quote Edit / Delete Netherlands Show Events

  36. Post #36
    Gold Member
    Vampired's Avatar
    February 2005
    374 Posts
    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.
    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.
    Reply With Quote Edit / Delete Show Events Agree Agree x 2 (list)

  37. Post #37
    Gold Member
    Cathbadh's Avatar
    March 2006
    1,071 Posts
    But what about quads?
    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();
    Reply With Quote Edit / Delete United States Show Events

  38. Post #38
    Gold Member
    iPope's Avatar
    October 2008
    1,774 Posts
    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.
    I agree, but what if you don't know? I think thats where it becomes more useful, for user input ect.
    Reply With Quote Edit / Delete United Kingdom Show Events Bad Spelling Bad Spelling x 3 (list)

  39. Post #39
    Gold Member
    Robber's Avatar
    January 2006
    6,206 Posts
    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.
    Reply With Quote Edit / Delete Austria Show Events

  40. Post #40
    Gold Member
    Vampired's Avatar
    February 2005
    374 Posts
    I agree, but what if you don't know? I think thats where it becomes more useful, for user input ect.
    Yes yes your example was fine. I would argue that "some 12345 numbers 123456" isn't a valid phone number though ha.
    Reply With Quote Edit / Delete Show Events