Re: 1D Texture with OpenGL or Cg Shader
Posted by
Demoscene Passivist on
Sep 13, 2010; 12:00pm
URL: https://forum.jogamp.org/1D-Texture-with-OpenGL-or-Cg-Shader-tp1398178p1465077.html
>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.