Jump to content

  • Log In with Google      Sign In   
  • Create Account

Setting up OpenGL with SDL


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 The Magical Pot   Members   -  Reputation: 178

Like
0Likes
Like

Posted 21 October 2012 - 05:30 AM

I'm trying to get OpenGL to work with SDL and I've set up SDL so that it works and so that I can use it, but the thing is that I can't get OpenGL to work.
I want to use OpenGL to render and SDL to do all of the other stuff (SDL_opengl). I've linked to SDL, but when I write anything related to OpenGL in my code, I get linker errors when I compile the application.

Ex:

"1>main.obj : error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function "public: void __thiscall Player::show(void)" (?show@Player@@QAEXXZ)"

I guess I have to link to OpenGL as well, but the thing is that I don't know how to do that, I've tried with 'SDL_opengl', '-lopengl32', 'lopengl32', 'opengl32' and so on, but then I get the error "can't open opengl32.obj".

Is the problem that I have to link to OpenGL as well and if so, how do I link it and do I need to download any additional OpenGL files?

Sponsor:

#2 lride   Members   -  Reputation: 633

Like
0Likes
Like

Posted 21 October 2012 - 07:18 AM

isn't it opengl32.lib and glu32.lib
An invisible text.

#3 The Magical Pot   Members   -  Reputation: 178

Like
0Likes
Like

Posted 21 October 2012 - 07:21 AM

Lol, I feel so stupid. Thank you, it worked :)

#4 xXDreamXx   Members   -  Reputation: 114

Like
0Likes
Like

Posted 24 October 2012 - 07:23 PM

I am having a similar issue too. I am wondering how to get opengl to do all my rendering and use sdl for sound, but for some reason sdl wants to take over. Have you figured out how to do that?

#5 The Magical Pot   Members   -  Reputation: 178

Like
0Likes
Like

Posted 27 October 2012 - 12:28 PM

Yes I have. I'd recomend you to have a look at this tutorial: http://lazyfoo.net/SDL_tutorials/lesson36/index.php
If you just want a short answer from me, you basically just add the constant "SDL_OPENGL" in the 'SDL_SetVideoMode' funtion for example like so: "SDL_SetVideoMode( x, y, 32, SDL_OPENGL )" You can also add other parameters if you wish to by using the bitwise OR symbol (|) like so: ( SDL_OPENGL | *Other constants* )

Hope that answered you question :)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS