Jump to content
  • Advertisement
Sign in to follow this  
majak

directX 9 real time rendering

This topic is 4910 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I'm kind of new at this, but I want to show a 2D image on the screen, with help from DirectX (Direct Graphics?), anyway, I don't have a bitmap stored already, Í have a scanner running real time and the coordinates comming in in a 2 dimensional array. Can anyone please help me?

Share this post


Link to post
Share on other sites
Advertisement
Look at D3DXLoadSurfaceFromMemory and at surfaces in general. Once you have your image loaded in a surface of your own, you should be able to StrechtRect it on the surface of your current render target.

Shadx

Share this post


Link to post
Share on other sites
Thank you =) Anyone who knows where I can find tutorials on this subject? rendering images without having the image as a file but as a 2 dimensional array? the array has x and y, but I need a third to use directx graphics or?

Share this post


Link to post
Share on other sites
In memory, a "2d" array is usually a single sequential string of bytes - the dimensionality is a helper concept for the programmer in this case. In the same sense, D3D doesn't care how many dimension an array has, as long as the data is there and in correct places. Do take note, however, that graphics cards partition the surface memory in scanlines, so the data may not be completely sequential due to padding (though d3d loaders are very flexible about the source format, so you need not worry about this just yet).

Share this post


Link to post
Share on other sites
Thank you, very good to hear. Still noone who can help me find a tutorial on this subject? I can't find any, where the image isn't already stored in the memory..

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
look up the function lockrect. basically you create a directx texture, then lock it to draw your data to the texture. after that you can draw the texture to the screen.

if you dont want to use directgraphics, look at driectdraw (ie directx7) tutorials. it should be a bit easier to grasp if you dont want to deal with a 3d graphics library. also what you learn can be applied to directgraphics in directx9 after you understand the concepts.

if you want an easier time, look at DIBs, specifically the function createdib (or was it createdibsection). it allows you to draw directly to a windows bitmap, then you can use bitblt to blit it to your window.

what scanner do you have that runs in realtime? if the coordinates are colo intensities the baove information will help. if the coordinates are something else then you may have to rethink and explain better what you are doing.

Share this post


Link to post
Share on other sites
I have a scanner that reads the x and y positions of something and the colorintensity (not important right now). These x's and y's gets to my USB as an 2D array. From there I want to view this picture in DirectX 9, without saving it first. To begin with, I will make the 2D array by hand in an extern file and see if I can access it from dirctX and get a nice picture. How do I create such an array? and what kind of file should it be?

The createdib thing sounds really good, could only find examples for vb though.. (using c++ VS.NET).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!