Author Topic: Freebasic opengl tutorials?  (Read 7886 times)

0 Members and 1 Guest are viewing this topic.

Offline Paul

  • Pentium
  • *****
  • Posts: 1490
  • Karma: 47
    • View Profile
Freebasic opengl tutorials?
« on: July 04, 2007 »
Hi
I'm looking for opengl tutorials for freebasic and I'm wondering if you got any suggestions?
saw the nehe ones, but they seem to need gl\glaux.bi for something and they're not fr freebasic which makes everything a little more complicated.

thx
//Paul
I will bite you - http://s5.bitefight.se/c.php?uid=31059
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Freebasic opengl tutorials?
« Reply #1 on: July 04, 2007 »
You might find some interesting things here;

http://rel.betterwebber.com/index.php?action=contents&item=Tutorials

It's Relsoft's site, I know he has done some GL stuff, maybe he has some on his site.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Paul

  • Pentium
  • *****
  • Posts: 1490
  • Karma: 47
    • View Profile
Re: Freebasic opengl tutorials?
« Reply #2 on: July 04, 2007 »
THX for the reply, Ill check that sight when i get time:)

I'm doing the first tutorial and having problems with one part, resizing the screen when entering fullscreen mode. Here is that particular peice of code:

Code: [Select]
               dim dmScreenSettings as DEVMODE ' Device Mode
       clear(@dmScreenSettings,0,sizeof(dmScreenSettings)) ' Makes Sure Memory's Cleared
               dmScreenSettings.dmSize=sizeof(dmScreenSettings) ' Size Of The Devmode Structure
       dmScreenSettings.dmPelsWidth = widthh ' Selected Screen Width
       dmScreenSettings.dmPelsHeight = height ' Selected Screen Height
       dmScreenSettings.dmBitsPerPel = bits ' Selected Bits Per Pixel
       dmScreenSettings.dmFields=DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT
               ' Try To Set Selected Mode And Get Results.  NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
               if ChangeDisplaySettings(@dmScreenSettings,CDS_FULLSCREEN)<>DISP_CHANGE_SUCCESSFUL then
                  end
               endif

If you like i can post the full code

Thx again
//Paul
I will bite you - http://s5.bitefight.se/c.php?uid=31059
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Freebasic opengl tutorials?
« Reply #3 on: July 04, 2007 »
Yep, post the full listing and we'll see what's wrong :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Paul

  • Pentium
  • *****
  • Posts: 1490
  • Karma: 47
    • View Profile
Re: Freebasic opengl tutorials?
« Reply #4 on: July 04, 2007 »
Here it comes, found an other problem... Does anyone know the value of WM_ACTIVE it doesn't seem to be declared?

anyway here comes the code
I will bite you - http://s5.bitefight.se/c.php?uid=31059
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Freebasic opengl tutorials?
« Reply #5 on: July 04, 2007 »
glaux is really very badly outdated, which is why noone uses it any more.

Jim
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Freebasic opengl tutorials?
« Reply #6 on: July 05, 2007 »
THX for the reply, Ill check that sight when i get time:)

I'm doing the first tutorial and having problems with one part, resizing the screen when entering fullscreen mode. Here is that particular peice of code:

Code: [Select]
               dim dmScreenSettings as DEVMODE ' Device Mode
       clear(@dmScreenSettings,0,sizeof(dmScreenSettings)) ' Makes Sure Memory's Cleared
               dmScreenSettings.dmSize=sizeof(dmScreenSettings) ' Size Of The Devmode Structure
       dmScreenSettings.dmPelsWidth = widthh ' Selected Screen Width
       dmScreenSettings.dmPelsHeight = height ' Selected Screen Height
       dmScreenSettings.dmBitsPerPel = bits ' Selected Bits Per Pixel
       dmScreenSettings.dmFields=DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT
               ' Try To Set Selected Mode And Get Results.  NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
               if ChangeDisplaySettings(@dmScreenSettings,CDS_FULLSCREEN)<>DISP_CHANGE_SUCCESSFUL then
                  end
               endif

If you like i can post the full code

Thx again
//Paul

@Paul: I can't test your code, probably you're using a new FB version (I'm still using 0.15 beta)

Anyway try to change this line:
Code: [Select]
clear(@dmScreenSettings,0,sizeof(dmScreenSettings))to:
Code: [Select]
ZeroMemory(@dmScreenSettings, sizeof (DEVMODE))Maybe that help...

About "WM_ACTIVATE"  (not "wm_active"), this message is sent when a window is being activated or deactivated.
use this command to active your window (after CreateWindowEx command):
SetActiveWindow( hWnd )


Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Freebasic opengl tutorials?
« Reply #7 on: July 05, 2007 »
Code: [Select]
dmScreenSettings.dmPelsWidth = widthh
Is there deliberately an extra h on the end of width there?  If so, you can spot problems like that by adding
Code: [Select]
option explicit
to the start of your program which points out these errors.

Jim
Challenge Trophies Won:

Offline Paul

  • Pentium
  • *****
  • Posts: 1490
  • Karma: 47
    • View Profile
Re: Freebasic opengl tutorials?
« Reply #8 on: July 05, 2007 »
The problem with width is that it goes bold and i don't seem to be allowed to pass it to my function, therefor i wrote widthh in all the places. Tried replacing the Clear with Zeromemory, but it doesn't help:(

Here is modified code with option explicit.

Thank you for your support
Paul
I will bite you - http://s5.bitefight.se/c.php?uid=31059
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: Freebasic opengl tutorials?
« Reply #9 on: July 05, 2007 »
i know this might not be much help paul but i use either sdl or freebasics own commands for easy setup as i dont think gdi stuff works very great in fb.

if you like i can post a small example up in both to show you how to get a window open for youse with gl.
Challenge Trophies Won:

Offline Paul

  • Pentium
  • *****
  • Posts: 1490
  • Karma: 47
    • View Profile
Re: Freebasic opengl tutorials?
« Reply #10 on: July 05, 2007 »
Ok,
What are the main differences betwen gdi and sdl?
Is one faster?
Do i have the same shader options and that sort of thing?

I really don't know much about this.
Paul

EDIT:
tried the SDL examples in the freebasci folder and thy tell me that i havent got SDL.DLL in my systemfolder, where do i download this? Does it work with windows 2K? Am i asking to many questions? Have I already got it but the wrong version or is there an other reason?

EDIT 2:
Downloading SDL.dll now :)
« Last Edit: July 05, 2007 by Paul »
I will bite you - http://s5.bitefight.se/c.php?uid=31059
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: Freebasic opengl tutorials?
« Reply #11 on: July 06, 2007 »
sdl will have the same gl performance as gdi, it lets you set up the window a little easyer but you will need the sdl.dll in the project folder.

the other choice is by yousing the fb screen and flip command you can easily get gl going without the need for an external dll.

-edit you will still have all the options like shaders extensions etc sdl gdi and freebasic just aid in seting up the window for gl to draw on it sdl should work fine in 2k.

the other thing with sdl is that it goes a little further that just helping set up a window it has timer funcs key handling etc.

now there is also one other lib that comes with freebasic to help open windows and stuff its called glfw. if you look in the include folder of your freebasic install you will see it, i dont know to much about it but there is some examples floating around here incase your intrested.

you can yous any one of these options its just a matter of prefrence as to what suits you best really ;)
« Last Edit: July 06, 2007 by ninogenio »
Challenge Trophies Won: