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

Author Topic: Compiler stops at OpenGL commands.  (Read 1801 times)

0 Members and 1 Guest are viewing this topic.

Pixel_Outlaw

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Compiler stops at OpenGL commands.
« on: May 18, 2011, 08:31:43 am »
Hello!

I'm trying to get OpenGL working with SFML.
I have followed the tutorial for installation of SFML with Code::Blocks.

The problem comes when I try to call OpenGL. I have a bunch of "undefined references" in my debug window. The compiler has no problem working with the window library, however it fails when "gl" commands are reached within the code. I assumed that the implementation of OpenGL existed within the Window library. Is this not the case?

I'm on a laptop:
Windows 7 (64 bit)
Amd Phenom II N660 Dual-Core
4 GB RAM
Ati Mobility Radeon HD 4200 graphics

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Compiler stops at OpenGL commands.
« Reply #1 on: May 18, 2011, 08:39:11 am »
Quote
I assumed that the implementation of OpenGL existed within the Window library. Is this not the case?

Nop, you must explicitely link to the OpenGL library.
Laurent Gomila - SFML developer

Pixel_Outlaw

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Compiler stops at OpenGL commands.
« Reply #2 on: May 18, 2011, 09:09:37 am »
I see.

I've never had to include the OpenGL library. (Before I used Blitzmax for OpenGl development which sort of wrapped OpenGl easily).

If it is not too much trouble, can you explain how to set this up?
It might be something to add to the OpenGL section of the Window library tutorial if you get some free time.

I'd like to get some fancy 3D going soon.  :wink:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Compiler stops at OpenGL commands.
« Reply #3 on: May 18, 2011, 09:20:31 am »
You must add the OpenGL library in the list of libraries you link to (just like you do with SFML libraries). The library is "opengl32" on Windows, or "GL" on Linux.

Quote
It might be something to add to the OpenGL section of the Window library tutorial if you get some free time.

Definitely.
Laurent Gomila - SFML developer

Pixel_Outlaw

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Compiler stops at OpenGL commands.
« Reply #4 on: May 18, 2011, 10:16:57 am »
Ok, thanks for the help so far!

As you said I have located the .dll file
C:\Windows\System32\opengl32.dll


I tried to include the library by putting the following in Code::Blocks
Settings > Compiler and debugger > Global compiler settings > Search directories >  C:\Windows\System32

I have the feeling that I did something incorrectly. I've not had much practice including files in Code::Blocks.
 :oops:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Compiler stops at OpenGL commands.
« Reply #5 on: May 18, 2011, 10:23:45 am »
You can't link to .dll files, you must link to the corresponding .a. For OpenGL, this is libopengl32.a, and it's already in a path that the linker knows so all you have to do is to add "opengl32" at the same place where you added "sfml-system" and "sfml-window" in your linker settings.
Laurent Gomila - SFML developer

Pixel_Outlaw

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Compiler stops at OpenGL commands.
« Reply #6 on: May 18, 2011, 10:42:28 am »
Excellent, it now appears to get past the OpenGL lines.

Here is my current configuration...
http://imageshack.us/photo/my-images/101/workingc.png/

 

anything