Thread: Texture mapping?

  1. #1
    Registered User
    Join Date
    Feb 2004
    Posts
    5

    Texture mapping?

    How do you map a texture to a quadrilateral when the shape is not square or rectangular because I am doing a 3D game
    Thanks

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    You simply give each vertex a set of texture coordinates and then that will be used to map the texture onto your object.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Registered User
    Join Date
    Feb 2004
    Posts
    5
    Can you give me an example in code

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    All right, I thought this might happen. What API are you using? Then maybe I can help you a bit more.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  5. #5
    Registered User
    Join Date
    Feb 2004
    Posts
    5

    API

    My API is Dev C++ if that helps

  6. #6
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    no, what are you using to render the texture mapped quad? Direct3D/DirectDraw, OpenGL, software rasterizer?

  7. #7
    Registered User
    Join Date
    Feb 2004
    Posts
    5
    Open GL

  8. #8
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Go take a look at www.gametutorials.com under there OpenGL section. They have a tutorial for texture mapping a quad, and then it shouldn't be hard for you to apply the concept to 3D models.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. d3d9 c++ texture wrapper... again...
    By yaya in forum Game Programming
    Replies: 0
    Last Post: 04-01-2009, 01:08 PM
  2. D3d Texture Wrapper == ARRRGGGGHHH
    By yaya in forum Game Programming
    Replies: 1
    Last Post: 03-25-2009, 06:41 PM
  3. OpenGL texture mapping with texCoordArray
    By nempo in forum Game Programming
    Replies: 1
    Last Post: 08-24-2008, 04:00 AM
  4. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 10:50 AM
  5. Texture mapping in OpenGL
    By Mithoric in forum Game Programming
    Replies: 3
    Last Post: 09-12-2003, 09:03 AM