c++ - Direct3d and hlsl varying size vertices and multiddimensional geometric objects? -


i'm new direct3d , graphics, hlsl , c++ , , i'm trying write program render different geometric multidimensional shapes (for example hypercube), program supposed receive vertices user after user has defined number of dimensions , draw , rotate , translate shape .

  • the first problem how define dynamic vertex structure (is okay use pointers).

  • second: project shape x-dimensional 3-dimensional space ,should in code (cpu), or possible pass object vertices , projection matrices shader(hlsl) , if how (especially matrices of varying size defined @ runtime).

  • same problem above view matrix (let's object 4-d want program zoom in/out-> approach , or move in x-direction in 4-d space "i want deal object's space rather it's projection's space")

  • third: if of above wasn't possible in shader can use c++amp(or it's alternatives) accelerate execution of such operations in main program or cause performance degradation "draw()" function.

i have searched web , "stackoverflow" couldn't find of use.

disclaimer: i'm not expert in gpus , shaders; , i've used opengl/webgl/glsl rather direct3d/hlsl. i'm answering question because no 1 else has. :-)

regarding pointers: i'm pretty sure can't use pointers within gpu, since data send gpu have unpredictable addresses (locations) in gpu memory.

but regarding dynamic data structures (variable number of dimensions), seems varying "size" parameter passed vertexattribpointer() or equivalent. pass in flat array containing vertex coordinates, n coordinates per vertex; , use size parameter tell shader n is.

then in vertex shader, can project data n dimensions 3, using projection matrix construct in shader parameters passed in.

i think similarly, in fragment (pixel) shader, can project data 3 dimensions 2, using view matrix construct in shader parameters passed in.

hopefully started, can point of asking more specific questions. honest, i've not found productive place getting questions answered graphics, other topics, python. might have better luck asking on web site specific direct3d.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -