SetViewPort Problem

BlitzMax Forums/BlitzMax Programming/SetViewPort Problem

hmm, this is what I was testing in this thread:

http://www.blitzbasic.com/Community/posts.php?topic=62781

but noone found a PC where it didn't work. Any chance you can test my exe in that thread on the Geforce PCs and list the exact model numbers of the cards?

One of my problems was fixed with a Ian Duff's code (drawing part of rect) but for the other problem I could only use viewport because it involved drawing text onto an image but having the text clipped to a viewport. The only way I could see around this was to predraw the text on the image, and then use Ian Duff's code to draw part of the image only...

Meanwhile, are these two bits of code any good to you:

' -----------------------------------------------------------------------------
' cctg_drawimagerect by TonyG (slow?)
' -----------------------------------------------------------------------------
Function cctg_DrawImageRect(image:TImage,x:Int,y:Int,xs:Int,ys:Int,width:Int,height:Int)
    DrawImage LoadImage(PixmapWindow(LockImage(image),xs,ys,width,height)),x,y
End Function

' -----------------------------------------------------------------------------
' ccDrawImageArea by Ian Duff (faster?)
' -----------------------------------------------------------------------------
' Note that this code works fine in DirectX or OpenGL on PCs - it autodetects (JB).
Function ccDrawImageArea(image:TImage, x#, y#, rx#, ry#, rw#, rh#, frame=0)
  Local origin_x#, origin_y# ; GetOrigin (origin_x, origin_y)
  Local tw = Pow2Size(image.width)
  Local th = Pow2Size(image.height)
  Local rw1#  = rx + rw
  Local rh1#  = ry + rh
  Local x0# = -image.handle_x, x1# = x0 + rw
  Local y0# = -image.handle_y, y1# = y0 + rh
  
  If rw1 > image.width
    x1 = x0 + rw + image.width - rw1
    rw1 = image.width
  EndIf
   
  If rh1 > image.height
    y1 = y0 + rh + image.height - rh1
    rh1 = image.height
  EndIf
?Win32
  If TD3D7ImageFrame(image.frame(frame))
    Local frame:TD3D7ImageFrame = TD3D7ImageFrame(image.frame(frame))
    
    frame.setUV(rx / tw, ry / th, rw1 / tw, rh1 / th)
    frame.Draw x0, y0, x1, y1, x + origin_x, y + origin_y
    frame.setUV(0, 0, image.width / Float(tw), image.height / Float(th))
  Else
?
    Local frame:TGLImageFrame = TGLImageFrame (image.frame(frame))
                
    frame.u0 = rx / tw
    frame.v0 = ry / th
    frame.u1 = rw1 / tw
    frame.v1 = rh1 / th
    
    frame.Draw x0, y0, x1, y1, x + origin_x, y + origin_y
    
    frame.u0 = 0
    frame.v0 = 0
    frame.u1 = image.width / Float(tw)
    frame.v1 = image.height / Float(th)
?Win32
  EndIf
?
  
  Function Pow2Size(n)
    Local ry = 1
    
    While ry < n
      ry :* 2
    Wend
    
    Return ry
  End Function
End Function