Haha ok.
What I am concerned about is whether or not this is simply a problem on my computer or some other peoples, so that when I release my game some people will have flipped images and some won't.
MAIN.CPP
#include <SFML/Graphics.hpp>
#include "type_conversion.h"
using namespace sf;
using namespace std;
// Normal Mapping Test
int main()
{
/* Create window */
RenderWindow SYS(VideoMode(512, 512, 32), "Annihilator", 1, WindowSettings(24, 8, 0));
SYS.SetFramerateLimit(0);
SYS.UseVerticalSync(0);
/* Declare clocks */
Clock SystemClock;
Clock ClockSeconds;
/* Load System Font */
Font System;
if(!System.LoadFromFile("systemfont.ttf"))
{
return EXIT_FAILURE;
}
String SystemFont("Frame Processing Time: 0.0000ms", System, 15.882f);
/* Load normal map */
Image *NormalMapImage = new Image;
NormalMapImage->LoadFromFile("normalmap.png");
/* Load shader */
PostFX *NormalMap = new PostFX;
NormalMap->LoadFromFile("normalmapping.sfx");
NormalMap->SetTexture("NormalMap", NormalMapImage);
int mouseX;
int mouseY;
// Test area
// Main loop
while(SYS.IsOpened())
{
/* Receive input */
Event Event;
while(SYS.GetEvent(Event))
{
/* Escape key pressed */
if( ( Event.Type == Event::KeyPressed ) && ( Event.Key.Code == Key::Escape ) ) { SYS.Close(); }
/* Mouse moved */
if( Event.Type == Event::MouseMoved ) { mouseX = Event.MouseMove.X; mouseY = Event.MouseMove.Y; }
}
/* Determine light positiong */
NormalMap->SetParameter( "lightPosition", float(mouseX), float(mouseY) );
/* Clear screen */
SYS.Clear( Color( 128, 128, 128 ) );
/* Render shader */
SYS.Draw(*NormalMap);
/* Render text */
SystemFont.SetColor(Color(0, 0, 0));
SystemFont.SetPosition(3,-3);
SYS.Draw(SystemFont);
SystemFont.SetColor(Color(255, 255, 255));
SystemFont.SetPosition(2,-4);
SYS.Draw(SystemFont);
/* Render buffer to screen */
SYS.Display();
/* Reset clock */
if ( ClockSeconds.GetElapsedTime() >= 0.5 )
{
SystemFont.SetText("Frame Processing Time: " + FloatToString( SystemClock.GetElapsedTime() * 1000 ) + "ms");
ClockSeconds.Reset();
}
Sleep( 1.000f / 60.000f - SystemClock.GetElapsedTime() );
SystemClock.Reset();
}
return EXIT_SUCCESS;
}
NORMALMAPPING.SFX (this doesn't actually normal map yet, it just renders the original texture)
texture NormalMap
vec2 lightPosition
effect
{
// Get the value of the current screen pixel
vec4 pixel = NormalMap(_in);
// ...
float red = pixel.r;
// ...
_out = vec4(pixel.r,pixel.g,pixel.b,255);
}