Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
Drawing 3D buildings on a 2D tilemap
Print
Pages: [
1
]
Author
Topic: Drawing 3D buildings on a 2D tilemap (Read 2191 times)
0 Members and 1 Guest are viewing this topic.
elvaka
Newbie
Posts: 3
Drawing 3D buildings on a 2D tilemap
«
on:
July 30, 2016, 04:17:18 pm »
Hi guys,
I'm trying to draw 3D cubes on top of a 2D SFML scene, in a similar way of how buildings are drawn in GTA2 [1]. That is: the bottom side of the cube should be on the same plane as where SFML sprites are drawn.
How can I define my glFrustrum so that 3D elements align with the 2D layer (eg: when I move the camera, 3D and 2D stuff move at the same time)? Or it's not even possible to mix perspective and orthogonal projections like this?
[1]
http://www.gouranga.com/images/gta2/gta2-3.jpg
Thanks!
Logged
Hapax
Hero Member
Posts: 3379
My number of posts is shown in hexadecimal.
Re: Drawing 3D buildings on a 2D tilemap
«
Reply #1 on:
July 30, 2016, 05:55:18 pm »
Since you're already drawing the scene in 3D for the buildings, could you not also include the ground as a plane (or multiple tiles on a plane) in 3D?
Logged
Selba Ward
-SFML drawables
Cheese Map
-Drawable Layered Tile Map
Kairos
-Timing Library
Grambol
*
Hapaxia Links
*
fallahn
Hero Member
Posts: 507
Buns.
Re: Drawing 3D buildings on a 2D tilemap
«
Reply #2 on:
July 30, 2016, 07:08:14 pm »
This is exactly what my framework
xygine
does with 3D models. You can create a camera which assumes the 2D portion of your game is on the 0 z-plane by using the height of the viewport and the vertical FOV to calculate the distance the 3D camera would need to be.
«
Last Edit: July 31, 2016, 06:37:28 pm by fallahn
»
Logged
Twitter
Super Video Golf
Tiled Map loader
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
Drawing 3D buildings on a 2D tilemap