Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Author Topic: showing images on canvas ?  (Read 105 times)

fly77

  • Sr. Member
  • ****
  • Posts: 320
showing images on canvas ?
« on: April 14, 2019, 11:53:56 am »

I am trying to show some images on the canvas using script found in some of outerra default models. It works to show the airspeed.dds image. I tried to edit this file in gimp or subtsitute it with another one made by me in gimp (.dds   DXT1 format generate mipmaps) and add also the corresponding .tga as I have seen there is also a airspeed.tga in the Anteworld/ui folder  but neither works. Nothing shows up. I only can get to show up the airspeed.dds or the set of images basic.dds with all of the images of the set showing together. How to create and show my own images on the canvas ?


Code: [Select]
var display_canvas,$sketch;

function init_vehicle()
{
...
 $sketch = this.sketch = this.$query_interface("ot::js::sketch.get");
}


function update_frame(dt, engine, brake, steering)
{

this.img = $sketch.load_image("ui/airspeed.dds");
   
$sketch.make_canvas_active(display_canvas);
var screen_size = world.screen_size();
$sketch.set_canvas_2d_offset({ x: screen_size.x*0, y: 0 });
$sketch.clear_canvas();
$sketch.draw_image(this.img, {x:300,y:300}, 0xffffffff);
}
« Last Edit: April 14, 2019, 11:57:14 am by fly77 »
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6591
  • Pegs is clever, but tae hain’t a touch sentimental
    • outerra.com
Re: showing images on canvas ?
« Reply #1 on: April 14, 2019, 01:17:50 pm »

airspeed.dds is in uncompressed ARGB format, did you try that one?
Logged

fly77

  • Sr. Member
  • ****
  • Posts: 320
Re: showing images on canvas ?
« Reply #2 on: April 14, 2019, 02:19:18 pm »

Thanks cameni ! Now that I exported it form gimp as uncompressed RBGA8 (no mipmap) it works !  Great !
« Last Edit: April 14, 2019, 03:33:10 pm by fly77 »
Logged