GLubyte equivalent

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GLubyte equivalent

rullie
Hello,
  I am procedurally generating a texture and calling glTexImage1D.  The last parameter asks for a Buffer, should I be putting in ByteBuffer? If so, is the second last parameter GL_UNSIGNED_BYTE? Would Byte.MAX_VALUE be equivalent to (GLubyte)255?

Thanks in advance.
Regards,
rullie
Reply | Threaded
Open this post in threaded view
|

Re: GLubyte equivalent

Sven Gothel
Administrator
On Tuesday, August 31, 2010 07:34:42 pm rullie [via jogamp] wrote:
>
> Hello,
>   I am procedurally generating a texture and calling glTexImage1D.  The last
> parameter asks for a Buffer, should I be putting in ByteBuffer? If so, is
> the second last parameter GL_UNSIGNED_BYTE? Would Byte.MAX_VALUE be
> equivalent to (GLubyte)255?

You have to use the byte, or NIO's ByteBuffer respectively
and encode the data as it would be unsigned.

http://www.darksleep.com/player/JavaAndUnsignedTypes.html

We use this kind of an approach all over the place ..

Hope it helps, Sven

>
> Thanks in advance.
> Regards,
> rullie
>
> ______________________________________
> View message @ http://jogamp.762907.n3.nabble.com/GLubyte-equivalent-tp1395467p1395467.html
> To start a new topic under jogamp, email [hidden email]
> To unsubscribe from jogamp, click http://jogamp.762907.n3.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=762907&code=c2dvdGhlbEBqYXVzb2Z0LmNvbXw3NjI5MDd8NDU1NjU4MjUx
>


Reply | Threaded
Open this post in threaded view
|

Re: GLubyte equivalent

Sven Gothel
Administrator
In reply to this post by rullie
On Tuesday, August 31, 2010 07:34:42 pm rullie [via jogamp] wrote:
>
> Hello,
>   I am procedurally generating a texture and calling glTexImage1D.  The last
> parameter asks for a Buffer, should I be putting in ByteBuffer? If so, is
> the second last parameter GL_UNSIGNED_BYTE? Would Byte.MAX_VALUE be
> equivalent to (GLubyte)255?
>

http://bytes.com/topic/java/answers/517554-unsigned-byte-values

another .. hack ..

> Thanks in advance.
> Regards,
> rullie
>
> ______________________________________
> View message @ http://jogamp.762907.n3.nabble.com/GLubyte-equivalent-tp1395467p1395467.html
> To start a new topic under jogamp, email [hidden email]
> To unsubscribe from jogamp, click http://jogamp.762907.n3.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=762907&code=c2dvdGhlbEBqYXVzb2Z0LmNvbXw3NjI5MDd8NDU1NjU4MjUx
>