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

Author Topic: Window Tutorial on OpenGL Issues [Solved]  (Read 2710 times)

0 Members and 2 Guests are viewing this topic.

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Window Tutorial on OpenGL Issues [Solved]
« on: August 28, 2012, 02:46:53 am »
As the title and my amount of posts should make clear I am very new to SFML. (started 4 days ago)
Currently using the C++ sdk. I have around 6-7 months of experience with C++ so I am still unaware of many things within the language, but have gotten used to it already.

When I try to use the OpenGL instructions I get undefined references to each method from the compiler.
I use Code::Blocks with the latest GCC compiler and followed and linked everything it said to be linked in the project's options.

This is my source code:

#include <SFML/System.hpp>
#include <SFML/Window.hpp>
//Window Hpp incluye a Event.hpp y a otras clases, si estas estan en el paquete no es necesario incluirlas.
#include <SFML/System/Randomizer.hpp>
#include <iostream>

int main ()
{   sf::WindowSettings Settings; /// Objeto WindowSettings, permite configurar las opciones graficas deseadas.
    ///Todas tienen valores default, por lo tanto no es necesario revalorizar dichas opciones.
    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::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL", sf::Style::Close, Settings);
    ///Crea los datos de la ventana al final y usa las configuraciones dadas por el objeto settings.

/** Aqui empieza el codigo de OpenGL usando como plataforma a SFML*/
    // Set color and depth clear value
    glClearDepth(1.f);
    glClearColor(0.f, 0.f, 0.f, 0.f);

// Enable Z-buffer read and write
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);

// Setup a perspective projection
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(90.f, 1.f, 1.f, 500.f);
}

Please ignore the extra comments I added. My native language is spanish and I tend to write lots of stuff when trying to understand how and what a library does what it does. Also it may seem odd that I have other includes that aren't used in the quoted source code, but it is because there are more implementations of the main function unseen by the compilator via precompilator #if's so as to put everything in the same project and not make many projects for small code examples.

From my understanding and what I have read including window.hpp should be enough to use those functions, but none is recognized. I am compiling in release mode and tried putting every single dll into the project's folder but it changed nothing (only had the window and the system dll's before that).

I think I've given enough info about my issue, however if anything else would be needed I'll gladly add anything I can. Thanks in advance for any possible help I could get.

P.S. I get undefined reference error for the gl functions only. I'll attach the cbp file in case the problem is within the project's settings (searched for such a mistake, but so far found none).

[attachment deleted by admin]
« Last Edit: August 28, 2012, 06:09:56 pm by masskiller »
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Window Tutorial on OpenGL Issues
« Reply #1 on: August 28, 2012, 03:46:08 am »
If you start then use SFML 2, 1.6 is already outdated. And the solution to your problem is in the SFML 2 tutorial.
Laurent Gomila - SFML developer

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Re: Window Tutorial on OpenGL Issues
« Reply #2 on: August 28, 2012, 04:36:07 am »
Good to know, I just began with 1.6 since it's the stable version. Thanks for the answer.
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Window Tutorial on OpenGL Issues
« Reply #3 on: August 28, 2012, 09:34:03 am »
Well I don't want to stop your from digging into OpenGL, but if you're quite new to C++, it's often advised to start with something a bit more simpler than OpenGL to get the depth of C++. On the other hand if you're quite familiar with 3D math and are good in game logic then I think it doesn't matter with what you start. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Re: Window Tutorial on OpenGL Issues [Solved]
« Reply #4 on: August 28, 2012, 06:21:42 pm »
I should take your advice then. I have knowledge of linear algebra, but mainly on the 2d side and I just began chose between SFML and SDL because I've read SFML is easier to understand and it's as good as SDL is, and even better in some aspects. I have no experience programming games or anything beyond the beginner-intermediate university scope. In fact someone I asked already stopped me from inmediately delving into directX and adviced me to start with something of a higher level before trying to clash with it. I have good coding skills in general, but I am completely new to programming games and highly graphic applications so I think I'll be posting in the help forum pretty often.
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!