Results 1 to 7 of 7

Thread: Mode 7

  1. #1

    Default Mode 7

    I'm working in a small team to develop a 2D racing game like F-Zero or Mario Kart. I was wondering if ClanLib supported the use of "Mode 7" texture mapping by default?
    If there are any other (better?) techniques for making a "2.5D" racing game any suggestions would be greatly appreciated.

    Cheers,


  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Yes, set the projection matrix

    For example, in the pacman example. Switch to the clanGL target (or clanGL1)
    In world.cpp, just after gc.clear()
    Code:
    gc.set_map_mode(cl_user_projection);
    CL_Mat4f perp = CL_Mat4f::perspective(67.0f, 1.0f, 0.1f, 2000.0f);
    gc.set_projection(perp);
    
    gc.set_modelview(CL_Mat4f::identity());
    gc.mult_translate(0, 0, -800);
    gc.mult_scale(1.0f, -1.0f, 1.0f);
    gc.mult_translate(-gc.get_width()/2, -gc.get_height()/2);
    gc.mult_rotate(CL_Angle(30, cl_degrees), 1.0f, 0.0f, 0.0f);
    Note, the clanSWRender target currently does not support this (but may change in the future)


  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    I just had to post this image that someone else created using ClanLib
    Name:  pacman3d-7.png
Views: 24
Size:  1.37 MB

  4. #4

    Default

    Awesome thanks a lot rombust .

  5. #5

    Default

    The code you gave gives exactly the effect I wanted.
    I issue I'm having is moving the projection modificaytion to just the background because it applies to the entire Graphics_Context. Can I have two graphics contexts, one of which draws the background in perspective and another that draws sprites sperately?

    Chz,


  6. #6
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    You cannot have 2 seperate graphic contexts worker on the same window.

    Instead simply change the perspective mode to whatever you want

    For example, in addition to the pacman patch above,

    After: map->draw(center_x, center_y, gc);
    Add:

    Code:
    gc.set_map_mode(cl_map_2d_upper_left);
    gc.set_modelview(CL_Mat4f::identity());
    Or whatever mode you require


  7. #7

    Default

    I thought that's what I should be able to do but I was getting weird results when I tried.
    I've moved the graphics context perspective changing to the map.cpp draw method now. Ideally I want the sprites to be scaled by the perspective but just standing upright instead of lying flat.
    I've added graphics context alteration to the gameobjects Show methods and currently trying to achieve the desired affect.

    Chz,


Similar Threads

  1. CL_LineEdit (Password Mode ?)
    By Fr3DBr in forum Official ClanLib SDK Forums
    Replies: 15
    Last Post: 09-20-2009, 08:54 AM
  2. CL_LineEdit Password mode
    By huntercool in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 09-02-2009, 07:57 AM
  3. Clanlib 0.8.1 Full screen mode under SDL
    By babyvegas in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 05-28-2009, 12:02 PM
  4. Windowed Mode
    By Eschar in forum Novashell Game Creation System
    Replies: 3
    Last Post: 09-21-2007, 11:22 PM
  5. Fix for Fullscreen mode
    By glorified_ameba in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 07-27-2007, 04:22 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •