Results 1 to 8 of 8

Thread: OpenGL glLightfv parameters

  1. #1

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Lightbulb OpenGL glLightfv parameters

    Having a few problems with OpenGL's glLightfv function,

    I sent:

    Code:
    glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient)
    with LightAmbient being an array of float containing { 0.5, 0.5, 0.5, 1.0 }
    (edit: these values correspond to x,y,z, alpha)

    and I receive error message:

    "Error 1 Overloaded method 'CsGL.OpenGL.OpenGL.glLightfv(uint, uint, float*)' has invalid arguments"

    using csgl.dll from Lloyd Dupont <[email protected]>, 2001
    ver 1.4.1.0

    All samples over the internet make the use of the array fine... so I'm having a hard time find the problem on my arguments...

    thanks for helping...

    (edit: sry if not appropriate for this topic, please move to Games and Graphics Programming)
    Last edited by Ruku; Feb 7th, 2007 at 10:03 AM.

    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  2. #2

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Re: OpenGL glLightfv parameters

    bump, anyone?

    Found something... I just realised that the expected parameter corresponds to a pointer. This means that to pass the array of floats, I need to declare my code as "unsafe" in order for it to work since .net hides memory management... (with the garbage collector)

    SO, I'm sort of new with theses unsafe methods, any help?
    Last edited by Ruku; Feb 7th, 2007 at 09:59 AM.

    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  3. #3
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: OpenGL glLightfv parameters

    remove the f at the end each values when you assign the values in the array.
    "The dark side clouds everything. Impossible to see the future is."

  4. #4

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Re: OpenGL glLightfv parameters

    Sorry, forgot to migrate line to vb... but no that's not quite the problem, any help with unsafe methods?

    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  5. #5
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: OpenGL glLightfv parameters

    Unsafe only in c#
    "The dark side clouds everything. Impossible to see the future is."

  6. #6
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: OpenGL glLightfv parameters

    Did you declare your array like this?
    VB Code:
    1. dim LightAmbient(3) as Glfloat = { 0.5, 0.5, 0.5, 1.0 }
    "The dark side clouds everything. Impossible to see the future is."

  7. #7

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Re: OpenGL glLightfv parameters

    Quote Originally Posted by Asgorath
    Unsafe only in c#
    Great, uh, please move thread to Games and Graphics Programming or C#...
    (Sorry I really thought it was for .net in general, and I figured vbforums has more vb fans then c# fans, so I've posted the code as vb...)



    I'm pretty sure my declarations are ok, the only problem is either the "unsafe method" when I add the &variableforpointer,

    or it's that I'm not supposed to send an array, but rather a single float... but as I said all samples containing this function work well with an array... so I'm lost over this...!


    wait, I didn't see that GLFloat part, where is this object from CsGL? I only saw PFloat and that didn't work neither...
    Last edited by Ruku; Feb 7th, 2007 at 10:35 AM.

    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  8. #8

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Re: OpenGL glLightfv parameters

    bump?

    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width