Page 4 of 4 FirstFirst 1234
Results 121 to 147 of 147

Thread: Direct2D Typelib+ for VB6

  1. #121
    New Member
    Join Date
    Jul 2019
    Posts
    1

    Re: Direct2D Typelib+ for VB6

    Well , CreateDCRenderTarget and BindDC doesn't work properly ...
    oleviewer shows that the type of the second paramarray of BindDC can't read ...
    Error 32810(Unknown Error)

  2. #122
    Lively Member
    Join Date
    Jun 2016
    Posts
    93

    Re: Direct2D Typelib+ for VB6

    wrong post
    Last edited by xman2000; Dec 7th, 2020 at 01:52 AM.

  3. #123
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,515

    Re: Direct2D Typelib+ for VB6

    - can you share a load file, draw project?
    - can i get\set pixels using the HDC or hBitmap?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  4. #124

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2014
    Posts
    1,441

    Re: Direct2D Typelib+ for VB6

    Direct2D uses ID2D1Bitmap not hBitmap.
    you can create a IWICBitmap from a hBitmap (CreateCompatibleBitmap) using the CreateBitmapFromHBITMAP from WICImagingFactory

    so its possible to copy a hBitmap to IWICBitmap and make it a ID2D1Bitmap that you can use to render.
    but why do you want to do that?

    better work with WIC/Direct2D

    I have never worked with pixel data,
    but theres tons of functions. check the property of each container and look into microsoft direct2d pages for information.

  5. #125
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,515

    Re: Direct2D Typelib+ for VB6

    my code is very slow
    VB6 2D Sprite control

    To live is difficult, but we do it.

  6. #126

  7. #127

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2014
    Posts
    1,441

    Re: Direct2D Typelib+ for VB6

    in Direct2D, what u do is to paint a ID2D1Bitmap, in any way u want, and after that render the entire ID2D1Bitmap to a picturebox/form.
    this should be very fast since you are working in GPU.

    so, you are saying you want to use a get/set pixel. why?
    are there any other way to draw? why do you need to get? is there a purpose for that?
    why can't you just load .png pictures and render those onto the screen, or use any functions, like rectangle, circle, polygons etc together with a brush of your choosing?

    any manual loop takes time,
    if you want to loop through the entire screen it will slow things down,
    its like, if I try to use a Sinc and Lanczos resampling it will takes a lot of time to do that. that is why I would never try to make such thing, at least not in a "real-time" situation.
    Direct2D offer Nearest-neighbor and linear interpolation so Im stuck with those.

    what I can do, is to use WIC, that offer WICBitmapInterpolationModeCubic that I use to resize on load, instead of real-time use of linear interpolation that is not as good.

  8. #128
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,515

    Re: Direct2D Typelib+ for VB6

    - we have a 3D plane(it's like a flat rectangle but on 3D world);
    - using that 4 3D points, i can get the left and right(both vertical) lines points;
    - using that points, we can have the origin and destination of the horizontal line;
    - know the horizontal line points, we can draw the image on a pixel way.
    that's why i need a pixel way... unless you can advice me a better method... and yes the 4 points can have Z different coordinates.
    the Stretchblt() API don't works, for draw the entire horizontal line, because the Z can be different.
    VB6 2D Sprite control

    To live is difficult, but we do it.

  9. #129

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2014
    Posts
    1,441

    Re: Direct2D Typelib+ for VB6

    working with 3D is much better with DirectX,
    we have directx9 typelib by the Trick, that can deal with such things and render it fast.
    Direct2D is suited for 2D work.

    not sure if this is enough, its quite new but it uses DirectX11, I would also look into it first and see if its enough:
    https://www.vbforums.com/showthread....0-Type-Library

    but theres a lot more for DirectX9
    if so check
    https://www.vbforums.com/showthread....-VB6-Direct3D9
    other threads of interests
    https://www.vbforums.com/showthread....601&viewfull=1
    https://www.vbforums.com/showthread....-getting-error

  10. #130
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,515

    Re: Direct2D Typelib+ for VB6

    the tutorial\book of directx9, will help me use these library? or the Trick have is own doc?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  11. #131

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2014
    Posts
    1,441

    Re: Direct2D Typelib+ for VB6

    check the 3 threads that is all about DirectX9, theres sources to download and examples to check.
    theres no .pdf/.doc to download but theres tons of information if you check
    https://docs.microsoft.com/en-us/win...9/dx9-graphics

    even if the source code is not VB6, its almost the same since the name are the same.

  12. #132

  13. #133
    PowerPoster
    Join Date
    Jun 2013
    Posts
    5,473

    Re: Direct2D Typelib+ for VB6

    Quote Originally Posted by joaquim View Post
    - we have a 3D plane(it's like a flat rectangle but on 3D world);
    - using that 4 3D points, i can get the left and right(both vertical) lines points;
    - using that points, we can have the origin and destination of the horizontal line;
    - know the horizontal line points, we can draw the image on a pixel way.
    that's why i need a pixel way... unless you can advice me a better method... and yes the 4 points can have Z different coordinates.
    the Stretchblt() API don't works, for draw the entire horizontal line, because the Z can be different.
    The term you are looking for is "texture" (aka "some bitmap in a 3D-context")

    And the problem you want solved is the "bread-and-butter"-stuff in 3D-scenarios:
    Texture-Mapping (the mapping of Bitmap-Points to arbitrary 3D-Surface-Objects).
    https://en.wikipedia.org/wiki/Textur...exture_mapping

    As said already, better to use a library which has builtin support for it -
    any 3D-lib (OpenGL, DirectX, etc.) will offer you:
    - APIs to "upload a texture-bitmap into the GPU"
    - APIs to "bind an uploaded texture to some Surface-Object" (a bunch of vertices)

    Olaf
    Last edited by Schmidt; Dec 25th, 2020 at 03:47 AM.

  14. #134
    Fanatic Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    578

    Re: Direct2D Typelib+ for VB6

    Quote Originally Posted by Schmidt View Post
    ...As said already, better to use a library which has builtin support for it -
    any 3D-lib (OpenGL, DirectX, etc.) will offer you:
    - APIs to "upload a texture-bitmap into the GPU"
    - APIs to "bind an uploaded texture to some Surface-Object" (a bunch of vertices)
    Olaf
    About OpenGL could someone tell me where to find the latest version (for VB6, with some useful tutorial)
    I did some research and failed.
    I have OpenGL API 2.0 tbl but it seems to me it does not support Fragment Shader GLSL language (which is what interests me the most)

    I am very interested in this, in fact I made a Raymarching renderer using DirectX11.
    I wanted to do it with OpenGL because I think it has a better language. But I don't find tutorials and examples.
    The most interesting thing I've found about OpenGL raymarching is a tutorial for Godot GameEngine. (which has a Shading Language very close to OpenGL)

    You can Download an example here of what I achieved (for now) using Godot.

    ps Merry Christmas to all !

  15. #135
    PowerPoster
    Join Date
    Jun 2013
    Posts
    5,473

    Re: Direct2D Typelib+ for VB6

    Quote Originally Posted by reexre View Post
    About OpenGL could someone tell me where to find the latest version (for VB6, with some useful tutorial)
    I did some research and failed.
    I have OpenGL API 2.0 tbl ...
    That's the version I have here as well (guess, nobody out there advanced it any further).
    But the good news is, that it is all "StdCall-able flat-APIs" - so, enhancements could be done via normal VB-Declares as well...

    Quote Originally Posted by reexre View Post
    I wanted to do it with OpenGL because I think it has a better language.
    But I don't find tutorials and examples.
    OpenGL is nice - and the primary lib for other platforms ...
    (DirectX would not be portable, therefore the 3D-classes of the RC6 will not be based on it).

    As for a decent (though still kept simple) tutorial - there is one (in german language) on ActiveVB.de (numbered from chapters 1 to 8).

    Below is a link to chapter3, which covers textures (which I plan to make uploadable, directly from Cairo-Surfaces)
    https://activevb.de/tutorials/opengl...tchapter3.html

    Here the google-translated link for english:
    https://translate.google.com/transla...tchapter3.html

    And (FWIW) also in italian:
    https://translate.google.com/transla...tchapter3.html


    Olaf

  16. #136
    Fanatic Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    578

    Re: Direct2D Typelib+ for VB6

    Thanks! Very interesting tutorials! (Lot to learn from)

    OpenGL Typelib for VB6 doesn't seem to have the key functions to do what I want.
    For example those functions found in this link
    https://learnopengl.com/Getting-started/Shaders
    glGetUniformLocation (shaderProgram, "ourColor");
    glUseProgram (shaderProgram);

    (It'd be cool there was a more updated Typelib! )

    What I'm most interested in is not so much the usage of inherent functions but the utilization of GPU speed using a Shader Language.
    This for me has two main purposes:
    1) - The realization of Rendering with RayMarching technique (here done with Godot)
    2) - If possible the integration of mini programs written in Shader language (GLSL/HLSL) to be used in my image manipulation program. This would speed up some Effects immensely.

    As you can see in the examples already given.
    The graphic results are the result of a Shader programs.
    This is the HLSL for DirectX code used in the example RayMarching with DirectX11 (using wqweto typelib).
    In this other example (made with Godot) inside the WindowsExport-32.pck file (to open with some text editor) you can see (glimpse) the code used to draw the whole scene.

    For a raw speed comparison the same Scene rendered with pure VB6 takes about 1.30 -2.00 minutes per frame, while with GPU (Shader language) a fragment of a second per frame. (If I'm not mistaken something in the order of magnitude 1000X or more.)


    EDIT:

    I have accomplished task one (The realization of Rendering with RayMarching technique )
    using TrueVision3D as support.

  17. #137

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2014
    Posts
    1,441

    Re: Direct2D Typelib+ for VB6

    a OpenGL class would be really nice to have.
    a class we can simply add to any project and use it to draw lines, rectangles, bitmaps etc
    including a non-gdi loading function so we can load pictures into textures directly.
    not sure why nobody thought of that?

  18. #138

  19. #139
    PowerPoster
    Join Date
    Jun 2013
    Posts
    5,473

    Re: Direct2D Typelib+ for VB6

    ...seems that someone did it (HLSL image processing) 10 years ago...
    I'm already working on GLSL support for at least the Vertex- and Fragment-shaders -
    you can expect some results at the end of next week ...

    Olaf

  20. #140

  21. #141
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,515

    Re: Direct2D Typelib+ for VB6

    thank you so much.
    i never programmed DirectX... i have DirectX 9 tutorials, but are for C\C++.. and not VB6.. so what you can advice for i learn more?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  22. #142
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,515

    Re: Direct2D Typelib+ for VB6

    from C++ - Beginning DirectX 9 book(it's for C\C++), we have:
    Code:
    LPDIRECT3D9 pD3D; // the Direct3D object
    LPDIRECT3DDEVICE9 pd3dDevice; // the Direct3D device
    but your library don't have these 2 types(LPDIRECT3D9 and LPDIRECT3DDEVICE9 ).... so how can i follow for learn it?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  23. #143
    Frenzied Member
    Join Date
    Feb 2015
    Posts
    1,780

    Re: Direct2D Typelib+ for VB6

    Quote Originally Posted by joaquim View Post
    thank you so much.
    i never programmed DirectX... i have DirectX 9 tutorials, but are for C\C++.. and not VB6.. so what you can advice for i learn more?
    You can use C++ tutorials. If you have questions you can ask them there (this thread also contains the examples) or create a new topic in the main section.

    Quote Originally Posted by joaquim View Post
    from C++ - Beginning DirectX 9 book(it's for C\C++), we have:
    Code:
    LPDIRECT3D9 pD3D; // the Direct3D object
    LPDIRECT3DDEVICE9 pd3dDevice; // the Direct3D device
    but your library don't have these 2 types(LPDIRECT3D9 and LPDIRECT3DDEVICE9 ).... so how can i follow for learn it?
    From MSDN:
    The LPDIRECT3DDEVICE9 and PDIRECT3DDEVICE9 types are defined as pointers to the IDirect3DDevice9 interface.

  24. #144
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,515

    Re: Direct2D Typelib+ for VB6

    i'm sorry, if i 'atack' your topic... but believe me that i'm not the only one getting these type initial problems.
    thank you so much for correct me.. and i saved that msnd link: https://docs.microsoft.com/en-us/win...pi/_direct3d9/
    and heres for who needs use the DirectX8(in VB 6): http://directx4vb.vbgamer.com/DirectX4VB/TUT_DX8_DG.asp
    now i can read that book without more problems
    thank you so much for all.. thank you... now i can start more easely... thanks
    readers: don't forget the DirectX8 and DirectX9 have their own vb library. don't forget forget add the library on References, on Project menu.
    VB6 2D Sprite control

    To live is difficult, but we do it.

  25. #145
    Fanatic Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    578

    Re: Direct2D Typelib+ for VB6

    Quote Originally Posted by Schmidt View Post
    I'm already working on GLSL support for at least the Vertex- and Fragment-shaders -
    you can expect some results at the end of next week ...
    Olaf
    Good to know!
    I have made progress using TrueVision3D to handle the shader.
    All in all, the TrueVision3D tool is of a unique simplicity. (also for passing variables from VB6 to the shader)

    I take this opportunity to apologize for having gone a little off topic of this thread. (topics that I hope interesting anyway)

  26. #146

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2014
    Posts
    1,441

    Re: Direct2D Typelib+ for VB6

    yeah, its off topic,
    but I think its acceptable a few post here and there, since its about graphics and we all want VB6 to be able to use as much possible.
    but its better to make a new thread and continue in a thread with 3D in mind.

  27. #147
    Fanatic Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    578

    Re: Direct2D Typelib+ for VB6

    Quote Originally Posted by Schmidt View Post
    I'm already working on GLSL support for at least the Vertex- and Fragment-shaders -
    you can expect some results at the end of next week ...
    Olaf
    Hi,
    do you have something ready about it ?
    If yes ( or when you have it) please post it in this other thread (or a your own thread) (... not to be off topic here)

Page 4 of 4 FirstFirst 1234

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width