Not sure if this is SDL or OpenGL related, I am trying to simple rotate
a QUAD (yes very newbie question) but am not getting the results I want.
Basically what’s happening is that the QUAD is rotating around the top
left vertex and not around the quad’s center. I would like it to rotate
around the center of the quad. This this how OpenGL works or am I doing
something wrong? The code is as follow:
nathanOn Wed, 2002-09-11 at 21:29, Byron Wright wrote:
Hi all,
Not sure if this is SDL or OpenGL related, I am trying to simple rotate
a QUAD (yes very newbie question) but am not getting the results I want.
Basically what’s happening is that the QUAD is rotating around the top
left vertex and not around the quad’s center. I would like it to rotate
around the center of the quad. This this how OpenGL works or am I doing
something wrong? The code is as follow:
when you rotate something, it rotates from (0,0,0), so if you want your quad
to be rotated from the center, you need to make it so the center of the quad
is centered at (0,0,0) like above.
OpenGL rocks doesnt it? Im glad SDL supports it (:> ----- Original Message -----
From: bslayerw@mindspring.com (Byron Wright)
To: “SDL Mailing List”
Sent: Wednesday, September 11, 2002 6:29 PM
Subject: [SDL] SDL/OpenGL
Hi all,
Not sure if this is SDL or OpenGL related, I am trying to simple rotate
a QUAD (yes very newbie question) but am not getting the results I want.
Basically what’s happening is that the QUAD is rotating around the top
left vertex and not around the quad’s center. I would like it to rotate
around the center of the quad. This this how OpenGL works or am I doing
something wrong? The code is as follow:
Thank you that worked.> ----- Original Message -----
From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org] On Behalf Of
Atrix Wolfe
Sent: Wednesday, September 11, 2002 6:38 PM
To: sdl at libsdl.org
Subject: Re: [SDL] SDL/OpenGL
yeah…its easy…try this, change your vertexes to this:
when you rotate something, it rotates from (0,0,0), so if you want your
quad to be rotated from the center, you need to make it so the center of
the quad is centered at (0,0,0) like above.
OpenGL rocks doesnt it? Im glad SDL supports it (:
----- Original Message -----
From: @Byron_Wright (Byron Wright)
To: “SDL Mailing List”
Sent: Wednesday, September 11, 2002 6:29 PM
Subject: [SDL] SDL/OpenGL
Hi all,
Not sure if this is SDL or OpenGL related, I am trying to simple
rotate a QUAD (yes very newbie question) but am not getting the
results I want. Basically what’s happening is that the QUAD is
rotating around the top left vertex and not around the quad’s center.
I would like it to rotate around the center of the quad. This this how
OpenGL works or am I doing something wrong? The code is as follow:
Not sure if this is SDL or OpenGL related, I am trying to simple rotate
a QUAD (yes very newbie question) but am not getting the results I
want.
Basically what’s happening is that the QUAD is rotating around the top
left vertex and not around the quad’s center. I would like it to rotate
around the center of the quad. This this how OpenGL works or am I doing
something wrong? The code is as follow:
First rotate, then translate - multiplication of transformation
matrices is not commutative (I really need a mathametical
german-english dictionary … =) - meaning:
Translate -> rotate is different from rotate -> translate
You’re always rotating around the center of your coordinate system. So
if you want only your quad rotated first translate it to 0,0,0, rotate
and after this translate back.
I’m new to this list, so let me introduce myself.
My name is Nils Hesse, I’m 16 years old and from germany.
I’m programming since about 3 years.
Now my problem:
I know how to put a pixel with SDL, shure, but how can I get the RGB value of a pixel
from a bitmap, which is loaded as SDL_Surface and as an OpenGL texture?
Should I use OpenGL functions or some from the SDL?
Which can I use?
Maybe you can give a link or code example…
Thanks a lot for helping----------------------------------------
Mit freundlichen Gr??en
Nils Hesse
I’m new to this list, so let me introduce myself.
My name is Nils Hesse, I’m 16 years old and from germany.
I’m programming since about 3 years.
Now my problem:
I know how to put a pixel with SDL, shure, but how can I get the RGB value of a pixel
from a bitmap, which is loaded as SDL_Surface and as an OpenGL texture?
Am 15 Nov 2004 um 11:39 hat Bill Kendrick geschrieben:
Hi,
I’m new to this list, so let me introduce myself.
My name is Nils Hesse, I’m 16 years old and from germany.
I’m programming since about 3 years.
Now my problem:
I know how to put a pixel with SDL, shure, but how can I get the RGB value of a
pixel> On Mon, Nov 15, 2004 at 08:31:37PM +0100, @slin_at_slin-online wrote:
from a bitmap, which is loaded as SDL_Surface and as an OpenGL texture?
I can’t answer with regards to OpenGL, but for a normal SDL_Surface *,
you can examine the “pixels” element of the struct.
e.g.:
p = (Uint8 *) (((Uint8 *)surface->pixels) + /* Start at top of RAM */
(y * surface->pitch) + /* Go down Y lines */
(x * bpp)); /* Go in X pixels */
And then, depending on the value of ‘surface->format->BytesPerPixel’,
examine the “p” pointer in different ways.
I pretty much based my code on the tutorial found here: