Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hi, openGL help: converting code to FB
#1
Ummm...Hi, I havent been here awhile...It was due to the fact that I had some troubles at home...and I'll try to check in once and a while to see how things are going, sooo...whats new?

Ya, I got a little openGL code problem, its a simple problem but I just dont know all of the new stuff in FB yet and how to convert C code to FB, so without further redo:

Code:
Sub Draw_Clicked (Cursor_X As Integer, Cursor_Y As Integer)

'pushmatrix
'Some openGL drawing stuff going on here
....
'popmatrix

Dim viewport(4) As GLint
Dim pixel(3) As GLubyte

glGetIntegerv GL_VIEWPORT, viewport()

glReadPixels Cursor_X, viewport(3)-Cursor_Y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, *pixel

End Sub

Ok, Im trying to get a certain pixel color value at a certain point in the buffer, I know this is the code to do it...I tryed to convert some of it...but mostly with no luck.

Here are my errors:
Line: glGetIntegerv GL_VIEWPORT, viewport()
Message: C:\Folder\NameofProgram.bas(LineNumber) : Warning level 0: Passing scalar as pointer, at parameter: 2
Error Message: Expected 'END SUB' or 'END FUNCTION', found: '('

Line: (Line after the first error message[glReadPixels])
Error: Array access, index expected

So? Could somebody help out and tell me what I need to do to change that code so it works?

Oh ya, here's the unmodded C version:
Code:
GLint viewport[4];
GLubyte pixel[3];

glGetIntegerv(GL_VIEWPORT,viewport);

glReadPixels(cursorX,viewport[3]-cursorY,1,1, GL_RGB,GL_UNSIGNED_BYTE,(void *)pixel);

Thank you,
Thrawn89 (<--Thats me :wink: )
i]"But...it was so beautifully done"[/i]
Reply
#2
glGetIntegerv GL_VIEWPORT, @viewport(0)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#3
hahahaha, I cant believe I forgot about that...I used them all the time in SpM, Thank you very much Relsoft Big Grin
i]"But...it was so beautifully done"[/i]
Reply
#4
Big Grin
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#5
:lol: Are you always in this much hurry? Tongue
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply
#6
Quote::lol: Are you always in this much hurry? Tongue

I'm on a net cafe? And I pay per hour.
Big Grin
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#7
no wonder you can't afford a computer / ps3 / stuff ;P, is it expensive?
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Reply
#8
Quote:
Rattrapmax6 Wrote::lol: Are you always in this much hurry? Tongue

I'm on a net cafe? And I pay per hour.
Big Grin

Okay.. you win.. Tongue .. :lol:
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply
#9
Quote:no wonder you can't afford a computer / ps3 / stuff ;P, is it expensive?

A ps2 here costs 25,000 pesos

Divide that by 50 to get the US value.

I get like 10,000 pesos a month doing two jobs. :*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#10
Quote:A ps2 here costs 25,000 pesos

Divide that by 50 to get the US value.

I get like 10,000 pesos a month doing two jobs. :*)
Wow! That's expensive compared to the US! :eek:

Code:
10,000 pesos earned per month
- 20,000 pesos (total living expenses per month)
--------
  10,000 pesos in debt per month
:-P
974277320612072617420666C61696C21 (Hexadecimal for those who don't know)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)