Load float array with 3D texture?Why are the GLSL texture-coordinates in my shader not linear?How to bind 2 textures correctlyGLSL Reading From Sampler3d textureopengl 3.1 textures not loadingCreate and use floating point texture in OpenGLOpenGL: Mapping texture on a sphere using spherical coordinatesOpenGL Bindless Textures: Bind to uniform sampler2D arrayWhat am I doing wrong, in regards to multi-texture(OpenGL)?Pass texture with float values to shaderStore array of floats in texture & access the floats from the shader using texture coordinates

Does the app TikTok violate trademark?

Is population size a parameter, or sample size a statistic?

What does it mean by "my days-of-the-week underwear only go to Thursday" in this context?

Create the same subfolders in another folder

お仕事に学校頑張って meaning

Another student has been assigned the same MSc thesis as mine (and already defended)

How fast can a LN payment be over TOR?

Lost passport which have valid student visa but I make new passport unable paste

Can a passenger predict that an airline is about to go bankrupt?

A famous scholar sent me an unpublished draft of hers. Then she died. I think her work should be published. What should I do?

Equations with summation ("sum") symbols

Pushing the e-pawn

Is there a relationship between prime numbers and music?

Whaling ship logistics

Lambda functions with template parameters, not in function parameters

Why aren't faces sharp in my f/1.8 portraits even though I'm carefully using center-point autofocus?

Knights and Knaves: What does C say?

Assembly of PCBs containing a mix of SMT and thru-hole parts?

How to justify getting additional team member when the current team is doing well?

Why does C++ have 'Undefined Behaviour' and other languages like C# or Java don't?

Why does my browser attempt to download pages from http://clhs.lisp.se instead of viewing them normally?

Is there a list of world wide upcoming space events on the web?

An impressive body of work

Where to find the Arxiv endorsement code?



Load float array with 3D texture?


Why are the GLSL texture-coordinates in my shader not linear?How to bind 2 textures correctlyGLSL Reading From Sampler3d textureopengl 3.1 textures not loadingCreate and use floating point texture in OpenGLOpenGL: Mapping texture on a sphere using spherical coordinatesOpenGL Bindless Textures: Bind to uniform sampler2D arrayWhat am I doing wrong, in regards to multi-texture(OpenGL)?Pass texture with float values to shaderStore array of floats in texture & access the floats from the shader using texture coordinates






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















i have a float array with intensity value, i need load this array as 3d texture in opengl, and in the fragment shader read this as red color (float sample= texture(cord,volumeText).r).
the size of array is 256*256*256, and the intensity value are between 0.0 to 256.0.



this is a sample of intensity values:



 75.839354473071637, 
64.083049468866022,
65.253933716444365,
79.992431196592577,
84.411485976957096,
0.0000000000000000,
82.020319431382831,
76.808403454586994,
79.974774618246158,
0.0000000000000000,
91.127273013466336,
84.009956557448433,
90.221356094672814,
87.567422484025627,
71.940263118478072,
0.0000000000000000,
0.0000000000000000,
74.487058398181944,
..................,
..................









share|improve this question


























  • It is not exactly clear what precision requirements you have.

    – derhass
    Mar 28 at 20:27

















1















i have a float array with intensity value, i need load this array as 3d texture in opengl, and in the fragment shader read this as red color (float sample= texture(cord,volumeText).r).
the size of array is 256*256*256, and the intensity value are between 0.0 to 256.0.



this is a sample of intensity values:



 75.839354473071637, 
64.083049468866022,
65.253933716444365,
79.992431196592577,
84.411485976957096,
0.0000000000000000,
82.020319431382831,
76.808403454586994,
79.974774618246158,
0.0000000000000000,
91.127273013466336,
84.009956557448433,
90.221356094672814,
87.567422484025627,
71.940263118478072,
0.0000000000000000,
0.0000000000000000,
74.487058398181944,
..................,
..................









share|improve this question


























  • It is not exactly clear what precision requirements you have.

    – derhass
    Mar 28 at 20:27













1












1








1








i have a float array with intensity value, i need load this array as 3d texture in opengl, and in the fragment shader read this as red color (float sample= texture(cord,volumeText).r).
the size of array is 256*256*256, and the intensity value are between 0.0 to 256.0.



this is a sample of intensity values:



 75.839354473071637, 
64.083049468866022,
65.253933716444365,
79.992431196592577,
84.411485976957096,
0.0000000000000000,
82.020319431382831,
76.808403454586994,
79.974774618246158,
0.0000000000000000,
91.127273013466336,
84.009956557448433,
90.221356094672814,
87.567422484025627,
71.940263118478072,
0.0000000000000000,
0.0000000000000000,
74.487058398181944,
..................,
..................









share|improve this question
















i have a float array with intensity value, i need load this array as 3d texture in opengl, and in the fragment shader read this as red color (float sample= texture(cord,volumeText).r).
the size of array is 256*256*256, and the intensity value are between 0.0 to 256.0.



this is a sample of intensity values:



 75.839354473071637, 
64.083049468866022,
65.253933716444365,
79.992431196592577,
84.411485976957096,
0.0000000000000000,
82.020319431382831,
76.808403454586994,
79.974774618246158,
0.0000000000000000,
91.127273013466336,
84.009956557448433,
90.221356094672814,
87.567422484025627,
71.940263118478072,
0.0000000000000000,
0.0000000000000000,
74.487058398181944,
..................,
..................






opengl glsl textures






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 19:36









Rabbid76

61.1k14 gold badges40 silver badges73 bronze badges




61.1k14 gold badges40 silver badges73 bronze badges










asked Mar 28 at 19:00









sebastian pintosebastian pinto

296 bronze badges




296 bronze badges















  • It is not exactly clear what precision requirements you have.

    – derhass
    Mar 28 at 20:27

















  • It is not exactly clear what precision requirements you have.

    – derhass
    Mar 28 at 20:27
















It is not exactly clear what precision requirements you have.

– derhass
Mar 28 at 20:27





It is not exactly clear what precision requirements you have.

– derhass
Mar 28 at 20:27












1 Answer
1






active

oldest

votes


















2
















To load a texture like this you can use the input format GL_RED and type GL_FLOAT. A proper sized internal format for is GL_R16F. See glTexImage3D:



glTexImage3D(GL_TEXTURE_3D, 0, GL_R16F, 256, 256, 256, 0, GL_RED, GL_FLOAT, dataPtr)


The internal format GL_R16F is a floating point format. This means when you read the red color channel (.r) from the texture in the fragment shader, then the values are still in range [0.0, 256.0].






share|improve this answer



























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405064%2fload-float-array-with-3d-texture%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2
















    To load a texture like this you can use the input format GL_RED and type GL_FLOAT. A proper sized internal format for is GL_R16F. See glTexImage3D:



    glTexImage3D(GL_TEXTURE_3D, 0, GL_R16F, 256, 256, 256, 0, GL_RED, GL_FLOAT, dataPtr)


    The internal format GL_R16F is a floating point format. This means when you read the red color channel (.r) from the texture in the fragment shader, then the values are still in range [0.0, 256.0].






    share|improve this answer





























      2
















      To load a texture like this you can use the input format GL_RED and type GL_FLOAT. A proper sized internal format for is GL_R16F. See glTexImage3D:



      glTexImage3D(GL_TEXTURE_3D, 0, GL_R16F, 256, 256, 256, 0, GL_RED, GL_FLOAT, dataPtr)


      The internal format GL_R16F is a floating point format. This means when you read the red color channel (.r) from the texture in the fragment shader, then the values are still in range [0.0, 256.0].






      share|improve this answer



























        2














        2










        2









        To load a texture like this you can use the input format GL_RED and type GL_FLOAT. A proper sized internal format for is GL_R16F. See glTexImage3D:



        glTexImage3D(GL_TEXTURE_3D, 0, GL_R16F, 256, 256, 256, 0, GL_RED, GL_FLOAT, dataPtr)


        The internal format GL_R16F is a floating point format. This means when you read the red color channel (.r) from the texture in the fragment shader, then the values are still in range [0.0, 256.0].






        share|improve this answer













        To load a texture like this you can use the input format GL_RED and type GL_FLOAT. A proper sized internal format for is GL_R16F. See glTexImage3D:



        glTexImage3D(GL_TEXTURE_3D, 0, GL_R16F, 256, 256, 256, 0, GL_RED, GL_FLOAT, dataPtr)


        The internal format GL_R16F is a floating point format. This means when you read the red color channel (.r) from the texture in the fragment shader, then the values are still in range [0.0, 256.0].







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 28 at 19:32









        Rabbid76Rabbid76

        61.1k14 gold badges40 silver badges73 bronze badges




        61.1k14 gold badges40 silver badges73 bronze badges

































            draft saved

            draft discarded















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405064%2fload-float-array-with-3d-texture%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript