Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

code to scale a texture GL compliant (2^N * 2^N)

1 view
Skip to first unread message

Torsten Mohr

unread,
Aug 29, 2002, 7:00:24 AM8/29/02
to
Hi,

has anybody got some C code that gets a 2D input region (image)
(RGB or RGBA, unsigned byte) and its dimension and converts
it to an image that can be used for textures (has dimensions
2^N * 2^N)?

The conversion should be done in high quality (bi-linear or
bi-cubic filtering).

Something like:

void convert(
void* src,
int type,
int width_src,
int height_src,
void** dest,
int* width_and_height_dest,
);


By the way, how is bi-linear scaling done at the edges any way,
when i access points outside of the source, do i just take the
color value of the border?

Thanks,
Torsten.

yooyo

unread,
Aug 29, 2002, 8:50:00 AM8/29/02
to
Check this one....

int APIENTRY gluScaleImage (
GLenum format,
GLint widthin,
GLint heightin,
GLenum typein,
const void *datain,
GLint widthout,
GLint heightout,
GLenum typeout,
void *dataout);

Torsten Mohr

unread,
Aug 29, 2002, 1:49:13 PM8/29/02
to
Ouch,

i didn't know that one, i think that's what i need.


Thanks,
Torsten.

Wolfgang Draxinger

unread,
Aug 30, 2002, 7:30:31 AM8/30/02
to
yooyo wrote:
> Check this one....
>
> int APIENTRY gluScaleImage (
> GLenum format,
> GLint widthin,
> GLint heightin,
> GLenum typein,
> const void *datain,
> GLint widthout,
> GLint heightout,
> GLenum typeout,
> void *dataout);
>

Argh, gluScaleImage has a few really messy bugs. Don't use it!
There are other file image scaling functions out there.

--
+------------------------------------------------+
| +----------------+ WOLFGANG DRAXINGER |
| | ,-. DARKSTAR | lead programmer |
| |( ) +---------+ wdrax...@darkstargames.de |
| | `-' / GAMES / |
| +----+'''''''' http://www.darkstargames.de |
+------------------------------------------------+

Ruud van Gaal

unread,
Aug 30, 2002, 9:11:31 AM8/30/02
to
On Fri, 30 Aug 2002 13:30:31 +0200, Wolfgang Draxinger
<wdrax...@darkstargames.de> wrote:

>yooyo wrote:
>> Check this one....
>>
>> int APIENTRY gluScaleImage (
>> GLenum format,
>> GLint widthin,
>> GLint heightin,
>> GLenum typein,
>> const void *datain,
>> GLint widthout,
>> GLint heightout,
>> GLenum typeout,
>> void *dataout);
>>
>
>Argh, gluScaleImage has a few really messy bugs. Don't use it!
>There are other file image scaling functions out there.

Incredible that this hasn't been fixed at some point, and we're
already at OpenGL1.4 something (theoretically).


Ruud van Gaal
Free car sim: http://www.racer.nl/
Pencil art : http://www.marketgraph.nl/gallery/

Wolfgang Draxinger

unread,
Aug 30, 2002, 9:28:19 AM8/30/02
to
Ruud van Gaal wrote:
> Incredible that this hasn't been fixed at some point, and we're
> already at OpenGL1.4 something (theoretically).
>

Problem is, that glu != OpenGL, so it hasn't been updated since OpenGL
1.1 ...

Charles E Hardwidge

unread,
Aug 30, 2002, 9:48:18 AM8/30/02
to
>Problem is, that glu != OpenGL

Strictly speaking it is as to qualify for use of the OpenGL name an
implementation must include GL and GLU, which is one of the reasons why 3Dfx
got into hot water over their standalone OpenGL drivers and had to rename
them "Quake compatible." Why they never bothered to supply a GLU executeable
escapes me to this day.

--
Charles E Hardwidge
http://www.hardwidge.org.uk


fungus

unread,
Aug 30, 2002, 11:53:28 AM8/30/02
to
Charles E Hardwidge wrote:
>>Problem is, that glu != OpenGL
>
>
> Strictly speaking it is as to qualify for use of the OpenGL name an
> implementation must include GL and GLU, which is one of the reasons why 3Dfx
> got into hot water over their standalone OpenGL drivers and had to rename
> them "Quake compatible." Why they never bothered to supply a GLU executeable
> escapes me to this day.
>

I could be wrong but I think glu just calls OpenGL
functions - any old glu will do, it doesn't have to
be part of the driver.

In fact I recall reading an article on this where
people were complaining that gluNurbs couldn't be
done in hardware because glu wasn't part of the ICD.

--
<\___/>
/ O O \
\_____/ FTB.

Charles E Hardwidge

unread,
Aug 30, 2002, 12:42:58 PM8/30/02
to
>I could be wrong but I think glu just calls OpenGL
>functions - any old glu will do, it doesn't have to
>be part of the driver.

The 3Dfx standalone drivers were never part of the ICD mechanism. That is
why they had to supply GLU to claim the name OpenGL. Because they were too
lazy (or greedy) to bother doing it the driver had to be renamed to "Quake
compatible."

I can't remember clearly now. But, I think some of the function calls were
different so the system glu or mesa glu was useless. You had to build a
version specifically linked against it.

After 3Dfx started pulling stunts with ropey drivers and leaving customers
of cards that weren't the latest model out in the cold, I decided from that
point on never to support a proprietary 3Dfx feature ever again.
Coincidently they went bust within the year.

>In fact I recall reading an article on this where
>people were complaining that gluNurbs couldn't be
>done in hardware because glu wasn't part of the ICD.

I remember seeing an item on opengl.org last year where some IHV was
flogging an accelerated GLU implementation. Never heard of it again.
Replacing the system GLU with an IHV GLU is a bit naughty. Although it would
have to be aware of what implementation was running, I don't see why it
couldn't be done.

My own position on the OpenGL ICD issue is that Microsoft should be forced
to allow anyone who wants to produce a graphics API have free and fair
access to the underlying driver mechanism without being wrapped in NDA's. I
don't see it any differently to the Java/Netscape issue.

They're using their monopoly control of the Win32 platform to stifle
competition of their own competing (D3D) product. Following on from this,
the cost to developers and customers of the D3D version mess is most likely
measured in the hundreds of millions.

Torsten Mohr

unread,
Aug 30, 2002, 1:32:48 PM8/30/02
to
Hi Wolfgang,

> Argh, gluScaleImage has a few really messy bugs. Don't use it!
> There are other file image scaling functions out there.

thanks for that warning.

At the moment i use OpenIL for scaling an image, but that's a lot
of overhead for just rescaling an image (though OpenIL is a very
useful thing).

What is your preferred solution for scaling?


Regards,
Torsten.

0 new messages