Results 1 to 2 of 2

Thread: Drawing 2D objects in a 3D space

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

    Default Drawing 2D objects in a 3D space

    I am making a new clanlib example that demonstrates how to obtain inputs from various devices - Keyboard, Mouse and Joysticks.

    To do this I am setting the example in a 3D environment.

    When each key is pressed, the corresponding letter is displayed at the front of the 3D scene, at the X,Y position set by the mouse pointer.

    The letter will fly off into the scene (with increase Z position).

    When the letter hits a "blocker" (controlled by a joystick), it drops off the scene (by decreasing the Y position)

    A GUI Panel (rotated in 3d) controls the input devices.

    It should be very simple to do.

    Except !!!

    All the required functions only operate in 2d space:
    These include:
    CL_Draw, CL_Sprite, CL_Image, CL_Font

    Should we modify these classes to provide drawing functions in 3d space, for example: ?

    CL_Font::draw_text(gc, CL_Vec3f position, CL_StringRef text);

    Or should we have the restriction, that to draw 2d in 3d, you have to change the modelview matrix? (translate in the Z axis)

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

    Default

    Second thoughts

    Actually, changing the modelview matrix would be better.

    It would keep the code base simple, and the sprite render batching would still work.

    Also, you would need to modify the modelview matrix for rotations in the X,Y axis.

    I have noticed that the matrix calculations in clanlib do not have any speciali
    The matrix tran

    Personal note: Check that the ClanLib matrix calculations has specializations when multipling a matrix by a translation matrix. (I.E. 3 additions instead of 16 multiplications). (If that helps speed of course!)

Similar Threads

  1. Constructing ClanLib 0.9 Objects
    By rombust in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 12-21-2008, 08:27 AM
  2. Drawing Rectangle Problem...
    By daredevil14 in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 07-30-2008, 11:11 AM
  3. Drawing pixels
    By knutsj in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 06-17-2008, 11:43 PM
  4. Redirect GUI drawing?
    By madmark in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 10-06-2007, 04:25 AM
  5. What software was used to make 3d objects/maps?
    By Akolade in forum Other RTsoft Games
    Replies: 2
    Last Post: 09-10-2002, 08:48 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
  •