Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - elvaka

Pages: [1]
1
I'm using a single sf::Sprite and sf::Texture for my entire game. My Texture contains my game's entire tileset and, every time I need to draw something, I update the TextureRect in the Sprite like this:

Code: [Select]
sprite.setTextureRect(<whatever>);

I found that, since I have to update the position and maybe scale, etc. on the sprite every frame anyway, I might as well update its TextureRect instead of storing lots of different sf::Sprite objects.

Is there any downside to doing this? Am I missing on some optimization (batching draws, etc.) because of this?

Thanks a lot, folks!

2
Graphics / 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!

Pages: [1]