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 - thecheeselover

Pages: [1] 2
1
General / Re: Bug in CMake with MinGW-w64 GCC 8.1
« on: June 11, 2018, 12:46:02 am »
I confirm what you said. It works if I put one of my compilers bin directory in PATH. The order matters if there are many. It also works with the default (autodetected) compiler.

Thank you very much.

2
General / Bug in CMake with MinGW-w64 GCC 8.1
« on: June 10, 2018, 09:38:09 pm »
Using the MinGW-w64 compiler for GCC 8.1.0 (seh, posix), I tried to setup the Code::Blocks project from the source files of SFML 2.5.0.

  • I downloaded the code source for SFML 2.5.0 on my Windows 10 machine
  • I downloaded CMake GUI and set up the correct source path and output for generating the Code::Blocks  project (MinGW makefiles)
  • I checked the specify native compilers option
  • I then selected x86_64-w64-mingw32-gcc.exe for the C compiler and x86_64-w64-mingw32-g++.exe for the C++ compiler
  • An error would then popup after clicking ok, saying : "Error in configuration process, project files may be invalid"
  • In the log file, the error only says that gcc returned 1.

I tried the same thing but with the TDM GCC 5.1.0-3 64 bit compiler and got no errors.

Did I do something wrong or CMake or SFML CMake files have errors?

3
General / Re: Problem linking SFML 2.4 : skipping incompatible
« on: December 30, 2016, 10:25:21 pm »
Code::Blocks uses the linker that has been specified in the global compiler configuration. What I ask myself though, is whether you've added those 32-bit binaries or whether the compiler came with those already?

I installed the compiler and it is 64 and 32 bit capable. I do not know why Code::Blocks go for the 32 bit executable when the 64 bit executable is directly under his nose.

I figured soemthing out! I executed te command "objdump -f libsfml-system-s.a | grep ^architecture" and i386 printed, which means the libraries are 32 bit.

Yeah! I fixed the problem! :D Gosh I love this linux command "objdump -f libsfml-system-s.a | grep ^architecture". With this, I figured out that my MinGW w64 gcc 6.2 compiler was by default 32 bit. As sfml's cmake configuration doesn't support arguments for the compiler, I download the newest version of the compiler which is by surprise 64 bit by default.

Thanks everybody for the help! :)

4
General / Re: Problem linking SFML 2.4 : skipping incompatible
« on: December 30, 2016, 05:24:16 pm »
This sounds a lot like your linker is somehow finding a very old and outdated version of the library, because the latest 2.4 shouldn't use GLEW anymore. Have you tried linking with "-v" so you can see what it tries to link?

Oops, my bad ahah. I linked glew by habit.

i686 indicates that you're using a 32-bit compiler. The compiler family is called MinGW-w64, but they offer both 32 and 64-bit compilers.
So if you use a 32-bit compiler and try to link 64-bit SFML libraries it won't work.

Ok so the default gcc/g++ compilers were the 64 bits one.

Here's something I find weird : Code::Blocks uses ld.exe which is in the i686-w64-mingw32/bin folder instead of using ld.exe which is in bin/ld.exe... Look at the full log :

"D:/Compilers/MinGW/W64/x86_64-6.2.0-posix-sjlj-rt_v5-rev0/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.2.0/../../../../i686-w64-mingw32/bin/ld.exe: skipping incompatible D:\CodeBlocks Workspace\Do not touch\Librairies\SFML binaries\SFML-2.4.1\MinGW w64 gcc 6.2\Release\lib/libsfml-window-s.a when searching for -lsfml-window-s"

As eXpl0it3r said, i686 is 32 bit. Why does Code::Blocks move around twice to go find a 32 bit version of ld.exe when he's by default directly in the bin directory where everything is contained there in 64 bit?

5
General / Problem linking SFML 2.4 : skipping incompatible
« on: December 30, 2016, 07:05:06 am »
OS : Windows 7 64 bits
IDE : Code::Blocks 16.01
Compiler : MinGW w64 gcc 6.2

I'm trying to make an SFML 2.4 template in 64 bits. I successfully generated the and built SFML 2.4 from the source. I tried two different builds : one with gcc / g++ and the other one with i686-w64-mingw32-gcc / i686-w64-mingw32-g++.

My reasons for doing so is that I get this message in the build log : skipping incompatible .../libsfml-system-s.a when searching for sfml-system-s and other libraries. My IDE cannot find the sfml librairies and also fails to find glews32 (the later seems to be a different problem, as it does not have the same comment in the build log).

It seems that my 64 bits compiler compiles in 32 bits the sfml libraries. In Code::Blocks, I have to check the option "Target x86_64 (64bit) [-m64]" but I do not have this option while specifying the native compiler in cmake.

Could you help me please? :)
Thanks

6
Graphics / [ANSWERED] window.clear() unbinds my only texture
« on: June 06, 2015, 03:36:22 pm »
The title says it all: I don't understand why the call window.clear() unbinds the only texture I had binded. What I would like to do is load once a texture atlas and not have to do any bindings after that. If I bind my texture again just before the window.clear(), the texture gets black. If I bind my texture again just after the window.clear() then my texture looks perfectly fine.

I have done some tests: if I bind a texture once just after the window.clear() it appears for one frame. It is pretty clear that window.clear() does some unintended stuff.

Init:
void Core::Init()
{
    window = new sf::RenderWindow(sf::VideoMode(800, 600), "SFML works!");
    window->setVerticalSyncEnabled(true);
    window->setMouseCursorVisible(false);
    glewInit(); // Doit être appelé quand il y a un contexte OpenGL, donc après l'instanciation de la fenêtre.

    clock = new sf::Clock();
    camera = new CameraFreeRoaming (window, glm::vec3(0.0f, 5.0f, 5.0f), VecConst::ZERO_VEC3);

    glEnable(GL_TEXTURE_2D);

    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
    glDepthFunc(GL_LEQUAL);
    glDepthRange(0.0f, 1.0f);
    glClearDepth(1.0f);
}
 

Load:
void Core::Load()
{
    std::vector<ShaderSource> shaderSources =
        {ShaderSource("Resources/Test/Test_Tex_Shader.frag", ShaderType::FRAGMENT),
         ShaderSource("Resources/Test/Test_Tex_Shader.vert", ShaderType::VERTEX)};
    colorShader = new Shader(shaderSources);

    sf::Image img;

    if (img.loadFromFile("Resources/Test/cage.png"))
        std::cout << "Texture loaded" << std::endl;

    glGenTextures(1, &texture);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, texture);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); // GL_LINEAR_MIPMAP_LINEAR
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, img.getSize().x, img.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.getPixelsPtr());
    glGenerateMipmap(GL_TEXTURE_2D);

    colorShader->useProgram();

    glUniform1i(glGetUniformLocation(colorShader->program, "textureSampler"), 0); // 0 pour GL_TEXTURE0
    std::cout << gluErrorString(glGetError()) << std::endl;

    projectionMat = glm::perspective(glm::radians(60.0f), (float)window->getSize().x / (float)window->getSize().y, 0.001f, 1000.0f);

    glUniformMatrix4fv(glGetUniformLocation(colorShader->program, "ProjectionMatrix"), 1, GL_FALSE, &projectionMat[0][0]);
    glUniformMatrix4fv(glGetUniformLocation(colorShader->program, "ModelMatrix"), 1, GL_FALSE, &worldMatrix[0][0]); // Si location = -1 = aucune erreur; autre que -1, mais n'existe pas = erreur

    cube1 = new DrawBuffers(CubeDataGenerator::GenCube(DataGeneratorUsage::Position3 | DataGeneratorUsage::ColorRGBA | DataGeneratorUsage::TexCoord), BufferUsage::STATIC_DRAW, true);
    cube2 = new DrawBuffers(CubeDataGenerator::GenCube(DataGeneratorUsage::Position3 | DataGeneratorUsage::ColorRGBA | DataGeneratorUsage::TexCoord, 2.0f), BufferUsage::STATIC_DRAW, true);
    cube3 = new DrawBuffers(CubeDataGenerator::GenCube(DataGeneratorUsage::Position3 | DataGeneratorUsage::ColorRGBA | DataGeneratorUsage::TexCoord, 1.0f, 3.0f, 0.1f), BufferUsage::STATIC_DRAW, true);

    clock->restart();
}
 

Draw:
void Core::Draw()
{
    window->clear();
    glClear(GL_DEPTH_BUFFER_BIT);

    glBindTexture(GL_TEXTURE_2D, texture); // à cause de window.clear()

    colorShader->useProgram();
    glUniformMatrix4fv(glGetUniformLocation(colorShader->program, "ViewMatrix"), 1, GL_FALSE, &camera->getView()[0][0]);

    glm::vec3 v1 (0.0f, 0.0f, 0.0f);
    glm::vec3 v2 (3.0f, 0.0f, 0.0f);
    glm::vec3 v3 (6.0f, 0.0f, 0.0f);

    glUniformMatrix4fv(glGetUniformLocation(colorShader->program, "ModelMatrix"), 1, GL_FALSE, &glm::translate(worldMatrix, v1)[0][0]);
    cube1->draw();

    glUniformMatrix4fv(glGetUniformLocation(colorShader->program, "ModelMatrix"), 1, GL_FALSE, &glm::translate(worldMatrix, v2)[0][0]);
    cube2->draw();

    glUniformMatrix4fv(glGetUniformLocation(colorShader->program, "ModelMatrix"), 1, GL_FALSE, &glm::translate(worldMatrix, v3)[0][0]);
    cube3->draw();

    window->display();
}
 

7
Graphics / Re: Texture loading causes segfault at glDrawElements
« on: April 05, 2015, 12:10:13 am »
Interesting question you ask.
I used this neat little trick to test my texture coordinates and it does what I expected: it cuts 1/4 of the surface of each cube's face. If texture coordinates weren't properly sent to the shaders (i.e. always == (0,0)), then all faces would be invisible. To be able to see the cubes, I added to each texel vColor.

#version 330

uniform sampler2D textureSampler;

// Smooth
in vec4 vColor;
in vec2 vTexturePos;

out vec4 pixel;

void main()
{
    if (vTexturePos.x < 0.5f && vTexturePos.y < 0.5f)
        discard;

    pixel = texture(textureSampler, vTexturePos) + vColor;
}
 


EDIT: For some unknown reasons, my texture seems to be unbinded before my draw function. I juste did glBindTexture(GL_TEXTURE_2D, 1) and my Nicolas Cage image appeared. :P What's weird is that I never used glBindTexture in my engine... Anyway, a big thanks to you!

8
Graphics / Re: Texture loading causes segfault at glDrawElements
« on: April 04, 2015, 11:39:12 pm »
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, img.getSize().x, img.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.getPixelsPtr());

You mean when I used GL_BGRA? That was just for testing but thanks. (I tested many combinations ahah)

I have put
std::cout << gluErrorString(glGetError()) << std::endl;
in my draw loop and get no errors. What's really frustating is that I once had a texture rendered on my cubes.

Is my texture to sampler binding ok?

glGenTextures(1, &texture);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, texture);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, img.getSize().x, img.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.getPixelsPtr());
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glGenerateMipmap(GL_TEXTURE_2D);

    colorShader->useProgram();

    glUniform1i(glGetUniformLocation(colorShader->program, "textureSampler"), 0); // 0 pour GL_TEXTURE0

vertex shader
#version 330

uniform mat4 ProjectionMatrix;
uniform mat4 ViewMatrix;
uniform mat4 ModelMatrix;

uniform vec3 testVec3;

layout(location = 0) in vec4 inPosition;
layout(location = 1) in vec4 inColor;
layout(location = 2) in vec2 inTexturePos;

// Smooth
out vec4 vColor;
out vec2 vTexturePos;

void main()
{
        gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * inPosition;
        vColor = inColor;
        vTexturePos = inTexturePos;
}
 

fragment shader
#version 330

uniform sampler2D textureSampler;

// Smooth
in vec4 vColor;
in vec2 vTexturePos;

out vec4 pixel;

void main()
{
    pixel = texture(textureSampler, vTexturePos) * vColor;
}
 

9
Graphics / Re: Texture loading causes segfault at glDrawElements
« on: April 04, 2015, 11:04:58 pm »
I thought sampler objects were optional.  :o Are they mandatory since 4.x?

 glGenTextures(1, &texture);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, texture);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, img.getSize().x, img.getSize().y, 0, GL_BGRA, GL_UNSIGNED_BYTE, img.getPixelsPtr());
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glGenerateMipmap(GL_TEXTURE_2D);

    std::cout << gluErrorString(glGetError()) << std::endl;

    colorShader->useProgram();

    glUniform1i(glGetUniformLocation(colorShader->program, "textureSampler"), 0); // 0 pour GL_TEXTURE0

10
Graphics / Re: Texture loading causes segfault at glDrawElements
« on: April 04, 2015, 09:47:48 pm »
Just ask if you don't have enough code. I took the main parts of the engine.

#include <SFML/Graphics.hpp>
#include "Engine/Core/Core.h"

int main()
{
    { // Juste pour que le destructeur soit appelé avant la fin du main pour le cleanup.
        Core core;

        core.Init();
        core.Load();

        while (!core.requestCloseWindow)
        {
            core.HandleInput();

            core.Update();
            core.Draw();
        }

        core.Unload();
        core.window->close();
    }

    return 0;
}
 

#include <GL/glew.h>

#include "Core.h"
#include <SFML/OpenGL.hpp>
#include <glm/fwd.hpp>

void Core::Init()
{
    window = new sf::RenderWindow(sf::VideoMode(800, 600), "SFML works!");
    window->setVerticalSyncEnabled(true);
    window->setMouseCursorVisible(false);
    glewInit(); // Doit être appelé quand il y a un contexte OpenGL, donc après l'instanciation de la fenêtre.

    clock = new sf::Clock();
    camera = new CameraFreeRoaming (window, glm::vec3(0.0f, 5.0f, 5.0f), VecConst::ZERO_VEC3);

    glEnable(GL_TEXTURE_2D);

    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
    glDepthFunc(GL_LEQUAL);
    glDepthRange(0.0f, 1.0f);
    glClearDepth(1.0f);
}
 

#include "Core.h"
#include <string>
#include <vector>
#include "../Graphics/DrawBuffers.h"
#include "../Graphics/BufferUsage.h"
#include "../Graphics/CubeDataGenerator.h"
#include "../Graphics/Shader/ShaderType.h"
#include <iostream>

void Core::Load()
{
    std::vector<ShaderSource> shaderSources =
        {ShaderSource("Resources/Test/Test_Tex_Shader.frag", ShaderType::FRAGMENT),
         ShaderSource("Resources/Test/Test_Tex_Shader.vert", ShaderType::VERTEX)};
    colorShader = new Shader(shaderSources);

    sf::Image img;

    //window->pushGLStates();
    if (img.loadFromFile("Resources/Test/Google_Chrome_logo.png"))
        std::cout << "Texture loaded" << std::endl;
       
    glGenTextures(1, &texture);
    glBindTexture(GL_TEXTURE_2D, texture);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, img.getSize().x, img.getSize().y, 0, GL_BGRA, GL_UNSIGNED_BYTE, img.getPixelsPtr());
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glGenerateMipmap(GL_TEXTURE_2D);

    std::cout << gluErrorString(glGetError()) << std::endl;

    //window->popGLStates();

    /*glDisableClientState(GL_COLOR_ARRAY);
    glDisableClientState(GL_EDGE_FLAG_ARRAY);
    glDisableClientState(GL_FOG_COORD_ARRAY);
    glDisableClientState(GL_INDEX_ARRAY);
    glDisableClientState(GL_NORMAL_ARRAY);
    glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    glDisableClientState(GL_VERTEX_ARRAY);*/


    colorShader->useProgram();

    projectionMat = glm::perspective(glm::radians(60.0f), (float)window->getSize().x / (float)window->getSize().y, 0.001f, 1000.0f);

    glUniformMatrix4fv(glGetUniformLocation(colorShader->program, "ProjectionMatrix"), 1, GL_FALSE, &projectionMat[0][0]);
    glUniformMatrix4fv(glGetUniformLocation(colorShader->program, "ModelMatrix"), 1, GL_FALSE, &worldMatrix[0][0]); // Si location = -1 = aucune erreur; autre que -1, mais n'existe pas = erreur

    cube1 = new DrawBuffers(CubeDataGenerator::GenCube(DataGeneratorUsage::Position3 | DataGeneratorUsage::ColorRGBA | DataGeneratorUsage::TexCoord), BufferUsage::STATIC_DRAW, true);
    cube2 = new DrawBuffers(CubeDataGenerator::GenCube(DataGeneratorUsage::Position3 | DataGeneratorUsage::ColorRGBA | DataGeneratorUsage::TexCoord, 2.0f), BufferUsage::STATIC_DRAW, true);
    cube3 = new DrawBuffers(CubeDataGenerator::GenCube(DataGeneratorUsage::Position3 | DataGeneratorUsage::ColorRGBA | DataGeneratorUsage::TexCoord, 1.0f, 3.0f, 0.1f), BufferUsage::STATIC_DRAW, true);

    clock->restart();
}
 

#include "Core.h"
#include <SFML/OpenGL.hpp>

// Header file
#include <glm/fwd.hpp>
#include <glm/gtc/matrix_transform.hpp>

void Core::Draw()
{
    window->clear();
    glClear(GL_DEPTH_BUFFER_BIT);

    colorShader->useProgram();
    glUniformMatrix4fv(glGetUniformLocation(colorShader->program, "ViewMatrix"), 1, GL_FALSE, &camera->getView()[0][0]);

    glm::vec3 v1 (0.0f, 0.0f, 0.0f);
    glm::vec3 v2 (3.0f, 0.0f, 0.0f);
    glm::vec3 v3 (6.0f, 0.0f, 0.0f);

    glUniformMatrix4fv(glGetUniformLocation(colorShader->program, "ModelMatrix"), 1, GL_FALSE, &glm::translate(worldMatrix, v1)[0][0]);
    cube1->draw();

    glUniformMatrix4fv(glGetUniformLocation(colorShader->program, "ModelMatrix"), 1, GL_FALSE, &glm::translate(worldMatrix, v2)[0][0]);
    cube2->draw();

    glUniformMatrix4fv(glGetUniformLocation(colorShader->program, "ModelMatrix"), 1, GL_FALSE, &glm::translate(worldMatrix, v3)[0][0]);
    cube3->draw();

    window->display();
}
 

11
Graphics / Re: Texture loading causes segfault at glDrawElements
« on: April 04, 2015, 09:09:21 pm »
Okay that was useful, thanks. :) I played a lot with texture and was able to render the textures. Somehow, I was too confident of myself and didn't save my progress to continue toying with texture. Now I'm back with the black texture... At least, now it's not giving a segfault.

Mostly take from: https://www.opengl.org/wiki/Common_Mistakes#Creating_a_complete_texture
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, img.getSize().x, img.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.getPixelsPtr());
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);

I also tried this with no success.

glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
    // gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, img.getSize().x, img.getSize().y, GL_RGBA, GL_UNSIGNED_BYTE, img.getPixelsPtr());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // Avant sampler object
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Avant sampler object
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // Avant sampler object
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Avant sampler object
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.getSize().x, img.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.getPixelsPtr());

Do you have any idea what's cause the black texture?

12
I'm currently making a little modern OpenGL engine just learn new stuff. I use VBOs, IBOs and VAOs to render primitives on the screen using glDrawElements. When I draw simple cubes with only colors as shader attributes, everything works fine. I tried to draw those same cube with texture and then BAM! The program crashes at glDrawElements only if I call texture->loadFromFile(). I searched a lot and found that OpenGL's client states might be the cause, so I disabled them all before drawing, but nothing changed:

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_EDGE_FLAG_ARRAY);
glDisableClientState(GL_FOG_COORD_ARRAY);
glDisableClientState(GL_INDEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

Then I found the pushGLStates() and popGLStates() functions and used them between the loadFromFile(). If I draw my cubes with the equate ''texel + color" (+ instead of *) then I can see my cubes but with no texture, only color. If I just use texture coordinates and positions, everything is black. How can make texture loading and rendering work with OpenGL and SFML 2.2?

//window->pushGLStates();
if (texture->loadFromFile("Resources/Test/cage.png"))
    std::cout << "Texture loaded" << std::endl;

sf::Texture::bind(texture);
//window->popGLStates();

glBindVertexArray(vao);
glDrawElements(GL_TRIANGLES, indicesCount, GL_UNSIGNED_INT, nullptr);

Thanks!  :)

13
Ok that's was really hard to find but, I guess that after installing multiple compilers, my PATH variable got mixed up. What happened is that CB's MinGW default compiler has been replaced by a TDM compiler. When I was using CMake, I was checking "Use default native compilers" when I should have given the old MinGW's g++ and gcc path. Now it works! :)

14
Quote
If you check SFML_BUILD_EXAMPLES when building SFML, do you get errors?

Nope, because I checked SFML_BUILD_DOC, SFML_BUILD_EXAMPLES and SFML_USE_STATIC_STD_LIBS. I remember that checking BUILD_SHARED_LIBS and SFML_USE_STATIC_STD_LIBS at the same times provoked errors, so I uncheked BUILD_SHARED_LIBS. Anyway, I don't want any dll; I just want static librairies.

Quote
Are you absolutely certain that you're using the right libraries and Code::Blocks doesn't suddenly find other SFML libraries?
Actually, I'm unsure. All the paths I use point to the new SFML 2.2, but is there a way they could point to an old SFML? :O For example, if SFML is in the PATH?

EDIT: I tried sfml-graphics-s-d and everything with absolute paths but nothing changes.

Quote
And last but not least, if you build the install target for static SFML, SFML's dependencies will get automatically copied to the lib and include directories, so you don't have to add the paths to the extlibs dir.

Hmmm it doesn't do that for me...

15
    I have followed the newest SFML 2.2 tutorial to build/compile SFML and link it to my project(s). So I built SFML 2.2 in debug and release mode for MinGW 32 bit (gcc 4.7.1) and it worked just fine as my 64 bit release builds (MinGW 64 gcc 4.9.0, TDM 64 gcc 4.8.1 and TDM 64 gcc 4.9.2). The .a files seemed to work just fine until I tried the simple example for drawing a green circle. I have no bugs in 64 bit with either of my compilers but when I'm in 32 bit with MinGW gcc 4.7.1, I get "undefined references at every line".

    Here's my build log:
(click to show/hide)

How my linking process work is that I link every optional libraries at the end of each build target, except for glew  because in 64 bit its name is glew32 (wtf Microsoft...). Then, in each build target, I add the respective link to each sfml libraries. For example, if it's a debug target, then I add -d but they all have -s. Also, depending on the architecture, I give the search directories for the linker:

    32 bit
    • extlibs\bin\x86
    • cmake build\Debug\lib\MinGW 32 (SFML 2.2 source I built myself)
    • extlibs\libs-mingw\x86
    64 bit
    • extlibs\bin\x64
    • cmake build\Release\lib\MinGW 64 (SFML 2.2 source I built myself, MinGW 64 is an example)
    • extlibs\libs-mingw\x64

    TL;DR
    64 bit works fine, 32 bit doesn't work. The only differences are glew and searching directories. Everything except the external libraries is compiled by myself.
[/list]

Pages: [1] 2
anything