question about clipping

This is a discussion on question about clipping within the Game Programming forums, part of the General Programming Boards category; When you say something like "It can be clipped to the top of the screen" what does this mean? Lets ...

  1. #1
    Banned
    Join Date
    Jan 2003
    Posts
    1,708

    question about clipping

    When you say something like "It can be clipped to the top of the screen" what does this mean? Lets just say we're talking about ohh a windows bitmap file or something.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Well lets assume your screen is 800x600 ok? You have a bitmap thats 100x100 ( all in pixels ). Lets say you start your bitmap off at 600 or something near the bottom of the screen. Then every frame when you call Blt to draw it to the window, you subtract a pixel from the top. Well this bitmap will be moving upwards right? What happens when the top of the bitmap is -1? Thats out of bounds and Blt will fail. This will make the bitmap disappear at the top of the screen. You clip so that it gives the illusion of sliding completely off of the window. Basically, you see how much past the top it is ( in this case 1 pixel ) then you just add a pixel to the bitmap's top so that it doesn't show the top line of the bmp and it'll give the illusion of smoothly going off of the screen. Thats one example of 2D clipping.

  3. #3
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    Just a couple of questions: is it true that Y is actually downwards in the windows screen coordinates? I remember doing a console application a while ago using setconsolepos functions (or something) and increasing the y made the characters move DOWN. Or maybe I was standing on my head and forgot to realize it

  4. #4
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    Posts
    704

    Standerdized

    The standardized cartesian(at least i think its cartesian, my math is rusty) co-ordinate system is adapted to the screen as:

    0-------------------------------------------+X
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    +
    Y

    ( Zero being top left corner )
    c++->visualc++->directx->opengl->c++;
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

  5. #5
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    don't forget the Z axis.....and yes you are correct about the name of the coord system.

  6. #6
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    Posts
    704
    Then I do believe it is:
    0--------------------------------------------------+X
    |\
    |..\
    |....\
    |......\
    |........\
    |.........+
    |...........Z( Z: buffer [d3d]) ?
    |
    |
    |
    |
    |
    |
    |
    +
    y

    I think its the depth buffer your talking about, either way, z is positive INTO the screen.
    c++->visualc++->directx->opengl->c++;
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

  7. #7
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    yes i am referring to the depth buffer.

  8. #8
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Originally posted by dbgt goten
    either way, z is positive INTO the screen.
    Um, actually it depends on if you setup your application to use a Left-Handed or Right-Handed coordinate system. Its completely arbitrary and up to personal preference. I always use Left-Handed myself because that is the Direct3D default. The OpenGL default is Right-Handed if I remember correctly. The difference in coordinate systems is which way the positive Z-Axis points.

  9. #9
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    By default in opengl the Z axis is positive into the screen.

  10. #10
    Registered User
    Join Date
    Dec 2002
    Posts
    29
    Ive always read that OpenGL uses a right handed system...which would be positive out of the screen.

  11. #11
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    i typo'd, its positive out.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  2. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 08:22 PM
  3. Question about linked lists.
    By cheeisme123 in forum C++ Programming
    Replies: 6
    Last Post: 02-25-2003, 12:36 PM
  4. 3D clipping & gluPerspective()
    By Perspective in forum Game Programming
    Replies: 8
    Last Post: 02-22-2003, 09:40 AM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 12:47 AM

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