Author Topic: Hardware accelerated display, OpenGL back-end & Simutrans 3D  (Read 123587 times)

0 Members and 1 Guest are viewing this topic.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4453
  • Total likes: 141
  • Helpful: 105
  • Languages: EN, NO
Re: Hardware accelerated display, OpenGL back-end & Simutrans 3D
« Reply #490 on: December 05, 2012, 07:20:40 PM »
I thought register_image would be the place for this.

Offline Markohs

  • DevTeam, Coder/patcher
  • Devotee
  • *
  • Posts: 1560
  • Total likes: 1
  • Helpful: 86
  • Languages: EN,ES,CAT
Re: Hardware accelerated display, OpenGL back-end & Simutrans 3D
« Reply #491 on: December 06, 2012, 09:54:08 AM »
Yes, and it's the right place, but I need to know wich type of image is to put it on the corresponding atlas so phases can be drawn in the minimum number of passes. Atm I wanted one for land tiles plus slopes and maybe a second for way objects. when register_image is called, that information is lost. Maybe a good idea that comes to my mind with your post is I should add a parameter to register_image with an optional texture atlas id.

register_image is called on each image of the game, I just need to know wich type of image is.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4453
  • Total likes: 141
  • Helpful: 105
  • Languages: EN, NO
Re: Hardware accelerated display, OpenGL back-end & Simutrans 3D
« Reply #492 on: December 06, 2012, 04:04:47 PM »
Thinking out loud: is it possible for an image to be both land tile and something else?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4070
  • Total likes: 98
  • Helpful: 146
  • Languages: EN, DE, AT
Re: Hardware accelerated display, OpenGL back-end & Simutrans 3D
« Reply #493 on: December 06, 2012, 04:52:34 PM »
No. Land tiles are generated.
Parsley, sage, rosemary, and maggikraut.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8573
  • Total likes: 254
  • Helpful: 226
  • Languages: De,EN,JP
Re: Hardware accelerated display, OpenGL back-end & Simutrans 3D
« Reply #494 on: December 06, 2012, 06:28:52 PM »
Thus land tiles a a certain image range. However, soon the landscape code might change. Furthermore, would it no make much more sense for OpenGL to just provide the mesh points and texture(s) and leave the rendering to the hardware?

Offline Markohs

  • DevTeam, Coder/patcher
  • Devotee
  • *
  • Posts: 1560
  • Total likes: 1
  • Helpful: 86
  • Languages: EN,ES,CAT
Re: Hardware accelerated display, OpenGL back-end & Simutrans 3D
« Reply #495 on: December 06, 2012, 07:42:02 PM »
yep, prissi, and that's what I already implemented. the problem comes from the situation uploading the textures each frame consumes too much CPU and PCI bandwidth, so I have to create a texture with all possible tiles and upload it first, and re-use it on all frames. To make this I added some code to calc_water_level anf just uploaded all those images.
This has already been implemented and it works perfect, boosting performance.
the problem is now i want to do the same with slopes and ways, and can't see a good place in code to locate wich are those images. about slopes i was thinking generating them from textures prograatically like climate tilles are now, and do the code for simutrans 2D too, auporting doble heigjt. but how to register just way images?
written from my phone, this post might have errors

Offline Markohs

  • DevTeam, Coder/patcher
  • Devotee
  • *
  • Posts: 1560
  • Total likes: 1
  • Helpful: 86
  • Languages: EN,ES,CAT
Re: Hardware accelerated display, OpenGL back-end & Simutrans 3D
« Reply #496 on: December 06, 2012, 07:48:39 PM »
Thinking out loud: is it possible for an image to be both land tile and something else?
land tiles are generaged, yes. but in.  the case one image is used in multiple objects, i'd just add copies to each atlas.