Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#51 31-Jan-2014 16:25:56

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: drawing string on bitmap and painting onto 2d widget

upload done smile
You can download it from the links I give you yesterday

Offline

#52 31-Jan-2014 17:28:14

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: drawing string on bitmap and painting onto 2d widget

thx!

Offline

#53 4-Feb-2014 19:20:34

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: drawing string on bitmap and painting onto 2d widget

guys let me know if you can see the text in this scene....sometimes it renders grey, sometimes white, but at least it renders:
http://ifam.net/openspace/widgetworks3/web/

Offline

#54 4-Feb-2014 19:23:38

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: drawing string on bitmap and painting onto 2d widget

hi !

I've tried several time and always got the same result.

did you update Scol and openspace3d to the last release ? (I put the new one online yesterday)

Offline

#55 4-Feb-2014 19:28:10

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: drawing string on bitmap and painting onto 2d widget

arkeon wrote:

hi !

I've tried several time and always got the same result.

did you update Scol and openspace3d to the last release ? (I put the new one online yesterday)

I updated the voyager but not os3d.

Offline

#56 4-Feb-2014 19:29:59

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: drawing string on bitmap and painting onto 2d widget

You can update it
it will only replace files from the OS3D setup not yours.
(save only modified plugITs if you have some)

Offline

#57 4-Feb-2014 19:33:55

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: drawing string on bitmap and painting onto 2d widget

arkeon are you seeing grey or white lettering?

Offline

#58 4-Feb-2014 19:35:06

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: drawing string on bitmap and painting onto 2d widget

arkeon wrote:

You can update it
it will only replace files from the OS3D setup not yours.
(save only modified plugITs if you have some)

Yes this time I will make sure to save my code.;)

Offline

#59 4-Feb-2014 21:30:57

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: drawing string on bitmap and painting onto 2d widget

I did some tests (in 3D and in 2d graphic with a CompBitmap), i get the same result than hebdemnobad.
Maybe a hardware support not supported by the CG or the driver ?

hebdemnobad, try to change the background color of the 3d scene and/or the ambient light. Same result ?
In my tests, the rendering changes ...

Offline

#60 4-Feb-2014 21:48:11

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: drawing string on bitmap and painting onto 2d widget

the original problem was also on compbitmaps.

and I've debugged with a simple draw on compbitmap with a background container.
I didn't saw the problem at all since I've corrected the bitmap8 palette hmm

iri can you send me yours tests so I could try to reproduce it with this ones

Offline

#61 4-Feb-2014 21:57:25

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: drawing string on bitmap and painting onto 2d widget

In fact, the "system (!)" background seems to set in a transparency mode (hardware support, driver, ...).

For code, i deleted them, i had just written them quickly. hmm
If our friend can try too, we'll see better and reproduces easier this problem.

Offline

#62 5-Feb-2014 01:16:49

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: drawing string on bitmap and painting onto 2d widget

arkeon wrote:

the original problem was also on compbitmaps.

and I've debugged with a simple draw on compbitmap with a background container.
I didn't saw the problem at all since I've corrected the bitmap8 palette hmm

iri can you send me yours tests so I could try to reproduce it with this ones


Yes I'll try that.

Offline

#63 5-Feb-2014 09:29:17

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: drawing string on bitmap and painting onto 2d widget

Here the code I used for the test.
Does it make the same problem you mention ?

fun getStringSize2(font, txtList, w, h)=
  if txtList == nil then [w+1 h]
  else let txtList -> [first next] in
       let _GETstringSize font first -> [nw nh] in
         getStringSize2 font next (if nw>w then nw else w) (nh+h)
  ;;

fun getStringSize(font, str)= getStringSize2 font (lineextr str) 0 0;;

fun drawBitmap(cont, font, text, wsize, tsize)=
  let wsize -> [texWidth texHeight] in
  let tsize -> [tw th] in
  let _FILLbitmap (_CRbitmap _channel texWidth texHeight) 0xffffff -> bmpRgb in
  let _FILLbitmap8 (_CRbitmap8 _channel texWidth texHeight) 0x00 -> bmp8 in
  (
    _DRAWtext bmpRgb font (texWidth / 2) (texHeight / 2) - (th / 2) TD_CENTER 0x000000 text;
    _DRAWtext8 bmp8 font (texWidth / 2) (texHeight / 2) - (th / 2) TD_CENTER 0xff text;
    
    let _CRalphaBitmap _channel bmpRgb bmp8 nil nil -> abmp in
	(
      _CRcompBitmap _channel cont nil [0 0] OBJ_ENABLE OBJ_CONTAINER_ALLEVENTS abmp 0 0 texWidth texHeight;
    
	  //bitmaps copied in alpha bitmap so we can destroy them
	  _DSbitmap bmpRgb;
	  _DSbitmap8 bmp8;
	  
	  abmp;
	);
  );;
 
 
fun main()=	
  _showconsole;
  let _CRfont _channel 12 0 0 "Lucida Console" -> font in
  let [10 10] -> [xmargin ymargin] in
  let "Arkeon and Iri help me all the time!" -> text in
  let getStringSize font text -> [tw th] in //text height
  let [(tw + (xmargin * 2)) (th + (ymargin * 2))] -> [texWidth texHeight] in
  let _CRcontainerFromObjWin _channel nil 10 10 texWidth texHeight CO_NOCAPTION 0x0000ff "" -> cont in
  (
    let drawBitmap cont font text [texWidth texHeight] [tw th] -> abmp in
	(
	  _PAINTcontainer cont;
	  _DSalphaBitmap abmp;
	  _DSfont font;
	);
  );
  0;;

Offline

#64 12-Feb-2014 17:27:50

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: drawing string on bitmap and painting onto 2d widget

iri wrote:

I did some tests (in 3D and in 2d graphic with a CompBitmap), i get the same result than hebdemnobad.
Maybe a hardware support not supported by the CG or the driver ?

hebdemnobad, try to change the background color of the 3d scene and/or the ambient light. Same result ?
In my tests, the rendering changes ...


Here is the same scene with a blue background....the text renders as light gray:

http://ifam.net/openspace/widgetworksbl … index.html

Offline

#65 12-Feb-2014 17:32:32

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: drawing string on bitmap and painting onto 2d widget

hmm hmm

did the transparency change or is it always the same on restarts ?

This can be because of the texture resolution and graphic conversion loosing precision.

try this :
- create a larger and squared texture like 512x512
- set the font larger with the bold flag

Offline

#66 12-Feb-2014 17:53:17

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: drawing string on bitmap and painting onto 2d widget

arkeon wrote:

hmm hmm

did the transparency change or is it always the same on restarts ?

This can be because of the texture resolution and graphic conversion loosing precision.

try this :
- create a larger and squared texture like 512x512
- set the font larger with the bold flag


sometimes the text appears white, but most of the time it is grey. i will follow your suggestions. here is my code, I think it tracks yours more or less:

typeof widget_font= ObjFont;;
typeof message=  MessageBox;;
typeof my_widget= SO3_WIDGET;; 
typeof abitmap = AlphaBitmap;;


fun deleteOb(inst, param)=
  let (V3DgetDefaultViewport (V3DgetSessionView c3dXsession)) -> viewportstr in
    V3DremoveWidgetControl viewportstr my_widget;
  
  SO3WidgetDestroy my_widget;
  _DSalphaBitmap abitmap;
  0;;
fun drawBitmap(text, wsize, tsize)=
  let wsize -> [texWidth texHeight] in
  let tsize -> [tw th] in
  let _FILLbitmap (_CRbitmap _channel texWidth texHeight) 0xffffff -> bmpRgb in
  let _FILLbitmap8 (_CRbitmap8 _channel texWidth texHeight) 0x00 -> bmp8 in
  (
    let _CRalphaBitmap _channel bmpRgb bmp8 nil nil -> abmp in
    let _GETalphaBitmaps abmp -> [rgb alpha] in
    (
      _DRAWtext rgb widget_font (texWidth / 2) (texHeight / 2) - (th / 2) TD_CENTER 0xffffff text;
      _DRAWtext8 alpha widget_font (texWidth / 2) (texHeight / 2) - (th / 2) TD_CENTER 0xff text;
      SO3BitmapWidgetBlitAlpha my_widget abmp;
      set abitmap = abmp;
    );
    
    //bitmaps copied in alpha bitmap so we can destroy them
    _DSbitmap bmpRgb;
    _DSbitmap8 bmp8;
  );
  0;;


fun mainfunction()=
  let (V3DgetDefaultViewport (V3DgetSessionView c3dXsession)) -> viewportstr in
  let [10 10] -> [xmargin ymargin] in
  let "Arkeon and Iri help me all the time!" -> text in
  (
    set widget_font = _CRfont _channel 22 0 0 "Lucida Console";
    let G2DgetStringSize widget_font text -> [tw th] in //text height
    let [(tw + (xmargin * 2)) (th + (ymargin * 2))] -> [texWidth texHeight] in
    (
      set my_widget = SO3BitmapWidgetCreate (V3DgetSession c3dXsession) viewportstr.V3D_viewport "new_widget" 50 50 texWidth texHeight 100;
      V3DaddWidgetControl viewportstr my_widget;
  
      drawBitmap text [texWidth texHeight] [tw th];
    );
  
    SO3WidgetSetTransparency my_widget 1;
    SO3WidgetSetKeyboardEnable my_widget 0;
    SO3WidgetSetMouseEnable my_widget 0;
    SO3WidgetSetVisibility my_widget 1;
  );
  0;;


	/*! \brief Callback on instance destruction

  * Callback called when a plugIT instance is destroyed

  *

  *  <b>Prototype:</b> fun [PInstance u0] I

  *

  *  \param PInstance : destroyed plugIT instance

  *  \param u0 : user parameter, the type is not defined here because it is not used in this template

  *   

  *  \return I : 0

  **/







// plugIT doing something

fun doSomething(value)=

mainfunction;

  0;;





/*! \brief Callback on "Go" dms action

  *

  *  Call the program function to display a dialog box

  *

  *  <b>Prototype:</b> fun [PInstance DMI S S I u0] I

  *

  *  \param PInstance : plugIT instance

  *  \param DMI : DMS module who call the action (not used)

  *  \param S : name of the launched action

  *  \param S : data posted in DMS action link

  *  \param I : reply flag (not used)

  *  \param u0 : user parameter, the type is not defined here because it is not used in this template

  * 

  *  \return I : 0

  **/

fun cbGo(inst, from, action, param, rep, uparam)=

  // call the dialog box and set the link parameter as text

  doSomething param;

  0;;





/*! \brief Callback on new plugIT instance

  *

  *  Read the parameters from editor values and initialise the plugIT

  *

  *  <b>Prototype:</b> fun [PInstance] I

  *

  *  \param PInstance : plugIT instance

  *   

  *  \return I : 0

  **/

fun newOb(inst)=

  // retrieve the oninit param value

  let atoi (getPluginInstanceParam inst "oninit") -> state in

  (

    // define the function to call when we receive the Go action

    PluginRegisterAction inst "Go" mkfun6 @cbGo nil;

  

    // test the oninit param to know if we have to start the plugIT functionalities here

    if !state then nil else

      doSomething nil;

    

    // define the function to call when the plugIT instance is destroyed

    setPluginInstanceCbDel inst mkfun2 @deleteOb nil;

  );

  0;;





/*! \brief Global plugIT function to initialize the plugIT callbacks

  *

  * called on plugIT load, here define the functions to use for a new instance and the editor

  *

  *  <b>Prototype:</b> fun [s] I

  *

  *  \param S : plugIT file path

  *  

  *  \return I : 0

  **/

fun IniPlug(file)=

  PlugRegister @newOb nil;

  setPluginEditor @dynamicedit;

  0;;

Offline

#67 12-Feb-2014 21:33:17

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: drawing string on bitmap and painting onto 2d widget

lol ^^ this is my fault, in the example I set the text color to 0xff
so it build a 0xff0000 color only red, in grey this correspond to 85 not 255

just replace 0xff to 0xffffff

Offline

#68 13-Feb-2014 15:50:38

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: drawing string on bitmap and painting onto 2d widget

arkeon wrote:

lol ^^ this is my fault, in the example I set the text color to 0xff
so it build a 0xff0000 color only red, in grey this correspond to 85 not 255

just replace 0xff to 0xffffff

ok i will try this

Offline

#69 13-Feb-2014 18:41:13

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: drawing string on bitmap and painting onto 2d widget

yest it works!!!!
http://ifam.net/openspace/widgetworksbl … index.html


an academic/technical question....but if you are painting into a 8bit bitmap, why do you need a full color of 0xffffff?

Offline

#70 13-Feb-2014 18:42:12

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: drawing string on bitmap and painting onto 2d widget

good question ^^ we have to ask microsoft since this use the drawtext function ^^

Offline

#71 13-Feb-2014 19:02:01

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: drawing string on bitmap and painting onto 2d widget

Offline

#72 13-Feb-2014 19:34:10

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: drawing string on bitmap and painting onto 2d widget

Yes I think I did that but the rest of the current code wasn't working and I forgot that.

Offline

#73 22-Feb-2014 16:47:53

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: drawing string on bitmap and painting onto 2d widget

hello collleagues:

something in 1.6.4 broke the multiplayer script. the os3d editor checks the code fine on start up, but if I run the scene, the voyager crashes.  Arkeon I am emailing you the log. Iri let me know if you want to see it.

fwiw here are the last few lines of the log:

>>>>>>>>>>>>>> OS3D editor log > Connection to jscol.openspace3d.com
Opening Channel ...
Connect to 91.121.182.37 (91.121.182.37):9090
ChannelIP: 91.121.182.37:9090

Physic material not found avatar

> exec: _connected


> exec: __connectedToServer "2437" "Guest_2437" "30819F300D06092A864886F70D010101050003818D0030818902818100A255DB372FFEA48C9EDDEA60634666292921DBCC6091E9916A5A31B1A3578D0B584049DF2B1C597A1BC6AA610584794C1CF03C94A0BB1F520623810D0924AE3061F3E4786CD68441A1734FAEE5E11C2A6DBA3EBA09AB8CD4DB6FA420A03D2CC6D5928BA8EC554F33E3518DBFB2AE2AEFBE6CF9EC04CEABC9898379EA3A599DCB0203010001"


> exec: __srvMessage 1 "setCryptoAES" "4234D525893F216D5D42304C0C0E17635F3766B3C0F170975F3EA982EA128FA3486C93472DFFE6A10C91594443B72F4E9C9A6417ACF80C9035FF3CD5FBD8319B9A8FE3FD3BB4507313DD0AD8878ED26910F8155C6BA9CBB4CED95BC603DAB035B41D876A28F4589F1161C12EC41DEF096541D2F7861292F6E07F5F43A02469A2" NIL

NewWindow: 788030
BITMAP ERROR 2 WIN32 Num 0 : The operation completed successfully.

NewWindow: 330092
Window 330092 HIDDEN1

Offline

#74 22-Feb-2014 16:52:10

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: drawing string on bitmap and painting onto 2d widget

I posted the log to:
http://www.ifam.net/openspace/164_error … -35-28.log

instead of emailing it to you guys
-h

Offline

#75 22-Feb-2014 18:46:48

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: drawing string on bitmap and painting onto 2d widget

doh !

can you put the app online so I could try to reproduce the case and debug

Offline

Board footer

Powered by FluxBB