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

Author Topic: OpenGL not Working  (Read 10571 times)

0 Members and 2 Guests are viewing this topic.

Fierce_Dutch

  • Full Member
  • ***
  • Posts: 138
    • View Profile
OpenGL not Working
« on: December 07, 2010, 07:14:50 am »
Here is my code :

Code: [Select]
#include <SFML\Graphics.hpp>
#include <SFML\OpenGL.hpp>


GLfloat rquad;

void Draw() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
glShadeModel(GL_SMOOTH);
   glLoadIdentity(); // Reset The Current Modelview Matrix
   glPushMatrix();
glRotatef(rquad,0.0,1.0,0);
glBegin(GL_QUADS);
glColor3f(2.0, 0.0, 0.0);  //

glVertex3f(0.30, 0.30, 0.0);
glVertex3f(0.30, 0.70, 0.0);
glVertex3f(0.70, 0.70, 0.0);
glVertex3f(0.70, 0.30, 0.0);

glColor3f(255.0, 0.0, 0.0); //

glVertex3f(0.70, 0.30, 0.3);
glVertex3f(0.70, 0.70, 0.3);
glVertex3f(0.70, 0.70, 0.0);
glVertex3f(0.70, 0.30, 0.0);

glColor3f(0.0, 255.0, 0.0); //

glVertex3f(0.30, 0.70, 0.3);
glVertex3f(0.30, 0.30, 0.3);
glVertex3f(0.70, 0.30, 0.3);
glVertex3f(0.70, 0.70, 0.3);

glColor3f(0.0, 0.0, 255.0); //

glVertex3f(0.30, 0.70, 0.0);
glVertex3f(0.30, 0.30, 0.0);
glVertex3f(0.30, 0.30, 0.3);
glVertex3f(0.30, 0.70, 0.3);

glColor3f(1.0,1.0,1.0);  //

glVertex3f(0.30, 0.70, 0.0);
glVertex3f(0.70, 0.70, 0.0);
glVertex3f(0.30, 0.70, 0.3);
glVertex3f(0.70, 0.70, 0.3);

glVertex3f(0.30, 0.30, 0.0);
glVertex3f(0.70, 0.30, 0.0);
glVertex3f(0.30, 0.30, 0.3);
glVertex3f(0.70, 0.30, 0.3);


glEnd();
glPopMatrix();
rquad+=-0.5;
glFlush();
}

void Initialize() {
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}

int main(int iArgc, char** cppArgv) {
sf::Window App(sf::VideoMode(800,800,8), "OpengGL Test");
Initialize();
while(App.IsOpened())
{
glClear(GL_COLOR_BUFFER_BIT);
Draw();
App.Display();
}
return 0;
}


Ok Well I have gotten rid of those errors by creating a new project and trying to do all of this again but now window doesnt display. It doesnt pop up at all...
[/code]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OpenGL not Working
« Reply #1 on: December 07, 2010, 07:57:44 am »
You must link to sfml-window.lib and opengl32.lib.
Laurent Gomila - SFML developer

Fierce_Dutch

  • Full Member
  • ***
  • Posts: 138
    • View Profile
OpenGL not Working
« Reply #2 on: December 08, 2010, 06:47:12 pm »
Quote from: "Laurent"
You must link to sfml-window.lib and opengl32.lib.


I did. and I also defined sfml static. Still doesnt work...

BTW edited for graphics lib not window lib.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
OpenGL not Working
« Reply #3 on: December 08, 2010, 10:25:08 pm »
it seems you need both graphics and window.
SFML / OS X developer

Fierce_Dutch

  • Full Member
  • ***
  • Posts: 138
    • View Profile
OpenGL not Working
« Reply #4 on: December 09, 2010, 12:42:33 am »
Quote from: "Hiura"
it seems you need both graphics and window.


I have linked and included both, still no luck

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OpenGL not Working
« Reply #5 on: December 09, 2010, 08:06:41 am »
How did you link them?
Laurent Gomila - SFML developer

Fierce_Dutch

  • Full Member
  • ***
  • Posts: 138
    • View Profile
OpenGL not Working
« Reply #6 on: December 10, 2010, 02:35:14 am »
Quote from: "Laurent"
How did you link them?


I have linked all the sfml stuff, Opengl32.lib, and glu32.lib with the additional dependencies linker in vc++. I defined SFML_STATIC. Also I have put the sfml headers and the gl folder with the gl and glu headers in the include folder in the vc folder in the visual c++ folder. Also I included the libs in there for sfml and glu and opengl

BTW can you please help me do this before the weekend because I really want to devote that weekend to learning Opengl.

Btw I think it is a bit hard to talk to each other since we are across the world from eachother.. (US)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OpenGL not Working
« Reply #7 on: December 10, 2010, 07:18:07 am »
Quote
I defined SFML_STATIC

What revision of SFML 2 are you using? How did you define SFML_STATIC?
Laurent Gomila - SFML developer

Relic

  • Newbie
  • *
  • Posts: 43
    • View Profile
OpenGL not Working
« Reply #8 on: December 10, 2010, 07:29:25 am »
Quote
Laurent wrote:
You must link to sfml-window.lib and opengl32.lib.

Shouldn't it be sfml-window-S.lib if he uses SFML_STATIC?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OpenGL not Working
« Reply #9 on: December 10, 2010, 10:39:37 am »
Quote
Shouldn't it be sfml-window-S.lib if he uses SFML_STATIC?

Yes. It didn't mention it in his first message.
Laurent Gomila - SFML developer

Fierce_Dutch

  • Full Member
  • ***
  • Posts: 138
    • View Profile
OpenGL not Working
« Reply #10 on: December 10, 2010, 04:24:29 pm »
Quote from: "Laurent"
Quote
I defined SFML_STATIC

What revision of SFML 2 are you using? How did you define SFML_STATIC?


In the preprocessor directives... I am using the libraries statically...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OpenGL not Working
« Reply #11 on: December 10, 2010, 04:36:31 pm »
When did you download SFML 2?
Laurent Gomila - SFML developer

Fierce_Dutch

  • Full Member
  • ***
  • Posts: 138
    • View Profile
OpenGL not Working
« Reply #12 on: December 11, 2010, 12:03:53 am »
Quote from: "Laurent"
When did you download SFML 2?


Like two days ago I updated my repository again and rebuilt it. I rebuilt it correctly, dont worry.

Also Please check the first post.

foofel

  • Newbie
  • *
  • Posts: 4
    • View Profile
OpenGL not Working
« Reply #13 on: December 18, 2010, 02:44:13 am »
Hey, i got a similar issue since the Catalyst driver version 10.10 (10.09 worked). I have the problem with SFML 1.6 and 2.0 using 32 or 64 bit doesn't change anything. I am not sure where the problem started, but it hangs at:

Code: [Select]

myGLContext = wglCreateContext(myDeviceContext);


on WindowImplWin32.cpp line 629 (or close, tried something). And it literally hangs, there is no error message or anything the call just doesn't return, like its blocking. Downgrading Catalyst also works, but everything else is working fine (e.g Games. Even the nehe tutorials work. Tested lesson2 and 3). Cause the newest OpenCL SDK needs the newest driver version i can no longer use the 10.09 version... hopefully somebody finda a fix ;)

I am using Win7 64 Bit and VS 2010.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OpenGL not Working
« Reply #14 on: December 18, 2010, 08:50:04 am »
Ok ok, I get it. You'll have to wait until the global exit crash is fixed (this is the same kind of problem).
Laurent Gomila - SFML developer