Author Topic: FBlua - opengl testers needed  (Read 3662 times)

0 Members and 1 Guest are viewing this topic.

Offline Merick

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 7
    • View Profile
FBlua - opengl testers needed
« on: October 14, 2007 »
Alright, it took me a while but I've translated most of the functions from LuaGL (http://luagl.wikidot.com/) from C into FreeBasic for use with FBlua. Now I need some people who've worked with ogl to help test them out.

Here's the latest version of FBlua, with the ogl functions compiled into it:

http://www.mediafire.com/?10ggdolidjz

The script file "nehe4.lua" is a lua conversion of one of the nehe tutorials, I put it in as an example of a basic 3d setup for FBlua. The file "gl.txt" is a list of all the ogl functions that have been implemented. As I don't really know what most of these do, I'll need the help of someone who does to write some test scripts to check on whether or not they work. For ogl functions that have several different versions depending on the number of arguments, those functions have been wrapped into a singl lua function which will use the appropriate ogl function depending on the number of arguments given. In addition, some of those functions can take either separate args or a table of args:

gl.Color(1.0, 0.0, 0.0)
gl.Vertex(0.0, 1.0, 0.0)

or

gl.Color( {1.0, 0.0, 0.0} )
gl.Vertex( {0.0, 1.0, 0.0} )


I have not yet implemented any functions to load image files into textures

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: FBlua - opengl testers needed
« Reply #1 on: October 14, 2007 »
How much GL experience are you looking for in a tester for this Merick? :)
I'd like to play with it but I am afraid my Opengl skills are very basic.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Merick

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 7
    • View Profile
Re: FBlua - opengl testers needed
« Reply #2 on: October 14, 2007 »
lol, if you know anything at all it would be a help

Of course, knowing how to use both OGL and Lua with FreeBasic would also be a big help with finding bugs in the "luagl.bas" source file, but as long as you can show me that the FBlua OGL functions aren't working like they should then I'll have a good starting point to know where to look for errors

note - the "luagl.bas" source file is my attempt to translate the original C source code for LuaGL - with some modifications.  For one thing, in the original C code they had it looping through an array in order to match up a string argument with the values of the OGL flag, in my version I've changed it by putting the actual values of the flags into variables in the lua VM for quicker access. I have been wondering though if I should change the way I have it now and put the flags into the gl table with the functions -i.e. use gl.PROJECTION or gl.MODELVIEW instead of GL_PROJECTION or GL_MODELVIEW, etc...

In addition to my translated/modified code, "luagl.bas" also still contains the original C functions (commented out) for reference.

*edit*

Well, it looks like the display lists work  :updance:

this is the nehe example included in the archive, but modified to use display lists:

Code: [Select]
--
-- This is a FBlua port of the FreeBasic port of NeHe lesson 4
--
-- Go to http://nehe.gamedev.net for his other great OpenGL tutorials!

rtri = 0
rquad = 0

screen.res(648,480,32, 1, FB.GFX_OPENGL, FB.GFX_MULTISAMPLE)

gl.Viewport(0, 0, 640, 480)
gl.MatrixMode(GL_PROJECTION)
gl.LoadIdentity()


gl.Perspective(45.0, 640.0/480.0, 0.1, 100.0)
gl.MatrixMode(GL_MODELVIEW)


gl.LoadIdentity()


gl.ShadeModel(GL_SMOOTH)
gl.ClearColor(0.0, 0.0, 0.0, 1.0)
gl.ClearDepth(1.0)
gl.Enable(GL_DEPTH_TEST)
gl.DepthFunc(GL_LEQUAL)
gl.Hint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST)

triangle = gl.GenLists(2)
gl.NewList(triangle, GL_COMPILE)
gl.Begin(GL_TRIANGLES)
gl.Color({1.0, 0.0, 0.0})
gl.Vertex(0.0, 1.0, 0.0)
gl.Color(0.0, 1.0, 0.0)
gl.Vertex(-1.0, -1.0, 0.0)
gl.Color(0.0, 0.0, 1.0)
gl.Vertex(1.0, -1.0, 0.0)
gl.End()
gl.EndList()

square = 2
gl.NewList(square, GL_COMPILE)
gl.Begin(GL_QUADS)
gl.Vertex(-1.0, 1.0, 0.0)
gl.Vertex(1.0, 1.0, 0.0)
gl.Vertex(1.0, -1.0, 0.0)
gl.Vertex(-1.0, -1.0, 0.0)
gl.End()
gl.EndList()


while not mKey(SC.ESCAPE) do
gl.Clear(GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT)
gl.LoadIdentity()
gl.Translate(-1.5, 0.0, -6.0)
gl.Rotate(rtri, 0, 1, 0)

gl.CallList(triangle)

gl.LoadIdentity()
gl.Translate(1.5, 0.0, -6.0)
gl.Color(0.5, 0.5, 1.0)
gl.Rotate(rquad, 1, 0, 0)

gl.CallList(square)

rtri = rtri + 0.2
rquad = rquad + 0.15
screen.flip()
end
« Last Edit: October 14, 2007 by Merick »

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: FBlua - opengl testers needed
« Reply #3 on: October 14, 2007 »
very cool!

id like to be able to help as i know a little opengl but when i start fblua and run the gl script i just get a console window for a split second then it jumps back to the initial window.

in other words the script doesnt run here  ???
Challenge Trophies Won:

Offline Merick

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 7
    • View Profile
Re: FBlua - opengl testers needed
« Reply #4 on: October 14, 2007 »
sorry, looks like I uploaded a bad archive, try this one instead: http://www.mediafire.com/?f31tuk4dzzb

« Last Edit: October 14, 2007 by Merick »

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: FBlua - opengl testers needed
« Reply #5 on: October 14, 2007 »
again that doesnt work,

maybe im doing it wrong im starting fblua.exe from the project folder then im cliking run test script win lau player then trying any of the test scripts results in it falling back to the start screen.
Challenge Trophies Won:

Offline Merick

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 7
    • View Profile
Re: FBlua - opengl testers needed
« Reply #6 on: October 14, 2007 »
Oops, it's not the archive. Looks like it's a path problem with my shell script. In my shell script i'm using the lua function io.popen() to run the scripts, but it seems that popen has trouble with some folder names - i.e. if you unpacked the archive into a folder with the same name as the archive - FBlua(2007-10-14) -  then it won't work, but if you put the main FBlua folder from the archive somewhere like c:\FBlua then it should work

*edit*

Oh, and to run the FBlua scripts, use the Run with FBlua button

the lua player button is only for running scripts meant for the windows version of the psp Lua player, which has a different set of functions than FBlua. I've included lua player with this archive because I'm also trying to build  a script editor with a test function for  scripts for either FBlua or Lua Player
« Last Edit: October 14, 2007 by Merick »

Offline Merick

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 7
    • View Profile
Re: FBlua - opengl testers needed
« Reply #7 on: October 14, 2007 »
I've been looking up the specs for the  wavefront material files, but I'm having some trouble figure out what ogl commands are used to generate the material.

example:
newmtl hair

Ka 0 0 0
Kd 0.941176 0.768627 0.0588235
Ks 0 0 0
illum 2
Ns 8

I know that the Ka, Kd, and Ks refer to the ambient, diffuse, and specular reflectivity of the material, illum refers to the illumination model, and Ns is the specular exponent, but how would I convert that into ogl function calls?