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

Pages: [1]
1
General / Re: Test program crashes at sf::Clock instantiation
« on: August 01, 2012, 09:47:34 am »
SFML full SDK 1.6, with the GCC 4.7.0

2
General / Test program crashes at sf::Clock instantiation
« on: August 01, 2012, 04:57:02 am »
I have been attempting to compile and run the test program on Code::Blocks using the dynamic libraries, but the program seems to crash whenever I create in instance of sf::Clock.  The program compiles and links fine, but the resulting program crashes on a call to sf::Clock.  I am using the dynamic libraries, and have copied the dll's to the executable's directory, but the program crashes regardless.

Any help appreciated.

3
Window / [SOLVED] OpenGL tutorial not working.
« on: March 05, 2012, 05:47:39 am »
Thanks for that, and sorry for my failure to include my platform in the first post  :oops:

4
Window / [SOLVED] OpenGL tutorial not working.
« on: March 04, 2012, 08:33:37 am »
So, I read this tutorial:
http://www.sfml-dev.org/tutorials/1.6/window-opengl.php

and compiled it, with the command:
Quote
$ g++ main.cpp -lsfml-window -sfml-system

and I got the output:
Quote
/tmp/cchWQE5i.o: In function `main':
main.cpp:(.text+0x17f): undefined reference to `gluPerspective'
collect2: ld returned 1 exit status

I asked Google and it said that I had to link the OGL libraries, so I tried this:
Quote
$ g++ main.cpp -lglu32 -lopengl32 -lglut32 -lsfml-window -lsfml-system

Which gave me this:
Quote
/usr/bin/ld: cannot find -lopengl32
/usr/bin/ld: cannot find -lglu32
/usr/bin/ld: cannot find -lglut32
collect2: ld returned 1 exit status


So what am I doing wrong, and how do I fix it?
Thanks in advance.

EDIT:
In case you wanted the code:
Code: [Select]

#include <SFML/Window.hpp>

int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL");

    // Create a clock for measuring time elapsed
    sf::Clock Clock;

    // 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);

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                App.Close();

            // Resize event : adjust viewport
            if (Event.Type == sf::Event::Resized)
                glViewport(0, 0, Event.Size.Width, Event.Size.Height);
        }

        // Set the active window before using OpenGL commands
        // It's useless here because active window is always the same,
        // but don't forget it if you use multiple windows or controls
        App.SetActive();

        // Clear color and depth buffer
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        // Apply some transformations
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glTranslatef(0.f, 0.f, -200.f);
        glRotatef(Clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f);
        glRotatef(Clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f);
        glRotatef(Clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f);

        // Draw a cube
        glBegin(GL_QUADS);

            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f(-50.f,  50.f, -50.f);
            glVertex3f( 50.f,  50.f, -50.f);
            glVertex3f( 50.f, -50.f, -50.f);

            glVertex3f(-50.f, -50.f, 50.f);
            glVertex3f(-50.f,  50.f, 50.f);
            glVertex3f( 50.f,  50.f, 50.f);
            glVertex3f( 50.f, -50.f, 50.f);

            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f(-50.f,  50.f, -50.f);
            glVertex3f(-50.f,  50.f,  50.f);
            glVertex3f(-50.f, -50.f,  50.f);

            glVertex3f(50.f, -50.f, -50.f);
            glVertex3f(50.f,  50.f, -50.f);
            glVertex3f(50.f,  50.f,  50.f);
            glVertex3f(50.f, -50.f,  50.f);

            glVertex3f(-50.f, -50.f,  50.f);
            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f( 50.f, -50.f, -50.f);
            glVertex3f( 50.f, -50.f,  50.f);

            glVertex3f(-50.f, 50.f,  50.f);
            glVertex3f(-50.f, 50.f, -50.f);
            glVertex3f( 50.f, 50.f, -50.f);
            glVertex3f( 50.f, 50.f,  50.f);

        glEnd();

        // Finally, display rendered frame on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}

Pages: [1]
anything