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.


Topics - thecheeselover

Pages: [1]
1
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?

2
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

3
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();
}
 

4
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!  :)

5
    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]

6
General / [Answered] SFML 2.2 and 64 bit opengl32
« on: January 04, 2015, 03:44:51 am »
I've built SFML 2.2 for multiple 64 bit compilers but I just noticed that it links opengl32. By default, opengl32 is a 32 bit dll. First of, does it mean I need to put the shared library in my bin folder or linking statically SFML fixes that? Also, in the cmake files, sfml only links openl32 and doesn't try to get the 64 bit opengl32 located at %ProgramFiles%\Microsoft SDKs\Windows\<version>\Lib\x64\OpenGL32.lib. This means that the .lib files, that are actually multiple .o files, uses a 32 bit library. Does it actually change anything or it only matters in an executable?

Thanks in advance! :)

7
General / [SOLVED]: Difference between vsync and framerate limit?
« on: May 25, 2013, 05:59:02 pm »
Hello,

I'm using sfml 1.6 and I have a quick question: what is the difference between App.SetFramerateLimit(...) and App.UseVerticalSync(true)?

Thank you :)

Pages: [1]
anything