SDL_DisplayFormat and OpenGL

Hello,

I am trying to add texturing to Power3D, and and I was hoping to use the
PowerDraw functions, but when I load a BMP it comes out backward and
color inverted unless I use the LoadImage function in Sam’s tutorials,
however if I use that function on a JPEG I get the colors inverted, but
the image comes out correct if I don’t use it. I was hoping that
SDL_DisplayFormat would stop the problem as it would insure that all the
data is the same, I have support for RGB and RGBA data so it isn’t that,
but I figure something different must be in JPEGs and PCXs that would
cause them to load differently.
The problem is SDL_DisplayFormat just jumbles up the image and makes it
look like static. So what I am wondering is if there is a way to make
SDL_Display format work with OpenGL, or an equivalent maybe, and if not
is there another way around this?

hi
got the problem that when i use these matimatical functions my
compiler gets for cos(180) = 0.5XXXX and it should be -1 !!!
I includeded math.h and all the things seem to be ok - but when i
tried just du uses these functions in a console-programm and compile
it with “cc -o programm programm.c -lm” it even didn’t work - what’s
wrong ?
It isn’t a fault of SDL and it’s not a fault of my libs i think.
Could someone please help me.

Thank you very much.
Bye–
From:
Joachim Schiele
[ http://www.dune2.de || Linux - my way! ]

hello,

don’t forget that cos, sin and tan functions want you tu use radian.
use cos(pi), then you’ll have -1.

hope it helps,
PH.> hi

got the problem that when i use these matimatical functions my
compiler gets for cos(180) = 0.5XXXX and it should be -1 !!!
I includeded math.h and all the things seem to be ok - but when i
tried just du uses these functions in a console-programm and compile
it with “cc -o programm programm.c -lm” it even didn’t work - what’s
wrong ?

Maybe you should give the angle in radian not in degree ? :wink:

cos(6.283)=1.000000
cos(180.0)=-0.598460

Herve PARISSI
"You assume too much" (The Menace Phantom)> ----- Original Message -----

From: js@dune2.de (Joachim Schiele)
To:
Sent: Sunday, June 18, 2000 10:40 AM
Subject: [SDL] cos,sin,tan

hi
got the problem that when i use these matimatical functions my
compiler gets for cos(180) = 0.5XXXX and it should be -1 !!!
I includeded math.h and all the things seem to be ok - but when i
tried just du uses these functions in a console-programm and compile
it with “cc -o programm programm.c -lm” it even didn’t work - what’s
wrong ?
It isn’t a fault of SDL and it’s not a fault of my libs i think.
Could someone please help me.

Thank you very much.
Bye


From:
Joachim Schiele
[ http://www.dune2.de || Linux - my way! ]

Maybe you should give the angle in radian not in degree ? :wink:

cos(6.283)=1.000000
cos(180.0)=-0.598460

Herve PARISSI
"You assume too much" (The Menace Phantom)

here is it: i figured it out and this is the way it works for me:

cur_angle = cos(60 * (3.141592654/180.0));

cos(60) in radiant means
cos(60 * (PI/180))

enjoy

and you will get it right.On Son, 18 Jun 2000, you wrote:

----- Original Message -----
From: “Joachim Schiele” <@Joachim_Schiele>
To:
Sent: Sunday, June 18, 2000 10:40 AM
Subject: [SDL] cos,sin,tan

hi
got the problem that when i use these matimatical functions my
compiler gets for cos(180) = 0.5XXXX and it should be -1 !!!
I includeded math.h and all the things seem to be ok - but when i
tried just du uses these functions in a console-programm and compile
it with “cc -o programm programm.c -lm” it even didn’t work - what’s
wrong ?
It isn’t a fault of SDL and it’s not a fault of my libs i think.
Could someone please help me.

Thank you very much.
Bye


From:
Joachim Schiele
[ http://www.dune2.de || Linux - my way! ]

From:
Joachim Schiele
[ http://www.dune2.de || Linux - my way! ]

here is it: i figured it out and this is the way it works for me:

cur_angle = cos(60 * (3.141592654/180.0));

Isn’t there an “M_PI” constant defined in math.h that one can use
instead of “3.14159…”?

I use it, but I’m not sure if it’s a Un*x-only kinda thing…

-bill!

here is it: i figured it out and this is the way it works for me:

cur_angle = cos(60 * (3.141592654/180.0));

Isn’t there an “M_PI” constant defined in math.h that one can use
instead of “3.14159…”?
think there is something like this - thankz

I use it, but I’m not sure if it’s a Un*x-only kinda thing…

-bill!

here is even more of this:
some examples and so on…

http://www.intersrv.com/~dcross/fasttrig.htmlOn Son, 18 Jun 2000, you wrote:


From:
Joachim Schiele
[ http://www.dune2.de || Linux - my way! ]

Isn’t there an “M_PI” constant defined in math.h that one can use
instead of “3.14159…”?

I use it, but I’m not sure if it’s a Un*x-only kinda thing…

It seems to be. I do have to define it myself on win32 and macintosh.

  • Andreas–
    Check out my 3D lightcycle game: http://www.gltron.org
    More than 60’000 Downloads of the latest version (0.59)

Isn’t there an “M_PI” constant defined in math.h that one can use
instead of “3.14159…”?

I use it, but I’m not sure if it’s a Un*x-only kinda thing…
I am pretty sure it is a Unix only thing, i tried to compile a game that
used the M_PI macro and the compiler complained. I think that PI works
on windows machines but im not sure. If it doesnt, just add the
following code:

#ifndef M_PI
#define M_PI 3.14159265358979323846 /* pi */
#endif

—Parasite

Hi, is it any use to call SDL_DisplayFormat(Alpha) when the surface will
be used as an OpenGL texture?

O.