Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - cooldog99

Pages: 1 [2] 3 4 ... 7
16
There is a whole section of subforums with the title HELP, please read the forum descriptions before posting.

erm. Whoops. Somehow managed to click wrong link  :-[

can someone move this? haha
Thank you!

17
Hey again guys!
I need more help :(

I recently started playing with QT, and having ALOT of fun with it vs .Net.

however, I wanted to make a nice level editor with it, using SFML.
I tried to follow the 1.6 tutorial for SFML and QT, but with SFML 2.0 and ran into issues with an ambiguous call to create function from renderWindow, and QTWidget, so I made a small wrapper class for SFML renderwindow that called the create function with a different name. Fixed that issue, however the program doesn't run, only says: "Program exited unexpectedly".

Other than that my code is identical to SFML 1.6 QT tutorial.

Is there any sample project I can see to setup SFML with QT creator? I can't find an example project with SFML 2.0rc :/

Thanks.

18
SFML projects / Re: Gage - Gauntlet throwback game!
« on: August 28, 2012, 06:31:29 pm »
We've had a menu for a long time now, but I decided to "pretty" it up a little. :)

Here's it's current state, only two buttons work (obviously shown)
Will work on cool animations for it soon too! :D



We have also fading splash/intro screens, but those aren't anything to show off :p
Also I know the menu Background doesn't fit, until I can make a good pixel artsie one, it'll have to do :(

19
SFML projects / Re: Gage - Gauntlet throwback game!
« on: August 25, 2012, 04:04:36 am »
These transparent upper walls are really bad for screen readability. It looks hard to be sure about where the walls truly are.
Can you jump?

They're still being tweaked.
And no, not right now, but it's considered.

20
SFML projects / Re: Gage - Gauntlet throwback game!
« on: August 24, 2012, 03:55:24 pm »
Some more progress!

First spell started: Fireball (Will be many more).

First item added, Key. Used to unlock certain doors (delete/modify world blocks).
Key may not stay, we don't want to DIRECTLY copy from gauntlet ;) but it's fun to play with.

Better Collision. (Still needs work) all the blocks in red are collision blocks.

More tiles :D

Player now moves evenly in all 8 directions.

And more stuff I forgot!

Preview Image:

21
SFML projects / Re: Gage - Gauntlet throwback game!
« on: August 15, 2012, 04:53:20 pm »
We can't reveal any just yet ;)
Okay so I'll make sure to check back here later. :)

Btw. is your website sind some sort of construction or is there something else wrong that I only get a white screen, which actually has an iframe but the linked site is white again. ;)

Site is down for now, until we get content for it, heh.

22
SFML projects / Re: Gage - Gauntlet throwback game!
« on: August 15, 2012, 04:27:26 pm »
Wow this looks really great! :)

Do you have already more information on the RPG elements and the backstory or is this still concealment? ;)

For all those that don't know what Gauntlet looked/looks like here you go:


We can't reveal any just yet ;)

Thank you, btw :D

We don't know how much of "gauntlet" will be in the final version, but it is directly inspired by it, so you should be able to notice it :)

23
SFML projects / Gage - Gauntlet throwback game!
« on: August 15, 2012, 04:13:57 pm »
Hello awesome peeps of SFML community!
I'm here to present the newest project of Perilous Game Studios:
"Gage"

It's an isometric 2D throwback of the popular classic game, "Gauntlet".
Yes, the REALLY old one!

Who didn't love gauntlet? :)

It will be isometric, and have more RPG elements than gauntlet did, with a nice backstory to it ^^

Here is it's most recent preview:


What it's currently got:
Working level editor, loading/saving, with a layering system.
basic Collision.
Simple lighting system.
Block hiding. (if you're under a block that is "above" the player, it'll become slightly transparent so you can see where you're going!)
basic moving, with joystick support(no reason at all xD)
working Menu/Splash screen system.
full LUA integration.
and some more stuff!

The only thing in the picture we didn't make is the player sprite, everything else is made by me(I'm not that good at pixel art :/ )

Let me know what you think!
I'll update this post with more stuff later.

24
General / Re: Drawing 3D Geometry (Vertex Arrays/VBOs)
« on: July 19, 2012, 02:31:59 pm »
I've been using sf::Shaders with my program without any issue, and as I remember SFML shaders are just GLSL shaders, with easier implementation.

basic VBO example:

::Header::
typedef struct{
    float x,y,z
}Vertex;

Vertex * Vertices;
GLuint myVBOID;
 

Init

Vertices = new Vertex[3]; // Size of 1 triangle
//basic triangle

Vertices[0].x = 0.f;
Vertices[0].y = 0.f;
Vertices[0].z = 0.f;

Vertices[1].x = 1.f;
Vertices[1].y = 0.f;
Vertices[1].z = 0.f;

Vertices[2].x = 1.f;
Vertices[2].y = 1.f;
Vertices[2].z = 0.f;

glGenBuffers(1, &myVBOID);
glBindBuffer(myVBOID);
glBufferData(GL_ARRAY_BUFFER, 3 * 3 * sizeof(float), Vertices, GL_STATIC_DRAW);
delete [] Vertices;
 

Drawing
glBindBuffer(myVBOID);
     glEnableClientState(GL_VERTEX_ARRAY);
     glVertexPointer(3, GL_FLOAT, 0, (char *) NULL);
     glDrawArrays(GL_TRIANGLES, 0, 3);
     glDisableClientState(GL_VERTEX_ARRAY);
 

Disposing
        if (Vertices != NULL)
                delete[] Vertices;
glDeleteBuffers(1, &myVBOID);
 

That's a basic triangle using VBO's

25
Window / Re: openGL issue, came with update to sfml2.
« on: July 18, 2012, 05:30:16 pm »
You are still testing with too much stuff going on. When I wrote the SFGUI VBO renderer crap loads of stuff was displaying wrong when the initial code was done. I just switched everything off (texturing, lighting, coloring, depth testing, alpha testing, blending etc.) and also commented out the places where the VBO data is written to the buffer. Instead I hardcoded a simple triangle into the VBO with simple coordinates so I could verify that it was drawing at the right location with the right size. If the triangle is anything but pure white then you already know that something else is messing up with your state management (be it texturing, color data or whatever). You would have to find out what that thing is and rectify that. After you are sure your code and the results match up you can proceed to activating coloring again and see if that produces the expected results. If not repeat the same procedure. Then on to texturing. When that all works you can start to test with 2 triangles, then 3 and see if it produces the expected results. Then you should be able to use your generated geometry again and if all those previous cases were successful your landscape geometry should also render properly. If not you know that you messed something up in the generation of the geometry VBO data and you can search for the problem there.

Thanks for the help so far, it's been great :)

I managed to get the textures AND colors working perfectly now, :D

My last and final problem is...getting 2D to draw again.


Basically what happens when I try to glPush/Pop OR Screen Push/pop around the SFML drawing part, the following happens:

Everything is rendered normal first until I move, then the scene is rendered the clear color (gray), and the movement updating goes whack, terrain still renders, but skybox stops.

and no 2d rendering.

Code I changed was basically just some things in the update code, and added a color VBO:
Modified Main Loop
                        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
                        //glPushMatrix();
                        glMatrixMode(GL_PROJECTION);
                        glLoadIdentity();
                        gluPerspective(60.f, (float)Screen->getSize().x / (float)Screen->getSize().y, 0.1f, 5000.f);

                        this->Update();
                        glMatrixMode(GL_MODELVIEW);
                        glPushMatrix();
                        terrain.Draw(&Graphics, &myPos);

                        glPopMatrix();
                        glPushMatrix();
                        Screen->resetGLStates();
                                myDebugText.setString(sf::String("FPS: " + ConvertToString((int)(1.f / FPSCounter.getElapsedTime().asSeconds()))));
                                Screen->draw(myDebugText);
                        glPopMatrix();
                        Screen->display();
 


And is there any documentation on using Shaders from SFML with openGL? I'd love to start delving in Shaders :D

26
Window / Re: openGL issue, came with update to sfml2.
« on: July 17, 2012, 03:55:47 pm »
I tried to read through your code, but it is too long, code highlighting is disabled (use the code=cpp tag to enable highlighting) and some things are a bit complicated, which is normal when using VBOs. Your best bet is to make a copy of your project and comment out stuff until the SFML text shows up again. Does the trick for me all the time.

When debugging stuff using VBOs I also normally don't load such complex geometry when trying to debug draw problems. Try drawing flat terrain (1 Quad with 4 vertices or 1 Triangle with 3 vertices) and see what happens.

You could also try calling your SFML stuff in between Screen->pushGLStates() and Screen->popGLStates().

grassTexture.bind(sf::Texture::Pixels);
Are you sure this necessary? Since you use the full texture all the time you can just use 0.0 and 1.0 in Normalized mode instead of the width/height of the texture in Pixel mode.

I'm such a openGL noob :(, any openGL tips is GREATLY appreciated!
I normally also provide color data to OpenGL when using VBOs. If you apply a texture to something, the color of the texture is modulated (fancy multiplication) with the active color of the fragment. If it is anything other than white (1*something=something) then you will get colors different from the ones in your texture.

Another day of hunting down the problem, to no avail :(

Putting my code in between Screen->push/pop doesn't work, well.

it renders all my vertices one solid color (green), until I move, then the screen goes dark gray(clear color).

GRRR.

27
Window / Re: openGL issue, came with update to sfml2.
« on: July 16, 2012, 07:04:06 pm »
I tried to read through your code, but it is too long, code highlighting is disabled (use the code=cpp tag to enable highlighting) and some things are a bit complicated, which is normal when using VBOs. Your best bet is to make a copy of your project and comment out stuff until the SFML text shows up again. Does the trick for me all the time.

When debugging stuff using VBOs I also normally don't load such complex geometry when trying to debug draw problems. Try drawing flat terrain (1 Quad with 4 vertices or 1 Triangle with 3 vertices) and see what happens.

You could also try calling your SFML stuff in between Screen->pushGLStates() and Screen->popGLStates().

grassTexture.bind(sf::Texture::Pixels);
Are you sure this necessary? Since you use the full texture all the time you can just use 0.0 and 1.0 in Normalized mode instead of the width/height of the texture in Pixel mode.

I'm such a openGL noob :(, any openGL tips is GREATLY appreciated!
I normally also provide color data to OpenGL when using VBOs. If you apply a texture to something, the color of the texture is modulated (fancy multiplication) with the active color of the fragment. If it is anything other than white (1*something=something) then you will get colors different from the ones in your texture.

I tried the different bind settings and coordinates, nothing.

also, I DID pass a color VBO alongside the vertices, but nothing changed so I removed.

i'll try removing things until sfml shows back up, but the code posted is as minimal as I can get, with random stuff removed (other than timer).

EDIT: apparently this section of code in Terrain::Draw is causing the sfml draw problem.

        glGenBuffers(1, &VBOverticeID);
        glBindBuffer(GL_ARRAY_BUFFER, VBOverticeID);
        glBufferData(GL_ARRAY_BUFFER, VertexCount * 3 * sizeof(float), vertices, GL_STATIC_DRAW);

        glGenBuffers(1, &VBOtexcoordsID);
        glBindBuffer(GL_ARRAY_BUFFER, VBOtexcoordsID);
        glBufferData(GL_ARRAY_BUFFER, VertexCount * 2 * sizeof(float), texcoords, GL_STATIC_DRAW);
 

28
Window / Re: openGL issue, came with update to sfml2.
« on: July 16, 2012, 06:19:28 pm »
Quote
glBindTexture(GL_TEXTURE_2D, 1);
What is this "1"? You're supposed to bind one of the texture identifiers that you generated previously (stored in myTextures).

Quote
Thanks to my work on the SFGUI renderer I know that texture coordinates in SFML are pixel-based a.k.a. not normalized (between 0 and 1) most of the time. If you want to use normalized texture coordinates in your application alongside other SFML drawing you mustn't forget [...]
This applies only in the special case of manual optimization. The expected behaviour when mixing SFML and OpenGL is to call the pushGLStates/popGLStates functions, which ensure that there's no state conflict.

That wasn't always like that, even with it proper, still had problems. However I just ended up using Texture.bind() with my loaded textures.

HOWEVER new problem i'm having, and I don't know where else to post, sorry if this is the wrong place, but I figured it's better than a new thread o.o

I transferred my terrain code, to a VBO, and it loads/renders the triangles perfectly. But with Random colors.

Texture is off, but I bet that's just my math, the colors stumped me.

no matter what I change, the color on each triangle is always random, even with a texture on it.

AND on top of that, my SFML 2d code no longer renders!

Updated Code Snips:

Update Code
                while (isRunning){
                        sf::Event _Evn;
                        while (Screen->pollEvent(_Evn)){
                                if (_Evn.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
                                        isRunning = false;
                                if (_Evn.type == sf::Event::Resized)
                                        glViewport(0, 0, _Evn.size.width, _Evn.size.height);
                                if (_Evn.type == sf::Event::KeyPressed){
                                        if (sf::Keyboard::isKeyPressed(sf::Keyboard::F2))
                                        {
                                                switch (FLY_MODE){
                                                case 0:
                                                        FLY_MODE = 1;
                                                        break;
                                                case 1:
                                                        FLY_MODE = 0;
                                                        break;
                                                }
                                        }
                                        if (sf::Keyboard::isKeyPressed(sf::Keyboard::F3))
                                                terrain.ReloadHeightMap();
                                }
                        }
                        oldMouse = sf::Mouse::getPosition(*Screen);
                        sf::Mouse::setPosition(sf::Vector2i(Screen->getSize().x / 2, Screen->getSize().y / 2), *Screen);
                        newMouse = sf::Mouse::getPosition(*Screen);
                       
                        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Same as SFML clear, but with some Buffering ;)
                        //glPushMatrix();
                        glMatrixMode(GL_PROJECTION);
                        glLoadIdentity();
                        gluPerspective(90.f, 800.f / 600.f, 0.1f, 500.f);

                        this->Update();
                        terrain.Draw(&Graphics, &myPos);
                        Screen->resetGLStates();
                        myDebugText.setString(sf::String("FPS: " + ConvertToString((int)(1.f / FPSCounter.getElapsedTime().asSeconds()))
                                + "\nRotation: " + ConvertToString(myRot.y)
                                + "\nPosition: (" + ConvertToString(myPos.x) + ", " + ConvertToString(myPos.y) + ", " + ConvertToString(myPos.z) + ")"                         
                                ));
                        Screen->draw(myDebugText);
                        Screen->display();

                        if (Ticker.getElapsedTime().asSeconds() > 1 )
                        {
                                std::cout << "FPS: " << (int)(1.f / FPSCounter.getElapsedTime().asSeconds()) << std::endl;
                                Ticker.restart();
                        }

                        FPSCounter.restart();
                }
 

terrain .h file

typedef struct{
    float x, y, z;
}Vertex;

typedef struct{
    float u, v;
}TextureCoord;

class Terrain{
private:
        Vertex * vertices;
        TextureCoord * texcoords;
        GLuint VBOverticeID;
        GLuint VBOtexcoordsID;
        int VertexCount;
        int myWidth;
        int myHeight;
        float Scale;
        sf::Clock timer;
        sf::Texture grassTexture;
        int myRenderStyle;
public:
        Terrain(){
                vertices = NULL;
                texcoords= NULL;
        }
        ~Terrain(){
                if (vertices != NULL)
                        delete[] vertices;
                if (texcoords != NULL)
                        delete [] texcoords;
                vertices = NULL;
                texcoords = NULL;
        }
        void Smooth(float k);
        void SetTexture(GLuint * texture);
        void Draw(Texture_Controller * graphics, sf::Vector3f *PlayerPos); //graphics holds textures
        void LoadHeightMap(Texture_Controller * graphics, std::string Map);
        void GenerateHeightMap(int sizeX, int sizeZ);
        void ReloadHeightMap();
        void Dispose();
};
 

terrain.Draw Code
        glPushMatrix();
        //glPolygonMode ( GL_FRONT_AND_BACK , GL_LINES ) ;
        glEnable(GL_DEPTH_TEST);
        glDisable(GL_LIGHTING);
        glEnableClientState(GL_TEXTURE_COORD_ARRAY);
                glEnable(GL_TEXTURE_2D);
                grassTexture.bind(sf::Texture::Pixels);
                glBindBuffer(GL_ARRAY_BUFFER, VBOtexcoordsID);
                glTexCoordPointer(2, GL_FLOAT, 0, (char *) NULL);
                glEnableClientState(GL_VERTEX_ARRAY);
                        glBindBuffer(GL_ARRAY_BUFFER, VBOverticeID);
                        glVertexPointer(3, GL_FLOAT, 0, (char *) NULL);
                        glDrawArrays(GL_TRIANGLES, 0, VertexCount);
                glDisableClientState(GL_VERTEX_ARRAY);
        glDisableClientState(GL_TEXTURE_COORD_ARRAY);
        glPopMatrix();
 

Terrain Loading Code
void Terrain::GenerateHeightMap(int sizeX, int sizeZ){
        myWidth = sizeX;
        myHeight = sizeZ;
        const int MAPSIZE = sizeX * sizeZ * 6;
        vertices = new Vertex[MAPSIZE];
        texcoords = new TextureCoord[MAPSIZE];
        VertexCount = MAPSIZE;
        float Amp = Randomizer::Random(0.0f, 3.5f);
        float Freq = 0.04f;
        int RandomSeed = Randomizer::Random(-500, 500);
        int Octaves = Randomizer::Random(3, 10);
        if (grassTexture.getSize().x <= 0)
                grassTexture.loadFromFile("Textures/grass.jpg");
        if (vertices != NULL){
                int hmWidth = sizeX;
                int hmHeight = sizeZ;
                PerlinNoise PN(0.2f, Freq, Amp, Octaves, RandomSeed );
                int index = 0;
                for (int hMapX = 0; hMapX < hmWidth; hMapX++){
                        for (int hMapZ = 0; hMapZ < hmHeight; hMapZ++){

                                for (int nTri = 0; nTri < 6; nTri++){                                  
                                        float flX = (float)hMapX + ((nTri == 1 || nTri == 2 || nTri == 5) ? 1 : 0);
                                        float flZ = (float)hMapZ + ((nTri == 2 || nTri == 4 || nTri == 5) ? 1 : 0);
                                        double height = PN.GetHeight(flX, flZ) * 45.f;
                                        vertices[index].x = flX;
                                        vertices[index].y = height;

                                        vertices[index].z = flZ;
                                        texcoords[index].u = 0.f;
                                        texcoords[index].v = 0.f;
                                        if (nTri == 0 || 3){
                                                texcoords[index].u = 0.f;
                                                texcoords[index].v = 0.f;
                                        }//
                                        if (nTri == 1 || 4){
                                                texcoords[index].u = grassTexture.getSize().x;
                                                texcoords[index].v = 0.f;
                                        }
                                        if (nTri == 2 || 5){
                                                texcoords[index].u = grassTexture.getSize().x;
                                                texcoords[index].v = grassTexture.getSize().y;
                                        }      

                                        float Light = 30.f / height;
                                        if (Light > 1.f) Light = 1.f;
                                        if (Light < 0.f) Light = 0.f;
                                        index++;
                                }
                        }
                }
                this->Smooth(0.90f);
        }

        Scale = 3.5f;
        glGenBuffers(1, &VBOverticeID);
        glBindBuffer(GL_ARRAY_BUFFER, VBOverticeID);
        glBufferData(GL_ARRAY_BUFFER, VertexCount * 3 * sizeof(float), vertices, GL_STATIC_DRAW);

        glGenBuffers(1, &VBOtexcoordsID);
        glBindBuffer(GL_ARRAY_BUFFER, VBOtexcoordsID);
        glBufferData(GL_ARRAY_BUFFER, VertexCount * 2 * sizeof(float), texcoords, GL_STATIC_DRAW);

        delete [] vertices;
        delete [] texcoords;
        vertices = NULL;

        texcoords = NULL;
}
 

GLEW init code
void InitGLEW(){
        glewInit();
        glGenBuffers = (PFNGLGENBUFFERSARBPROC) wglGetProcAddress("glGenBuffers");
        glBindBuffer = (PFNGLBINDBUFFERARBPROC) wglGetProcAddress("glBindBuffer");
        glBufferData = (PFNGLBUFFERDATAARBPROC) wglGetProcAddress("glBufferData");
        glDeleteBuffers = (PFNGLDELETEBUFFERSARBPROC) wglGetProcAddress("glDeleteBuffers");
}
 

openGL init Code
Code: [Select]
void Init_OpenGL(void){
glClearDepth(1.f);
glClearColor(0.1f, 0.1f, 0.1f, 0.f);
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(90.f, 800.f / 600.f, 0.1f, 500.f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
std::cout << "You are running openGL Version: " << glGetString(GL_VERSION) << std::endl;
InitGLEW();
glColor4f(1.f, 1.f, 1.f, 1.f);
}

Any other code is the same as previously posted.

What am I doing wrong!?

Screenshot of problem:
http://img171.imageshack.us/img171/3222/examplexa.png

I'm such a openGL noob :(, any openGL tips is GREATLY appreciated!

29
Window / Re: openGL issue, came with update to sfml2.
« on: July 12, 2012, 01:31:00 am »
Wow, I completely forgot about Textures having Bind()
That made it work, nice!

Thank you, sooo much.


30
Window / openGL issue, came with update to sfml2.
« on: July 11, 2012, 11:53:47 pm »
I had made a simple 3d engine, about a month or two before the big Graphics update for SFML2, and just recently revived it, and started working on it, when I had a problem with the openGL side..

Two variables changed since, SFML and my computer.

Basically, here is the issue.

Textures.
I know i'm supposed to call glBindTexture BEFORE glBegin, not Between glBegin/glEnd
However, if I DON'T put it in between, textures are white.
If I DO put it in between, they show...badly.

it didn't do this before I updated my computer/sfml.

is there something wrong with my code?
Setting up the window...
Code: [Select]
int main(){
sf::ContextSettings Settings;
Settings.depthBits         = 24; // Request a 24 bits depth buffer
Settings.stencilBits       = 8;  // Request a 8 bits stencil buffer
Settings.antialiasingLevel = 2;  // Request 2 levels of antialiasing

sf::RenderWindow Window(sf::VideoMode(800, 600, 32), "PeriLib", sf::Style::Close, Settings);
Base_Controller Engine;
Engine.SetWindow(&Window);
return Engine.Run();
}
my texture variables (temporary, was testing for the problem)
Code: [Select]
GLuint skyboxfront;
GLuint skyboxback;
GLuint skyboxtop;
GLuint skyboxbottom;
GLuint skyboxright;
GLuint skyboxleft;

Loading Textures
Code: [Select]
GLuint Texture1; // UNIQUE texture number, every texture is last texturenum + 1! e.x Texture2 = 1, Texture3 = 2
sf::Image Image;
Image.loadFromFile(Path);
glGenTextures(1, &Texture1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, Image.getSize().x, Image.getSize().y, GL_RGBA, GL_UNSIGNED_BYTE, Image.getPixelsPtr());
myUniqueCounter++;
myTextures.push_back(Texture1); // Add texture to vector!
std::cout << "New texture added!" << " : " << myTextures.size() - 1 << std::endl;
return Texture1;

Storing Textures
Code: [Select]
skyboxfront = Graphics.AddTexture("skybox_front.png");
skyboxleft = Graphics.AddTexture("skybox_left.png");
skyboxback = Graphics.AddTexture("skybox_back.png");
skyboxright = Graphics.AddTexture("skybox_right.png");
skyboxtop = Graphics.AddTexture("skybox_top.png");
skyboxbottom = Graphics.AddTexture("skybox_bottom.png");


Init openGL settings
Code: [Select]
void Init_OpenGL(void){
glClearDepth(1.f);
glClearColor(0.7f, 0.7f, 0.9f, 0.f);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(90.f, 800.f / 600.f, 1.f, 500.f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); //Lets openGL render a little nicer, at the expense of CPU usage.
std::cout << "You are running openGL Version: " << glGetString(GL_VERSION) << std::endl;
}

Main Loop
Code: [Select]
while (isRunning){
sf::Event _Evn;
while (Screen->pollEvent(_Evn)){
if (_Evn.type == sf::Event::Closed)
isRunning = false;
if (_Evn.type == sf::Event::Resized)
glViewport(0, 0, _Evn.size.width, _Evn.size.height);
}

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Same as SFML clear, but with some Buffering ;)
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, 800.f / 600.f, 1.f, 500.f);
this->Update(); //Draw skybox is called here!
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
this->Draw(); //Other models.
Screen->display();
}
Screen->close();
}

Drawing skybox (textures are REALLY blurry)
I disable a few things here, to get the Skybox effect, that part works, but the textures do not!
Code: [Select]
       glEnable(GL_TEXTURE_2D);
        glDisable(GL_DEPTH_TEST);
        glDisable(GL_LIGHTING);
        glDisable(GL_BLEND);
float halfSize = 50.f;
        // Render the front quad
glColor3f(1.f, 1.f, 1.f);
float EndCoordinate = 1;
glBindTexture(GL_TEXTURE_2D, 1);
        glBegin(GL_QUADS);

            glTexCoord2f(0, 0); glVertex3f(  halfSize, -halfSize, -halfSize );
            glTexCoord2f(EndCoordinate, 0); glVertex3f( -halfSize, -halfSize, -halfSize );
            glTexCoord2f(EndCoordinate, EndCoordinate); glVertex3f( -halfSize,  halfSize, -halfSize );
            glTexCoord2f(0, EndCoordinate); glVertex3f(  halfSize,  halfSize, -halfSize );
        glEnd();
     
        // Render the left quad
        glBindTexture(GL_TEXTURE_2D, 2);
        glBegin(GL_QUADS);

            glTexCoord2f(0, 0); glVertex3f(  halfSize, -halfSize,  halfSize );
            glTexCoord2f(EndCoordinate, 0); glVertex3f(  halfSize, -halfSize, -halfSize );
            glTexCoord2f(EndCoordinate, EndCoordinate); glVertex3f(  halfSize,  halfSize, -halfSize );
            glTexCoord2f(0, EndCoordinate); glVertex3f(  halfSize,  halfSize,  halfSize );
        glEnd();
   
        glBindTexture(GL_TEXTURE_2D, 3);
        glBegin(GL_QUADS);

            glTexCoord2f(0, 0); glVertex3f( -halfSize, -halfSize,  halfSize );
            glTexCoord2f(EndCoordinate, 0); glVertex3f(  halfSize, -halfSize,  halfSize );
            glTexCoord2f(EndCoordinate, EndCoordinate); glVertex3f(  halfSize,  halfSize,  halfSize );
            glTexCoord2f(0, EndCoordinate); glVertex3f( -halfSize,  halfSize,  halfSize );
     
        glEnd();
     
        // Render the right quad
        glBindTexture(GL_TEXTURE_2D, 4);
        glBegin(GL_QUADS);

            glTexCoord2f(0, 0); glVertex3f( -halfSize, -halfSize, -halfSize );
            glTexCoord2f(EndCoordinate, 0); glVertex3f( -halfSize, -halfSize,  halfSize );
            glTexCoord2f(EndCoordinate, EndCoordinate); glVertex3f( -halfSize,  halfSize,  halfSize );
            glTexCoord2f(0, EndCoordinate); glVertex3f( -halfSize,  halfSize, -halfSize );
        glEnd();
     
        // Render the top quad
        glBindTexture(GL_TEXTURE_2D, 5);
        glBegin(GL_QUADS);

            glTexCoord2f(0, 0); glVertex3f( -halfSize,  halfSize, -halfSize );
            glTexCoord2f(EndCoordinate, 0); glVertex3f( -halfSize,  halfSize,  halfSize );
            glTexCoord2f(EndCoordinate, EndCoordinate); glVertex3f(  halfSize,  halfSize,  halfSize );
            glTexCoord2f(0, EndCoordinate); glVertex3f(  halfSize,  halfSize, -halfSize );
        glEnd();
     
        // Render the bottom quad
        glBindTexture(GL_TEXTURE_2D, 6);
        glBegin(GL_QUADS);

            glTexCoord2f(0, 0); glVertex3f( -halfSize, -halfSize, -halfSize );
            glTexCoord2f(EndCoordinate, 0); glVertex3f( -halfSize, -halfSize,  halfSize );
            glTexCoord2f(EndCoordinate, EndCoordinate); glVertex3f(  halfSize, -halfSize,  halfSize );
            glTexCoord2f(0, EndCoordinate); glVertex3f(  halfSize, -halfSize, -halfSize );
        glEnd();
        glEnable(GL_DEPTH_TEST);
        //glDisable(GL_LIGHTING);
       
glEnable(GL_BLEND);

I'm fairly new to openGL, so excuse any noob mistakes :p

I'm thoroughly stumped, but i'm sure it's just my fault...
I posted in the SFML window forum because i'm not 100% sure what the issue is, I just know it happened after I switched SFML versions from 1.6 -> 2.0

Did I miss a change in SFML 2 that affects openGL?

Pages: 1 [2] 3 4 ... 7
anything