' SET_GL_SCALE sample ' ' Last updated: <2024/02/11 23:56:15 +0900> ' License : CC0 / Public Domain #define NO_BLUR 1 'change to 1 'Const SCRW = 320 : Const SCRH = 180 Const SCRW = 320 : Const SCRH = 240 #include "fbgfx.bi" Using fb ' set screen depth Dim As Integer sdepth = 32 Select Case Command(1) Case "8" : sdepth = 8 Case "16" : sdepth = 16 Case "32" : sdepth = 32 End Select ' get desktop size Dim As Integer dispw, disph ScreenInfo dispw, disph ' get scale (Integer) Dim As Integer dscale = Int(disph / SCRH) If dscale > (dispw / SCRW) Then dscale = Int(dispw / SCRW) ' ge true screen size Dim As Integer tscrw, tscrh tscrw = dispw / dscale tscrh = disph / dscale If (tscrw * dscale) <> dispw Then tscrw += (dispw - (tscrw * dscale)) If (tscrh * dscale) <> disph Then tscrh += (disph - (tscrh * dscale)) screencontrol(SET_GL_2D_MODE, OGL_2D_MANUAL_SYNC) screencontrol(SET_GL_SCALE, dscale) ScreenRes tscrw, tscrh, sdepth, , GFX_OPENGL Or GFX_NO_FRAME #if (NO_BLUR = 1) #include "GL/gl.bi" glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) #endif Dim As Double angle = 0.0 Dim As Boolean running = True Const PI = 3.1415926535897932 ' Main Loop Do If Inkey <> "" Then running = False ' set true screen view size view (0, 0) - (tscrw - 1, tscrh - 1), RGB(0, 0, 0) ' set draw area size Dim As Integer ox, oy ox = (tscrw - SCRW) * 0.5 oy = (tscrh - SCRH) * 0.5 view (ox, oy) - (SCRW - 1 + ox, SCRH - 1 + oy), RGB(30, 60, 120) ' clear screen Color RGB(255, 255, 255), RGB(30, 60, 120) cls Circle (SCRW \ 2, SCRH \ 2), (SCRH \ 2 - 1), RGB(0, 255, 0) Dim As Integer x, y, r r = SCRH / 4 x = (SCRW / 2 - r - 1) * Cos(angle * PI / 180.0) + (SCRW / 2) y = (SCRH / 2 - r - 1) * Sin(angle * PI / 180.0) + (SCRH / 2) Circle (x, y), r, RGB(0, 255, 255) Draw String (0, 0), Str(SCRW) & "x" & SCRH & " (" & tscrw & "x" & tscrh & ")x" & dscale, RGB(255, 255, 255) angle += 1.0 sleep 10 flip() ' change double buffer Loop While running