Easy GL2D

User projects written in or related to FreeBASIC.
Jonge
Posts: 130
Joined: Jul 17, 2012 17:51
Location: Norway
Contact:

Re: Easy GL2D

Postby Jonge » Jan 28, 2013 4:10

Can someone please tell me what I'm doing wrong? Its getting late, time to sleep =)

I'm trying to "put" a GfxLib buffer to the screen using GL2D, but its only the top part of the buffer that shows up..

Code: Select all

#Include once "FBGL2D7.bi"
#Include once "FBGL2D7.bas"

Dim As GL2D.IMAGE Ptr GfxBuffer

GL2D.ScreenInit(320, 240)
GL2D.VsyncON

GfxBuffer = ImageCreate(320, 240, 0, 32)

Do

   For i As Integer = 0 To 100
      PSet GfxBuffer, (Rnd * 320, Rnd * 240), RGB(Rnd * 255, Rnd * 255, Rnd * 255)
   Next

   GL2D.LoadImageToHW(GfxBuffer)
   GL2D.Begin2D
   
      GL2D.SetBlendMode(GL2D.BLEND_SOLID)
      GL2D.Sprite( 0, 0, GL2D.FLIP_NONE, GfxBuffer)
      
      GL2D.SetBlendMode(GL2D.BLEND_TRANS)
      GL2D.PrintScale(10,  10, 1, "Test")
   
   GL2D.End2D   
   
   Sleep 1,1
   Flip
   
Loop Until InKey <> ""

ImageDestroy GfxBuffer
GL2D.ShutDown


Does anyone else experience gabage/flickering screen when going fullscreen with Alt+Enter? My work computer(WinXP) does not agree when changing the examples to fullscreen.
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Re: Easy GL2D

Postby relsoft » Feb 01, 2013 12:59

Put this code outside your do..loop:

Code: Select all

GL2D.LoadImageToHW(GfxBuffer)


I'm surprised your GFX card could handle that much data.
Jonge
Posts: 130
Joined: Jul 17, 2012 17:51
Location: Norway
Contact:

Re: Easy GL2D

Postby Jonge » Feb 01, 2013 13:57

Ahh, I thought I had to copy it to HW each time I had changed it. Thanks
vdecampo
Posts: 2982
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Re: Easy GL2D

Postby vdecampo » Feb 15, 2017 17:37

FYI the link to this project in the first post took me to a virus/trojan web site.

-Vince
St_W
Posts: 1507
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Easy GL2D

Postby St_W » Feb 15, 2017 23:48

vdecampo wrote:FYI the link to this project in the first post took me to a virus/trojan web site.
Hm yes.
Luckily the site is still available under a different address: use http://rel.phatcode.net/ (instead of http://rel.betterwebber.com)

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 7 guests