[gameprogrammer] Re: is safe this?
- From: "Alan Wolfe" <alan.wolfe@xxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Tue, 28 Nov 2006 09:42:02 -0800
yes that is safe (:
the reason why is GLuint is just a "number" type (ie 1,2,3,4...or 1000 etc).
so when you call glGenTexture it's creating a texture in video memory
and then creating a unique ID# for that texture and storing that ID#
in tmp.
When you return that from the function it's just returning the ID# (handle).
When you return tmp, you are'nt returning the image data itself to the
calling function, you are just returning the unique ID # of the image
data.
If I remember right, that image data will stay in video memory until
either your program ends, or until you tell gl to destroy that
texture.
On 11/28/06, Roger D Vargas <luo_hei@xxxxxxxx> wrote:
Is safe to create a GL texture and return it as function result?
Im thinking to implement an image loading and conversion function like this:
GLuint load(char *file)
{
GLuint tmp
load image ***
glGenTexture(1,&tmp)
convert surface to texture
return tmp
}
But Im not sure if the returned value can be safely used as a texture.
--
http://dsgp.blogspot.com | Linux, programación, juegos
Have no place I can be since I found Serenity
But you can't take the sky from me
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- References:
- [gameprogrammer] is safe this?
- From: Roger D Vargas
Other related posts:
- » [gameprogrammer] is safe this?
- » [gameprogrammer] Re: is safe this?
Is safe to create a GL texture and return it as function result?
Im thinking to implement an image loading and conversion function like this:
GLuint load(char *file)
{
GLuint tmp
load image ***
glGenTexture(1,&tmp)
convert surface to texture
return tmp
}
But Im not sure if the returned value can be safely used as a texture.
--
http://dsgp.blogspot.com | Linux, programación, juegos
Have no place I can be since I found Serenity
But you can't take the sky from me
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- [gameprogrammer] is safe this?
- From: Roger D Vargas