HOLYSHIT DUDE !
What a ****ing bug hunt this was ?!
I spent like at least 6 ****ing hours trying to find this mother****ing BUG
!
And finally I found it ! MOther****ers !
I was taking another look at the glQuad technique of the original gpgpu
tutorial which mysteriously first didn't work then I changed a little bit of
code here and there... and then it did work !
And then I noticed how it did something completely opposite:
Here is the code:
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex2f(0.0, 0.0);
glTexCoord2f(mTextureWidth[0], 0.0);
glVertex2f(mTextureWidth[0], 0.0);
glTexCoord2f(mTextureWidth[0], mTextureHeight[0]);
glVertex2f(mTextureWidth[0], mTextureHeight[0]);
glTexCoord2f(0.0, mTextureHeight[0]);
glVertex2f(0.0, mTextureHeight[0]);
glEnd();
Now take a look at my (incorrect code):
procedure CreateVertexPoints(ParaWidth: integer; ParaHeight: integer);
var
vX: integer;
vY: integer;
begin
glBegin(GL_POINTS);
for vY := 0 to ParaHeight - 1 do
begin
for vX := 0 to ParaWidth - 1 do
begin
glVertex2f( vX, vY );
glTexCoord2f( vX, vY );
end;
end;
glEnd;
end;
There are two major problems with this code ?!
Not just one, but two ! Can you spot which ones ?!
And now for the correct code !
procedure CreateVertexPoints(ParaWidth: integer; ParaHeight: integer);
var
vX: integer;
vY: integer;
begin
glBegin(GL_POINTS);
for vY := 0 to ParaHeight - 1 do
begin
for vX := 0 to ParaWidth - 1 do
begin
glTexCoord2f( vX, vY );
glVertex2f( vX + 0.5, vY + 0.5 );
end;
end;
glEnd;
end;
TATA ! =D
And the explanation is as follows:
1. First of all the verteces must be in the center of the pixels.
Therefore each vertex must be + 0.5 because that's the center of a pixel !
Therefore the correct matrix setup code is actually very simple:
glViewport(0,0,OpenGLv2.Width,OpenGLv2.Height); //
Resetuje aktuální nastavení
glMatrixMode(GL_PROJECTION);
glLoadIdentity;
gluOrtho2D(0.0, OpenGLv2.Width, OpenGLv2.Height, 0.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity;
^ This is the correct code... anything else that is posted on the internet
IS BULLSHIT 100% garantueed !
Now for the second bug ! And oh boy was it hard to find ! HERE IT COMES ?!
ARE YOU READY FOR THE SPLATTER ALL OVER YOUR FACE ?!


2. The second bug is with the order of the api calls. Remember I am noob...
I don't know jack **** open gl and it's ****ing state machine... They
sometimes say it doesn't matter in what order you make the calls ?!
WELL **** THAT I SAY ! THAT'S BULLSHIT ! THAT'S OTHER MOTHER****ING BULLSHIT
! IT DOES MATTER ! LOW AND BEHOLD:
The problem was with this code in create vertices:
glVertex2f( vX, vY );
glTexCoord2f( vX, vY );
It's in the wrong ORDER !
It must be like this:
glTexCoord2f( vX, vY );
glVertex2f( vX, vY );
That takes care of the stupid mother****ing vertical mother****ing LINE !
YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
Then add a little bit of 0.5 and you half yourself a nice decent fix !
Now the QUAD WORKS !
Now the POINTS WORK !
Now the TEXTURE COORDINATES WORK !
Now the COLORS WORK !
HOLY ****ING **** BATMAN !

=D
I, ****ING, SKYBUCK, LOL, AM ****ING AWESOME !
I AM ****ING GREAT !
****ING ADMIT IT YOU ****ING ****ING ****ING PIECES OF NOOOOOBAAAAASSSSSESSS
! =D
YEAH BABY.
FEELS GOOD TO KNOW THAT I OWNED AAAAAAAALLLLLLLLLL OF YOUR ASSES !
YES ME SKYBUCK ULTIMATE BUG HUNTER ! HIHIHIHIHHIH LOL.
NO BUG ESCAPES FROM ME BABY !
There has only been one bug in my entire live that I could not find until
this day and it was in my game called Combat... an animation of an exploded
ship... that was pre-calculated into an animation array of particles and
such... I never found that bug... even after many years porting it to
Delphi... me never found it... it remains a mystery to this day. I shall
call it "THE SKYBUCK/COMBAT MYSTERY BUG"

=D
AND NOW IT'S TIME FOR ME TO GO ONTO SOME SERIOUS GPGPU ASS****ING OWNAGE !
LOL.
OK I AM GETTING A LITTLE BIT TOO NASTY WITH THE ASS****ING !
BUT I FEEL A LITTLE BIT ASS****ED MYSELF WITH ALL THIS MISINFORMATION AND
CRAP ON THE ****ING INTERNET !
I, SKYBUCK, CRAP BUSTER ! YEAH ! =D
BUSTING CRAP ! YUP THATS ME HAHAHAHAHAHA LOL.
YES, IN CASE YOU COULDN'T TELL, I AM VERY HAPPY !
I WAS GETTING DOUBTS ABOUT OPENGL...
I WAS ABOUT TO TELL YOU GUYS TO SHOVE OPENGL UP YOUR ****ING ASSES !
GLAD I DIDNT DO THAT CAUSE IT TURNS OUT TO BE GREAT !
AT LEAST SO FAR SO GOOD !
THIS TIME I BELIEVE IT S THE REAL THING BABY ! YEAAAAH !!!!!!!!!!!!!!!
THIS HISTORICAL MOMENT IN THE PROGRAMMING OF OPENGL and DOMINATING SKYBUCK
SKILLS...
NEEDS TO BE CELIBRATED WITH A MUSIC SONG/VIDEO:
HERE IT COMES BABY:
http://www.youtube.com/watch?v=YAAflFyWNPo
"The real thing by 2 unlimited !" <- Dutch people too !
Yeah some of us dutch people simply ****ing OWN HAHAHAHAHAHAHA ! LOL.
Though it's slightly low quality sound so here is a remixed version...
It's not the real thing... but ok
http://www.youtube.com/watch?v=dYfDqpLuExs
It is kinda funky !
REMMMIIIXXXXX YEAH BABY ^
Bye,
Skybuck

=D