|
-
Feb 6th, 2007, 09:22 PM
#1
Thread Starter
Fanatic Member
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.
-
Feb 7th, 2007, 09:26 AM
#2
Thread Starter
Fanatic Member
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.
-
Feb 7th, 2007, 09:53 AM
#3
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."
-
Feb 7th, 2007, 10:04 AM
#4
Thread Starter
Fanatic Member
Re: OpenGL glLightfv parameters
Sorry, forgot to migrate line to vb... but no that's not quite the problem, any help with unsafe methods?
-
Feb 7th, 2007, 10:06 AM
#5
Re: OpenGL glLightfv parameters
"The dark side clouds everything. Impossible to see the future is."
-
Feb 7th, 2007, 10:12 AM
#6
Re: OpenGL glLightfv parameters
Did you declare your array like this?
VB Code:
dim LightAmbient(3) as Glfloat = { 0.5, 0.5, 0.5, 1.0 }
"The dark side clouds everything. Impossible to see the future is."
-
Feb 7th, 2007, 10:21 AM
#7
Thread Starter
Fanatic Member
Re: OpenGL glLightfv parameters
 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.
-
Feb 18th, 2007, 06:56 PM
#8
Thread Starter
Fanatic Member
Re: OpenGL glLightfv parameters
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|