I was expecting this to turn on and off the texture clamping but I guess GLbasic is doing a bit more under the hood ?
SETSCREEN 320,480,0
LIMITFPS 60
LOCAL sx = 320
LOCAL sy = 480
DRAWRECT 1, 1, 30, 30, RGB(0, 255, 0)
GRABSPRITE 0, 0, 0, 32, 32
DRAWRECT 1, 1, 30, 30, RGB(255, 255, 0)
GRABSPRITE 1, 0, 0, 32, 32
GETSCREENSIZE sx, sy
col = RGB(255, 255, 255)
WHILE TRUE
STARTPOLY 1
glRepeat(FALSE)
POLYVECTOR 150, 150, 0, 0, col
POLYVECTOR 150, 200, 0, sy, col
POLYVECTOR 200, 200, sx, sy, col
POLYVECTOR 200, 150, sx, 0, col
ENDPOLY
STARTPOLY 0
glRepeat(TRUE)
POLYVECTOR 0, 0, 0, 0, col
POLYVECTOR 0, 50, 0, sy, col
POLYVECTOR 50, 50, sx, sy, col
POLYVECTOR 50, 0, sx, 0, col
ENDPOLY
SHOWSCREEN
WEND
END
@FUNCTION dummy:
ENDFUNCTION
// here we need an inline block _outside_ of functions, that
// gives us some prototypes for glX calls.
INLINE
} // end namespace __GLBASIC__ - see manual for INLINE
#define GL_TEXTURE_2D 0x0DE1
#define GL_TEXTURE_WRAP_S 0x2802
#define GL_REPEAT 0x2901
#define GL_TEXTURE_WRAP_T 0x2803
#define GL_CLAMP_TO_EDGE 0x812F
// the functions are all >>extern "C" __stdcall<<
extern "C"
{
void __stdcall glTexParameteri(float, float, float);
}
// reasuring the namespace
namespace __GLBASIC__
{
ENDINLINE
FUNCTION glRepeat: Repeat = TRUE
IF Repeat = TRUE
INLINE
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
ENDINLINE
ELSE
DEBUG "OFF"
INLINE
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
ENDINLINE
ENDIF
ENDFUNCTION