Login  Register

Re: 1D Texture with OpenGL or Cg Shader

Posted by Sven Gothel on Sep 23, 2010; 10:50pm
URL: https://forum.jogamp.org/1D-Texture-with-OpenGL-or-Cg-Shader-tp1398178p1570938.html

On Monday, September 13, 2010 14:00:16 Demoscene Passivist [via jogamp] wrote:

>
> >what methods are missing? We could add a few shortcuts...
>
> Cool, modifying/extending the API would be really helpful here. Let me
> explain where the problem lies:
>
> In the TextureRenderer API theres no way to set the texture target. It
> implicitly generates a GL_TEXTURE_2D Texture internally wich u can obtained
> via getTexture() . Ok, then I got the Texture and tried to modifiy the
> target to GL_TEXTURE_1D directly. But in the Texture API theres only a
> getTarget() method. So I dug deeper into the rabbithole and tried to change
> the target via updateImage(TextureData data, int target) using a custom
> generated TextureData object. But that more or less failed because the
> constructor for TextureData wants the data as NIO Buffer. And so here we are
> going round in circles juggling around with Buffers what we wanted to avoid
> in the first place when using TextureRenderer ...
>
> So my suggestion for TextureRenderer is: Add a method to directly change the
> texture target e.g. "setTarget(int inTarget)". For the sake of encapslation
> this maybe put into the Texture class and two "higher-level" functions e.g.
> "setTexture1D()" "setTexture2D()" could be added to the TextureRenderer API.

sounds very reasonable, looking forward to reviewing your pull request.
thx a lot.

damn .. now I have to order those t-shirts ! :)
thx for those too!

~Sven