Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Can anyone give me an example?


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
20 replies to this topic

#1 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 2001 - 05:07 AM

can anyone posy or give me a link that shows how to create a basic OpenGL window with SDL? i would really appreciate it thx "Those who serve no purpose, have no purpose"

Sponsor:

#2 Thek   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 2001 - 05:58 AM

I don''t know any links and I''m not gonna post straight from someone elses copywrited material , but check out the book called Linux Game Programming. Its not too expensive and it covers SDL with OpenGL.
~Thek

#3 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 2001 - 06:00 AM

uhhh linux?

"Those who serve no purpose, have no purpose"

#4 Thek   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 2001 - 06:22 AM

Umm... if the OpenGL book was written for Windows, it would use the Windows API, not SDL.
Trust me, you can ignore all the Linux stuff if you want and just stick with the SDL and OpenGL part. I''m not in to Linux programming myself, but it may be a topic you''ll want to explore later anyway. And as I said, I highly doubt you''ll find a Windows centered graphics book discussing SDL in any detail at all. SDL is often used for porting code from Windows to other operating systems, namely Linux or for making an open-OS program in the first place. Windows is not open-OS .

The Long and the Short: If you want to learn SDL, you''re gonna have to look at books centered on the 10% of operating systems that aren''t Windows.

~Thek

#5 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 2001 - 06:24 AM

heh i suppose ure right

time to find a bootleg copy of the book cuz im poor

"Those who serve no purpose, have no purpose"

#6 Dactylos   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 2001 - 06:43 AM

It's really simple to setup an SDL window for OpenGL rendering (all you really need to know is in the docs at www.libsdl.org).
This is an example:

          
SDL_Init(SDL_INIT_VIDEO);

// Set some attributes for the OpenGL rendering context.

// Look in the docs to see what other attributes there are.

// These are mostly treated as hints.

SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );

SDL_SetVideoMode(640, 480, 16, SDL_RESIZABLE | SDL_OPENGL);

// now we have a window to render in, so just setup

// an SDL event loop and start rendering stuff here...


// We must swap buffers using this function instead of the windows standard SwapBuffers

SDL_GL_SwapBuffers();

Of course you should add some error-checking and stuff.

Edited by - Dactylos on October 7, 2001 1:48:18 PM

#7 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 2001 - 06:50 AM

ic interestin...

can I still use the nehe code besides the windows specific stuff?

"Those who serve no purpose, have no purpose"

#8 Dactylos   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 2001 - 06:58 AM

You can use any OpenGL code to render in a window setup by SDL.
I think most of the NeHe tutorials are ported to SDL, look at the bottom of the tutorial pages for the download labeled "Linux/SDL". I haven''t tried running the SDL ports on Windows, but they should work, as long as they only use SDL and OpenGL.

#9 Null and Void   Moderators   -  Reputation: 1087

Like
Likes
Like

Posted 07 October 2001 - 07:09 AM

Just remember that the depth buffer (and other buffers) need to be setup before you call SDL_SetVideoMode. It''s the same as the Win32 API in that respect. Other than that, he''s right, you can use the NeHe code. Remember that most of NeHe''s tutorials are ported to SDL also.

[Resist Windows XP''s Invasive Production Activation Technology!]

#10 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 2001 - 07:09 AM

hehe what do you know, its there


what SDL files do i d/l?
the runtime and development ones for win32?


and where do i unzip them?


thx

"Those who serve no purpose, have no purpose"

#11 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 2001 - 07:25 AM

i just d/l and i am royally confused

plz help

"Those who serve no purpose, have no purpose"

#12 Null and Void   Moderators   -  Reputation: 1087

Like
Likes
Like

Posted 07 October 2001 - 07:37 AM

Download the developer files for whatever compiler you have, of course for Windows, since that's what you're using. Put the in your compiler's include and lib folders. Download the runtime files and put them in one of two places: (a) The same folder as your program's executable, or (b) the Windows system folder.

[Resist Windows XP's Invasive Production Activation Technology!]

Edited by - Null and Void on October 7, 2001 2:37:44 PM

#13 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 2001 - 03:31 PM

i did that but i cant compile the first nehe tut

it says SDL.h does not exist

do i have to include a lib or something?

"Those who serve no purpose, have no purpose"

#14 Null and Void   Moderators   -  Reputation: 1087

Like
Likes
Like

Posted 07 October 2001 - 03:47 PM

Did you download the SDL development library and put the stuff in the "include" folder in MSVC''s include folder (it may need to go in a "MSVC-Whatever\include\SDL" folder actually).

[Resist Windows XP''s Invasive Production Activation Technology!]

#15 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 October 2001 - 03:49 PM

uhh i use dev C++

i d/l the win32 file

"Those who serve no purpose, have no purpose"

#16 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 October 2001 - 05:19 AM

no more help....

"Those who serve no purpose, have no purpose"

#17 Null and Void   Moderators   -  Reputation: 1087

Like
Likes
Like

Posted 08 October 2001 - 04:12 PM

Well, in that case, download the package labeled "SDL-devel-1.2.2-mingw32.tar.gz". MinGW32 is the port of GCC to Windows that Dev C++ happens to use. Sorry for assuming you were using MSVC .

[Resist Windows XP''s Invasive Production Activation Technology!]

#18 SonShadowCat   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 October 2001 - 12:00 AM

that is what i have
i have the correct files but it still wont work

"Those who serve no purpose, have no purpose"

#19 Null and Void   Moderators   -  Reputation: 1087

Like
Likes
Like

Posted 09 October 2001 - 01:16 AM

I redownloading Dev C++ (since my installation of it got screwed when I reformatted my C drive, which just happens to contain the register ), I''ll try it out in a while.

[Resist Windows XP''s Invasive Production Activation Technology!]

#20 Null and Void   Moderators   -  Reputation: 1087

Like
Likes
Like

Posted 09 October 2001 - 11:09 AM

Hmm, you''re right about Dev C++ being pretty weird with SDL. I''ve used GCC/G++ with SDL just fine in the past though, so I''m not sure what the problem it . Maybe if you ask for help on their mailing list you''ll get more experienced help.

[Resist Windows XP''s Invasive Production Activation Technology!]




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