X_settextureoffset

Previous topic - Next topic

mich19

Can you explain me the functioning of X_SETTEXTUREOFFSET

bigsofty

Its the texture offset.

The two parameters are added to all UV co-ordinates for a model to make the texture 'scroll' by a certain amount, horizontally and vertically.

Think of it as quick way to rotate a skin around a model or scroll a repeated texture accross a polygonial plane.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

mich19

I do not arrive has to use this function(office), can you make me an example
Thank you

BumbleBee

Hi mich19

Here is a X_SETTEXTUREOFFSET example

Code (glbasic) Select
LIMITFPS 60

         //Call Create_Ground_Function
Create_Ground(400,0,400,RGB(255,255,255))

            //Load Texture
LOADSPRITE "Your_Texture.bmp",1

                       //LOOP
//-------------------------------------------------------
WHILE TRUE

  X_MAKE3D 1,2000,45
  X_CAMERA 0,0,-1200,0,0,0

  X_MOVEMENT 0,0,0
  X_SCALING 1,1,1
  X_ROTATION 90,1,0,0
  X_SETTEXTURE 1,-1
            //Scroll texture (dx,dy)
  //dx=dx-0.005
  dy=dy+0.01  
  X_SETTEXTUREOFFSET dx,dy
 
  X_DRAWOBJ 1,0
     
 SHOWSCREEN
WEND


// ---------------------------------------------------------//
             //    CREATE_GROUND
// ----------------------------------------------------------//
FUNCTION Create_Ground: Gr_X,Gr_Y,Gr_Z,Gr_Color
     X_OBJSTART 1
X_OBJADDVERTEX -Gr_X,0,-Gr_Z, 0,0,Gr_Color
X_OBJADDVERTEX  Gr_X,0,-Gr_Z, 1,0,Gr_Color
X_OBJADDVERTEX -Gr_X,0, Gr_Z, 0,1,Gr_Color
X_OBJADDVERTEX  Gr_X,0, Gr_Z, 1,1,Gr_Color
X_OBJEND
ENDFUNCTION
Have a nice day :)

Cheers
The day will come...

CPU Intel(R) Core(TM) i5-3570k, 3.4GHz, AMD Radeon 7800 , 8 GB RAM, Windows 10 Home 64Bit

bigsofty

Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

I'll put that in the manual then!?

mich19

Thank you for the speed and the quality of the example