2D, rotation, vector graphics/text, and related issues

Hi All,

Do most GUI toolkits (GTK2, QT, Java Swing, etc.) utilize 2D HW support in
their 2D API calls to do everything from drawing and rotating lines to rotating
and scaling vector based graphics and fonts? How about support for rotating
non-vector based graphics (e.g., bitmaps, JPEGs, PNGs, etc.)?

How does SDL compare with these toolkits on these issues?

Thanks!
GB__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

I can’t much speak for SDL on technical matters, but I know that Java
CAN use hardware for rendering the GUI elements, but only under the
newer Java 1.5, which many people may not have yet. As for drawing,
I don’t believe Java uses hardware at all for its 2D drawing stuff,
but I could be mistaken, though you can easily rotate non-vector
graphics as well as more vector-based graphics.

I don’t know much about the other options, though… sorry.

And good luck!
–ScottOn 10 Aug, 2005, at 12:27 PM, G B wrote:

Hi All,

Do most GUI toolkits (GTK2, QT, Java Swing, etc.) utilize 2D HW
support in
their 2D API calls to do everything from drawing and rotating lines
to rotating
and scaling vector based graphics and fonts? How about support for
rotating
non-vector based graphics (e.g., bitmaps, JPEGs, PNGs, etc.)?

How does SDL compare with these toolkits on these issues?

Thanks!
GB


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

If you want to get the most out of hardware accelerated graphics in 2D
or 3D, you should be using OpenGL. There are several OpenGL-native
font-drawing libraries available (some of them are pretty bad, but I’ve
heard good things about gltt.) Also there is an OpenGL-native SVG
rendering library which is thoroughly mediocre, can be found at
svgl.sf.net. I don’t know if the SVG rendering library allows you to
rotate the SVG using its API, however if it preserves the OpenGL
transformation matrix then you should have no problem rotating them on
your own.On Aug 10, 2005, at 2:27 PM, G B wrote:

Hi All,

Do most GUI toolkits (GTK2, QT, Java Swing, etc.) utilize 2D HW
support in
their 2D API calls to do everything from drawing and rotating lines to
rotating
and scaling vector based graphics and fonts? How about support for
rotating
non-vector based graphics (e.g., bitmaps, JPEGs, PNGs, etc.)?

How does SDL compare with these toolkits on these issues?

Thanks!
GB


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi All,

Do most GUI toolkits (GTK2, QT, Java Swing, etc.) utilize 2D HW
support in
their 2D API calls to do everything from drawing and rotating lines
to rotating
and scaling vector based graphics and fonts? How about support for
rotating
non-vector based graphics (e.g., bitmaps, JPEGs, PNGs, etc.)?

At the bottom level they all use the native graphics API for the OS they
are running on. That OS dependent API usually uses hardware support
where ever it can. That is to say, yes maybe it does… It depends on
the OS, the API, the graphics device, and the device drivers. If the OS
level API supports scaling and rotating vectors and images and the
hardware supports it then there is a good chance, but not a guarantee,
that hardware will be used to do the job. OTOH, you can usually find
some part of the API that is implemented in software.

How does SDL compare with these toolkits on these issues?

Depends on the OS and the video device. SDL does a pretty good job of
using the native API where ever it can. So, some times it uses the
hardware and sometimes it doesn’t. BUT, SDL doesn’t include special
support for 2D rotations and so SDL can not provide hardware
acceleration for those types of things. SDL gets around that by
providing access to OpenGL. OpenGL is, often, hardware accelerated and
does support rotation of 2D images, 2D is a subset of 3D.

	Bob Pendleton> >

Thanks!
GB

Thanks Smirk!

What parts of a GUI would the SDL non-GL API be good for and what parts would
the OpenGL API be good for?

To help narrow this question, I’ll provide that I’m going to want to have
per-pixel combined per surface alpha blending to do things like fade out an
RGBA image brought in from a PNG file. It seems that I’d need to iterate over
the pixels of the PNG and modify the alpha channel level for each pixel to
account for the surface level alpha I’m trying to set. I would then want to
arrange text onto this surface. Also, I’ll need to do simple per surface alpha
blending on scalled RGB images with text arranged on them. This type of thing
seems more straight-forward to accomplish using or modifying SDL’s blit
methods. Is this the case?

From what I remember, OpenGL is a little more involved in using a "perspective"
and so on, and removes the developer from some low level simple things I’m
trying to accomplish in most cases - e.g. alpha blending, blitting, scalling,
moving, (no rotation, no 3d rotation in most cases). If so, how should certain
components on the screen be made to use SDL blitting and other API, and some to
use OpenGL?

Should I use SDL_BlitSurface for the ‘simple’ stuff and use OpenGL for the
rotation stuff? Or what is a generally good way to break it up?

Also, having devided the work between SDL_BlitSurface and OpenGL API, how are
the two used together?

Is it just an SDL_Flip after the
glBegin(GL_QUADS);

glEnd();

I suppose the z-order on the components on the screen will still be set by what
is drawn when.

I.e.,

SDL widget 1 drawn,
glBegin, glEnd polygons drawn,
SDL widget 2 drawn
SDL_Flip

will produce images on the screen in that z-order. Is it as simple as that?

Thanks!
Gary

= = = Original message = = =

If you want to get the most out of hardware accelerated graphics in 2D
or 3D, you should be using OpenGL. There are several OpenGL-native
font-drawing libraries available (some of them are pretty bad, but I’ve
heard good things about gltt.) Also there is an OpenGL-native SVG
rendering library which is thoroughly mediocre, can be found at
svgl.sf.net. I don’t know if the SVG rendering library allows you to
rotate the SVG using its API, however if it preserves the OpenGL
transformation matrix then you should have no problem rotating them on
your own.On Aug 10, 2005, at 2:27 PM, G B wrote:

Hi All,

Do most GUI toolkits (GTK2, QT, Java Swing, etc.) utilize 2D HW
support in
their 2D API calls to do everything from drawing and rotating lines to
rotating
and scaling vector based graphics and fonts? How about support for
rotating
non-vector based graphics (e.g., bitmaps, JPEGs, PNGs, etc.)?

How does SDL compare with these toolkits on these issues?

Thanks!
GB


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Bob,

Thanks for you reply!

I suppose SDL tries to use HW support as much as possible when the HW flags are
set. However, SDL uses HW support a little less than, say, OpenGL does when it
comes to some, even non-3d rendering, like drawing fonts, right? I’ve read the
OpenGL can store the font type, etc. in HW and have HW blit it to the screen.
Is this posible in SDL? What else might not be available (besides 3d stuff),
in SDL that is available in OpenGL?

As for the other GUI toolkits:
The trouble I’ve had with these other toolkits is knowing exactly when and how
HW is being used. It seems to take a enormous amount of research to get to the
bottom of such issues. With SDL, things seem more simple =D

What I’ve found working with some of these other toolkits is that its less
clear how to accomplish exactly what you want than it is with SDL, and when you
do figure out an seemingly ad-hoc way to accomplish what you want, its not
clear how performance might be reduced by an ad-hoc method that diverges from
the example code. E.g., its not clear how much is being done in software.
What I’ve usually resorted to too often is running simple performance tests for
various methods I come up with. But finding a good approach is a little like
hitting a dart-board in the dark. My hope has been that with SDL, I’d be able
to, one day, soon, have a nearly complete understand of HW support means for
basic operations on 2D elements, such as blitting, scaling, rotating, and alpha
blending, and how to get properly use such support. Reading your articles was
a big help!

Thanks!
Gary

— Bob Pendleton wrote:>

Hi All,

Do most GUI toolkits (GTK2, QT, Java Swing, etc.) utilize 2D HW
support in
their 2D API calls to do everything from drawing and rotating lines
to rotating
and scaling vector based graphics and fonts? How about support for
rotating
non-vector based graphics (e.g., bitmaps, JPEGs, PNGs, etc.)?

At the bottom level they all use the native graphics API for the OS they
are running on. That OS dependent API usually uses hardware support
where ever it can. That is to say, yes maybe it does… It depends on
the OS, the API, the graphics device, and the device drivers. If the OS
level API supports scaling and rotating vectors and images and the
hardware supports it then there is a good chance, but not a guarantee,
that hardware will be used to do the job. OTOH, you can usually find
some part of the API that is implemented in software.

How does SDL compare with these toolkits on these issues?

Depends on the OS and the video device. SDL does a pretty good job of
using the native API where ever it can. So, some times it uses the
hardware and sometimes it doesn’t. BUT, SDL doesn’t include special
support for 2D rotations and so SDL can not provide hardware
acceleration for those types of things. SDL gets around that by
providing access to OpenGL. OpenGL is, often, hardware accelerated and
does support rotation of 2D images, 2D is a subset of 3D.

  Bob Pendleton

Thanks!
GB


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Start your day with Yahoo! - make it your home page

Thanks Smirk!

What parts of a GUI would the SDL non-GL API be good for and what parts would
the OpenGL API be good for?

To help narrow this question, I’ll provide that I’m going to want to have
per-pixel combined per surface alpha blending to do things like fade out an
RGBA image brought in from a PNG file. It seems that I’d need to iterate over
the pixels of the PNG and modify the alpha channel level for each pixel to
account for the surface level alpha I’m trying to set. I would then want to
arrange text onto this surface. Also, I’ll need to do simple per surface alpha
blending on scalled RGB images with text arranged on them. This type of thing
seems more straight-forward to accomplish using or modifying SDL’s blit
methods. Is this the case?

From what I remember, OpenGL is a little more involved in using a "perspective"
and so on, and removes the developer from some low level simple things I’m
trying to accomplish in most cases - e.g. alpha blending, blitting, scalling,
moving, (no rotation, no 3d rotation in most cases). If so, how should certain
components on the screen be made to use SDL blitting and other API, and some to
use OpenGL?

Should I use SDL_BlitSurface for the ‘simple’ stuff and use OpenGL for the
rotation stuff? Or what is a generally good way to break it up?

Also, having devided the work between SDL_BlitSurface and OpenGL API, how are
the two used together?

You can not use SDL_BlitSurface with OpenGL. When you use OpenGL, you
have to use OpenGL for everything that touches a visible buffer. OpenGL
thinks it owns the window, and there is just no reasonable way to
convince it otherwise.

OTOH, you can use the SDL 2D API to manipulate images in memory before
you hand them off to OpenGL as textures.

	Bob PendletonOn Wed, 2005-08-10 at 16:20 -0700, G B wrote:

Is it just an SDL_Flip after the
glBegin(GL_QUADS);

glEnd();

I suppose the z-order on the components on the screen will still be set by what
is drawn when.

I.e.,

SDL widget 1 drawn,
glBegin, glEnd polygons drawn,
SDL widget 2 drawn
SDL_Flip

will produce images on the screen in that z-order. Is it as simple as that?

Thanks!
Gary

= = = Original message = = =

If you want to get the most out of hardware accelerated graphics in 2D
or 3D, you should be using OpenGL. There are several OpenGL-native
font-drawing libraries available (some of them are pretty bad, but I’ve
heard good things about gltt.) Also there is an OpenGL-native SVG
rendering library which is thoroughly mediocre, can be found at
svgl.sf.net. I don’t know if the SVG rendering library allows you to
rotate the SVG using its API, however if it preserves the OpenGL
transformation matrix then you should have no problem rotating them on
your own.

On Aug 10, 2005, at 2:27 PM, G B wrote:

Hi All,

Do most GUI toolkits (GTK2, QT, Java Swing, etc.) utilize 2D HW
support in
their 2D API calls to do everything from drawing and rotating lines to
rotating
and scaling vector based graphics and fonts? How about support for
rotating
non-vector based graphics (e.g., bitmaps, JPEGs, PNGs, etc.)?

How does SDL compare with these toolkits on these issues?

Thanks!
GB


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


±-------------------------------------+

OTOH, you can use the SDL 2D API to manipulate images in memory before
you hand them off to OpenGL as textures.

  Bob Pendleton

How is this done? Say I have an SDL_Surface *pCompositeSurface that has a
bunch of different images blitted onto it. Now I want to load that onto an
OpenGL surface. What’s the code for this?

Would I just to do this?
TextureImage[0]=pCompositeSurface; ?

I’m guessing this from looking at Nehe’s lesson 8 tutorial where a bmp is
loaded onto an openGL texture like so:
TextureImage[0]=LoadBMP(“Data/glass.bmp”);
Is this LoadBMP the SDL LoadBMP function? Can I just replace that with
TextureImage[0]=IMG_Load(“image.png”);?

Thanks,
GB__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Is this the recommended way (loading an SDL surface into OpenGL) of doing
something like zooming-out a whole menu (composed of images that ordinarily
scroll up and down the clipping region of that menu)?

That is, should I blit all the menu items onto one sdl surface, load that
surface onto an openGL surface, and then zoom that whole thing out?

When I scroll the menu items, should I load a new image of the menu with its
newly positioned menu items into the one OpenGL surface every time they move,
or should I have the menu items as independent OpenGL surfaces? In the later
case, is there an open GL way to then zoom them all out as a group?

Thanks!
GB

— G B <@G_B> wrote:> >

OTOH, you can use the SDL 2D API to manipulate images in memory before
you hand them off to OpenGL as textures.

  Bob Pendleton

How is this done? Say I have an SDL_Surface *pCompositeSurface that has a
bunch of different images blitted onto it. Now I want to load that onto an
OpenGL surface. What’s the code for this?

Would I just to do this?
TextureImage[0]=pCompositeSurface; ?

I’m guessing this from looking at Nehe’s lesson 8 tutorial where a bmp is
loaded onto an openGL texture like so:
TextureImage[0]=LoadBMP(“Data/glass.bmp”);
Is this LoadBMP the SDL LoadBMP function? Can I just replace that with
TextureImage[0]=IMG_Load(“image.png”);?

Thanks,
GB


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

OTOH, you can use the SDL 2D API to manipulate images in memory before
you hand them off to OpenGL as textures.

  Bob Pendleton

How is this done? Say I have an SDL_Surface *pCompositeSurface that has a
bunch of different images blitted onto it. Now I want to load that onto an
OpenGL surface. What’s the code for this?

In the SDL source code there is an entire directory full of demos. All
the code you need is there. Down load, read, use it. Not to mention that
your question is answered in every book on OpenGL and is covered by a
large number of online tutorials.

	Bob PendletonOn Sat, 2005-08-13 at 16:27 -0700, G B wrote:

Would I just to do this?
TextureImage[0]=pCompositeSurface; ?

I’m guessing this from looking at Nehe’s lesson 8 tutorial where a bmp is
loaded onto an openGL texture like so:
TextureImage[0]=LoadBMP(“Data/glass.bmp”);
Is this LoadBMP the SDL LoadBMP function? Can I just replace that with
TextureImage[0]=IMG_Load(“image.png”);?

Thanks,
GB


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


±-------------------------------------+