Archived

This topic is now archived and is closed to further replies.

badblood909

OpenGL How is OpenGL related to SDL?

Recommended Posts

badblood909    122
I am sorry for this totally n00b question, but whenever I read something related to OpenGL around the net, SDL was sure to follow, even in the forum FAQ, and thats why I ask my sorry-arse question. Also, is GLUT OpenGL in the same line of say, ANSI C? Meaning that it would work under any platform? In OpenGL.org, I did not find what I should download to be able to run OpenGL programs on my Linux system, and OpenGL books that I saw all come with software for the MACos and Windows, no Linux, is there any book that I missed? All help apreciated, thank you for your time. -It''s all in the blood...

Share this post


Link to post
Share on other sites
Myopic Rhino    2317
quote:
Original post by badblood909
I am sorry for this totally n00b question, but whenever I read something related to OpenGL around the net, SDL was sure to follow, even in the forum FAQ, and thats why I ask my sorry-arse question.

There is no direct relationship. SDL is available on many different platforms, like OpenGL, and it can be used with OpenGL. That''s it.
quote:
Original post by badblood909
Also, is GLUT OpenGL in the same line of say, ANSI C? Meaning that it would work under any platform?

GLUT''s available on most platforms... I believe every platform that OpenGL is available on. It''s primary purpose is to wrap OS-specific code, so that usually, code written using GLUT can be compiled on most platforms with no changes.
quote:
Original post by badblood909
In OpenGL.org, I did not find what I should download to be able to run OpenGL programs on my Linux system, and OpenGL books that I saw all come with software for the MACos and Windows, no Linux, is there any book that I missed?

I don''t know what you need to download to use OpenGL on Linux, but I thought that OpenGL.org had some links.

As for books, I know that Linux Game Programming covers some OpenGL. There''s also OpenGL Programming for the X Window System.

Share this post


Link to post
Share on other sites
Hanibal_smith    122
To run and compile OpenGL programs under linux all you need is to download both GLX and Kernel drivers for 3D card, all GL-includes will be installed then.
if you have an NVidia chips have a look to :
http://www.nvidia.com/view.asp?PAGE=linux

you can use GLX as window manager, it has the same function than WGL under windows. But SDL or GLUT are more simple to use.

sorry for the double post...

[edited by - hanibal_smith on April 30, 2002 1:26:19 PM]

Share this post


Link to post
Share on other sites
Siebharinn    122
quote:

There is no direct relationship. SDL is available on many different platforms, like OpenGL, and it can be used with OpenGL. That''s it.



Well, not quite it. SDL has direct support for OpenGL. It''s an extremely easy way to build an OpenGL app.

Which actually raises a question for me about SDL. I like it, it does everything that I need it to do, with a fraction of the complexity of DirectX. The cross-platformness is a nice benefit.

What are the downsides of SDL? Why is it (along with ClanLib and Allegro, neither of which I''ve messed with) considered useful for "beginner" projects, but not for serious work?

Thanks!

Take care,
Bill

Share this post


Link to post
Share on other sites
i8degrees    122
quote:

What are the downsides of SDL? Why is it (along with ClanLib and Allegro, neither of which I''ve messed with) considered useful for "beginner" projects, but not for serious work?



Well, for one, SDL wouldn''t be able to acess all the hardware specific, or feature specific, functions that DirectX might be able to handle. Since it is a cross-platform library, every function has to work on ALL platforms, and obviously, not all graphics features are available on all platforms.



"I am governed by none other than the Laws of the Universe."

Share this post


Link to post
Share on other sites
i8degrees    122
Oh, and for OpenGL on Linux - Mesa3D.

[EDIT] Fixed the link

"I am governed by none other than the Laws of the Universe."

[edited by - i8degrees on April 30, 2002 3:39:56 PM]

Share this post


Link to post
Share on other sites
stefu    120
I use SDL for my projects for Windows and Linux currently. It simply has everything I need (hope Force Feedback support will come soon).

Share this post


Link to post
Share on other sites
Cyberdrek    100
quote:
Original post by badblood909
In OpenGL.org, I did not find what I should download to be able to run OpenGL programs on my Linux system, and OpenGL books that I saw all come with software for the MACos and Windows, no Linux, is there any book that I missed?

All help apreciated, thank you for your time.

-It''s all in the blood...


Even if you had a really old version of Linux, chances are, if you do a locate or find for GLU.h or GLUT.H, you should find them installed somewhere. At least, if you set up your distro for coding(ie: the best setup for any user even those who don''t plan on coding. )

As for books, get any book that talks about OGL and the code should(you might need to tweek it a bit but hey, that''s part of the programming fun... ) compile on Linux.


"And that''s the bottom line cause I said so!"

Cyberdrek
danielc@iquebec.com
Founder
Laval Linux

/(bb|[^b]{2})/ that is the Question -- ThinkGeek.com
Hash Bang Slash bin Slash Bash -- #!/bin/bash

Share this post


Link to post
Share on other sites
Cyberdrek    100
quote:
Original post by Hanibal_smith
To run and compile OpenGL programs under linux all you need is to download both GLX and Kernel drivers for 3D card, all GL-includes will be installed then.
if you have an NVidia chips have a look to :
http://www.nvidia.com/view.asp?PAGE=linux

you can use GLX as window manager, it has the same function than WGL under windows. But SDL or GLUT are more simple to use.

sorry for the double post...

[edited by - hanibal_smith on April 30, 2002 1:26:19 PM]


You don''t even need that, it''s mostly the drivers for your card which are incredible by the way, they work wonders. I have''em installed on my Linux box. As for what I was saying, most linux distros already have the libs and includes for OGL.



"And that''s the bottom line cause I said so!"

Cyberdrek
danielc@iquebec.com
Founder
Laval Linux

/(bb|[^b]{2})/ that is the Question -- ThinkGeek.com
Hash Bang Slash bin Slash Bash -- #!/bin/bash

Share this post


Link to post
Share on other sites
Cyberdrek    100
quote:
Original post by i8degrees

Well, for one, SDL wouldn''t be able to acess all the hardware specific, or feature specific, functions that DirectX might be able to handle. Since it is a cross-platform library, every function has to work on ALL platforms, and obviously, not all graphics features are available on all platforms.




Wrong dude, as already mentioned, SDL wraps DX on Windows systems and OGL on Linux systems. So basicly, you could use SDL for serious game programming. BTW, Loki used SDL for some of their ports of Windows games( or was it for all of them? I don''t remember ). So SDL could be used for Serious Game programming as the original poster calls it.



"And that''s the bottom line cause I said so!"

Cyberdrek
danielc@iquebec.com
Founder
Laval Linux

/(bb|[^b]{2})/ that is the Question -- ThinkGeek.com
Hash Bang Slash bin Slash Bash -- #!/bin/bash

Share this post


Link to post
Share on other sites
Siebharinn    122
quote:

Wrong dude, as already mentioned, SDL wraps DX on Windows systems and OGL on Linux systems. So basicly, you could use SDL for serious game programming. BTW, Loki used SDL for some of their ports of Windows games( or was it for all of them? I don''t remember ). So SDL could be used for Serious Game programming as the original poster calls it.



SDL wraps OGL on Windows also. It uses DX for everything else(input, sound, etc).

I''ve done some DX programming, and had to write wrapper classes to avoid constantly rewriting all the tedious DX setup junk. And my wrapper classes ended up looking very similar to SDL. So for me, SDL does what I would want a wrapper library to do, and I get portability for free.

I don''t think that Loki is a good example of the use of SDL. They made good ports, to be sure, but only on Linux. I''m wondering why a major studio doesn''t use SDL to target more than one platform. Or even use SDL for a windows only project.

Take care,
Bill




Share this post


Link to post
Share on other sites
Supernova    122
SDL is good for many reasons. Some of them are:

It's a cross platform API.
It's open source.
It gives you full access to OpenGL (some minor differences are initialization and flipping buffers)
It's used (and developed) by a lot of people, which means it's relatively bug free.
It's updated often.
It's a much better wrapper for DirectX than you can ever write
It has a function for generating decaf coffee and bagels with cream cheese.

It really is a good API though. It even has its own multithreading wrappers and timers. I don't know why big companies don't use it, maybe it's because they don't care about other platforms and/or want to use Direct3D. There is one problem I encountered with SDL which is supposed to be fixed soon, and that's the mouse wheel scrolling isn't working very well. Other than that I have no complaints.

[edited by - Supernova on May 1, 2002 12:25:51 PM]

Share this post


Link to post
Share on other sites
zedzeek    529
>>It gives you full access to OpenGL (some minor differences are initialization and flipping buffers)<<

the reason for this is so u can support voodoo cards (1,2,3) without having to change your code, in the old days this was a major pain

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
antistuff    122
SDL doesnt wrap opengl anywhere. It can be used to create a window and handle input and then you can use opengl to draw in the window.

Share this post


Link to post
Share on other sites
Supernova    122
antistuff you''re pretty much right. The difference is that you have to tell SDL you''re using OpenGL, and then use SDL buffer flipping function instead of OpenGL''s because SDL has access to the window internally. In other words you don''t know the handle of the window only SDL does, so you have to let it take care of some OpenGL init and the buffer flipping.

Share this post


Link to post
Share on other sites

  • Similar Content

    • By Arulbabu Donbosco
      There are studios selling applications which is just copying any 3Dgraphic content and regenerating into another new window. especially for CAVE Virtual reality experience. so that the user opens REvite or CAD or any other 3D applications and opens a model. then when the user selects the rendered window the VR application copies the 3D model information from the OpenGL window. 
      I got the clue that the VR application replaces the windows opengl32.dll file. how this is possible ... how can we copy the 3d content from the current OpenGL window.
      anyone, please help me .. how to go further... to create an application like VR CAVE. 
       
      Thanks
    • By cebugdev
      hi all,

      i am trying to build an OpenGL 2D GUI system, (yeah yeah, i know i should not be re inventing the wheel, but this is for educational and some other purpose only),
      i have built GUI system before using 2D systems such as that of HTML/JS canvas, but in 2D system, i can directly match a mouse coordinates to the actual graphic coordinates with additional computation for screen size/ratio/scale ofcourse.
      now i want to port it to OpenGL, i know that to render a 2D object in OpenGL we specify coordiantes in Clip space or use the orthographic projection, now heres what i need help about.
      1. what is the right way of rendering the GUI? is it thru drawing in clip space or switching to ortho projection?
      2. from screen coordinates (top left is 0,0 nd bottom right is width height), how can i map the mouse coordinates to OpenGL 2D so that mouse events such as button click works? In consideration ofcourse to the current screen/size dimension.
      3. when let say if the screen size/dimension is different, how to handle this? in my previous javascript 2D engine using canvas, i just have my working coordinates and then just perform the bitblk or copying my working canvas to screen canvas and scale the mouse coordinates from there, in OpenGL how to work on a multiple screen sizes (more like an OpenGL ES question).
      lastly, if you guys know any books, resources, links or tutorials that handle or discuss this, i found one with marekknows opengl game engine website but its not free,
      Just let me know. Did not have any luck finding resource in google for writing our own OpenGL GUI framework.
      IF there are no any available online, just let me know, what things do i need to look into for OpenGL and i will study them one by one to make it work.
      thank you, and looking forward to positive replies.
    • By fllwr0491
      I have a few beginner questions about tesselation that I really have no clue.
      The opengl wiki doesn't seem to talk anything about the details.
       
      What is the relationship between TCS layout out and TES layout in?
      How does the tesselator know how control points are organized?
          e.g. If TES input requests triangles, but TCS can output N vertices.
             What happens in this case?
      In this article,
      http://www.informit.com/articles/article.aspx?p=2120983
      the isoline example TCS out=4, but TES in=isoline.
      And gl_TessCoord is only a single one.
      So which ones are the control points?
      How are tesselator building primitives?
    • By Orella
      I've been developing a 2D Engine using SFML + ImGui.
      Here you can see an image
      The editor is rendered using ImGui and the scene window is a sf::RenderTexture where I draw the GameObjects and then is converted to ImGui::Image to render it in the editor.
      Now I need to create a 3D Engine during this year in my Bachelor Degree but using SDL2 + ImGui and I want to recreate what I did with the 2D Engine. 
      I've managed to render the editor like I did in the 2D Engine using this example that comes with ImGui. 
      3D Editor preview
      But I don't know how to create an equivalent of sf::RenderTexture in SDL2, so I can draw the 3D scene there and convert it to ImGui::Image to show it in the editor.
      If you can provide code will be better. And if you want me to provide any specific code tell me.
      Thanks!
    • By Picpenguin
      Hi
      I'm new to learning OpenGL and still learning C. I'm using SDL2, glew, OpenGL 3.3, linmath and stb_image.
      I started following through learnopengl.com and got through it until I had to load models. The problem is, it uses Assimp for loading models. Assimp is C++ and uses things I don't want in my program (boost for example) and C support doesn't seem that good.
      Things like glVertexAttribPointer and shaders are still confusing to me, but I have to start somewhere right?
      I can't seem to find any good loading/rendering tutorials or source code that is simple to use and easy to understand.
      I have tried this for over a week by myself, searching for solutions but so far no luck. With tinyobjloader-c and project that uses it, FantasyGolfSimulator, I was able to actually load the model with plain color (always the same color no matter what I do) on screen and move it around, but cannot figure out how to use textures or use its multiple textures with it.
      I don't ask much: I just want to load models with textures in them, maybe have lights affect them (directional spotlight etc). Also, some models have multiple parts and multiple textures in them, how can I handle those?
      Are there solutions anywhere?
      Thank you for your time. Sorry if this is a bit confusing, English isn't my native language
  • Popular Now