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

Author Topic: c help  (Read 2884 times)

0 Members and 1 Guest are viewing this topic.

vurentjie

  • Newbie
  • *
  • Posts: 31
    • View Profile
c help
« on: March 26, 2008, 08:00:53 pm »
can anyone tell me what would be drastically wrong with the following code, it builds but then bombs out as soon as it opens,

Code: [Select]
#include <SFML/Window.h>
#include <GL/gl.h>
#include <GL/glu.h>

int main()
{
    //sf::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL");
    sfVideoMode Mode = {800, 600, 32};
    sfWindow *mywin;
    int Running = 1;
    sfEvent Event;


    mywin = sfWindow_Create(Mode, "Quirk", sfResize | sfClose, 0);


    glClearColor(0.3,0.3,0.3,1.0);
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    glViewport(0,0,800,600);

        glMatrixMode (GL_PROJECTION);
        glLoadIdentity ();

        gluPerspective(45.0, (float)(800.0/600.0), 0.1, 200.0);

        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glEnable (GL_DEPTH_TEST);


    while (Running)
     {
         /* Process events */
         while (sfWindow_GetEvent(mywin, &Event))
         {
             /* Close window : exit */
             if (Event.Type == sfEvtClosed)
                 Running = 0;
         }

    sfWindow_SetCurrent(mywin);

    sfWindow_Display(mywin);

    //App.Display();
     }


    return 0;
}




----------------------------------------------------------
ok i seem to be coming right- i have edited code above a bit, it no longer bombs out, i didn't call sfWindow_Display(mywin); at the end and my calls are a in a bit of a wrong order, but i seem to be getting there....


--------------------------------
okie dokie, i have edited code again, quik fix and very simple sfml C opengl render window, this works, thanks a bunch, i am so looking forward to using sfml, it is so great to see year 2008 displayed on your site, keep up the excellent work!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
c help
« Reply #1 on: March 27, 2008, 01:46:17 am »
So everything's working now ? :)
Laurent Gomila - SFML developer