Results 1 to 4 of 4

Thread: Using 2D and 3D at the same time

  1. #1
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Using 2D and 3D at the same time

    I want to create a game that uses a model for the game animations and 2D from the user interface and interactions.

    In my render function I have tried

    [pascal]Begin2D
    Draw 2D things
    End2D
    Begin3D
    Draw 3D models
    End3D
    Begin2D
    Draw 2D things
    End2D[/pascal]

    The items in the first 2D drawing block as well as those in the second 2D drawing block are drawn in what looks like an alpha drawn state. I have tried to change the background behind them before drawing but it makes no difference.

    How do I mix 2D and 3D things together?
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  2. #2

    Using 2D and 3D at the same time

    I think you're doing it the good way, even if I would begin by drawing the 3D scene and then add the 2D part, because it's possible the 2D items you drawed first will be overlapped by the 3D elements.

    Secondly, for you stange drawn state, perhaps you forgot to set UseColor(1,1,1) before drawing, because the 2D sprite colors are modified by the UseColor value (for example if you set UseColor(1,0,0), only the red part of the sprite will be visible).
    Are you sure you didn't enable alpha blending ? (this is done by glEnable(GL_BLEND), and by choosing a blending mode : glBlendFunc(...,...) ). If this is the case, i could be the reason of the odd drawing...

    Abened

  3. #3
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Using 2D and 3D at the same time

    Thanks. There are some 2D items I want to be overwritten by the 3D things.

    I havn't used the setColor option at all. I'll try do as you suggest and see what happens.

    I have not added any straight openGL calls (thats why I'm using GLXTreem - so I dont need to learn the OpenGL stuff ).
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  4. #4
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Using 2D and 3D at the same time

    The UseColor(1,1,1) idea didn't fix the problem.

    I'll load my program and source onto the internet later and ask for some help. If possible I'll do it tonight.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

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
  •