Basic movement

This is a discussion on Basic movement within the Game Programming forums, part of the General Programming Boards category; OK, this is going to sound really dumb, so feel free to slap me. If I a quad, textured (and ...

  1. #1
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709

    Basic movement

    OK, this is going to sound really dumb, so feel free to slap me.

    If I a quad, textured (and it's a sprite) how do I move it independant of anything else in the scene? So far I've drawn a big red box and a little green box next to it, and if I use glTranslatef the whole scene moves (red and green box).

    Could someone point me in the right direction?
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,208
    if you want the green box to move you need to translate x, y and z units on each of the axis before you draw the box. after you have drawn the box you need to translate with -x, -y and -z to reset the coordinatesystem to the origin and then draw the red box.
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  3. #3
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Thanks man that worked fine
    One other question though, I drew the green box first then the red box, but the red box appears over the green one. I'm using glOrtho not gluPerspective.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  4. #4
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    Maybe that has something to do with the color? It goes RGB not GRB? Course maybe I'm just making things up
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  5. #5
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    I haven't got a clue, but it shouldn't matter, objects won't be overlapping each other when I get that damn collision detection in there!
    (Which, by the way, I am having a lot of trouble with )
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  6. #6
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    The z buffer is doing that. If you are doing 2D either set all vertices Z component to 1.0f and/or turn z buffer off.

  7. #7
    Registered User
    Join Date
    Aug 2003
    Posts
    1,208
    doesnt it have to do with rendering order too?? If you want object A to be visible above object B object A has to be rendered after object B or am i way out there??
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  8. #8
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Quote Originally Posted by Bubba
    The z buffer is doing that. If you are doing 2D either set all vertices Z component to 1.0f and/or turn z buffer off.
    OK I'll do that now.
    Another question: Bubba, you've used OpenGL and DirectX right? Could you tell me a little bit about what you like / dislike about each one if you have time?
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  9. #9
    ---
    Join Date
    May 2004
    Posts
    1,379
    I really don't Bubba has used OpenGL before. It's best to listen to what he has to say about DX and then find some one else's opinion on OpenGL.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [ANN] New script engine (Basic sintax)
    By MKTMK in forum C++ Programming
    Replies: 1
    Last Post: 11-01-2005, 09:28 AM
  2. what are your thoughts on visual basic?
    By orion- in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 09-22-2005, 04:28 AM
  3. Is there a basic movement example?
    By GameGenie in forum Game Programming
    Replies: 3
    Last Post: 08-10-2005, 02:14 PM
  4. visual basic vs C or C++
    By FOOTOO in forum Windows Programming
    Replies: 5
    Last Post: 02-06-2005, 07:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21