0
\$\begingroup\$

I am a beginner to DX and I have tried looking everywhere for something very similar to this concept but can't find anything.

I just want two rectangles on a window.

Rectangle 1 : on some x,y with some width and height with background as a PNG image Rectangle 2 : on some x,y with some width and height with background as a PNG image

And one other thing. I am trying to make it so that the image doesn't resize as I resize the window as this makes the pictures really blurry as they get bigger.

I know this is not the type of question that stack likes, but if you can give me some example that does this, I would be very delighted.

Thank you so much.

\$\endgroup\$
  • \$\begingroup\$ Also, why DirectX10? If all you want to do is 2D there are more simple API such as SDL that can do exactly what you're asking. SDL tutorial site: lazyfoo.net \$\endgroup\$ – UnderscoreZero Sep 25 '13 at 17:22
  • \$\begingroup\$ Because DirectX isn't meant to be 'quick and dirty', there will be a lot of setup required to do anything with it. If you clarified why you want to do it that way it will help people answer your question. Is it because you want to learn DirectX and you think that is a good starting challenge? Or is that the final product you need, and there's some reason unstated why you want or need to do that in DirectX? \$\endgroup\$ – TASagent Sep 25 '13 at 17:51
  • \$\begingroup\$ @TASagent It simply because I want to learn DirectX and I think that putting 2 basic images will teach me some basics and then I will proceed to learn different aspects. I know people have different strategies to learn, but this something I want to try out. \$\endgroup\$ – bluejamesbond Sep 26 '13 at 18:17
  • \$\begingroup\$ @UnderscoreZero I know you can do this various other libraries, but I have always been interested in how games are made and I would like to try by just seeing an example. \$\endgroup\$ – bluejamesbond Sep 26 '13 at 18:20
  • \$\begingroup\$ @M. Dudley I have tried the tutorial here: takinginitiative.wordpress.com/2011/01/12/… But I am confused as to why you need to use a Geometry Shader to draw a Sprite? Can't you do it any other way? I come from a heavy Java 2D background and I there all you really have to do is set the location and source image and you can paint directly on. \$\endgroup\$ – bluejamesbond Sep 26 '13 at 18:21
1
\$\begingroup\$

Since you expressed interest in learning how to use DirectX, just in the context of your specific challenge, I have to direct you to an outside source.

'Teach me how to use DirectX' is a bit outside the scope of what this is meant for, and any complete answer would be far too long, besides.

For decent intro tutorials, I recommend: http://rastertek.com/tutindex.html

By tutorial 5 you'll have the tools you need to be able to complete your request. If, at that point, you still need help or are confused about something, that is a good time to post a question here about it.

The tutorials create an engine that works, though it needs a bit of redesign to be useful for more than learning. Regardless, that is a good place to start.

\$\endgroup\$
  • \$\begingroup\$ I will go ahead and do the tutorial, however I am confused on concept. What is the difference between Sprites and regular old Textures? Just to get an idea. \$\endgroup\$ – bluejamesbond Sep 26 '13 at 18:31
  • \$\begingroup\$ A sprite is a 2D image or animation. A texture is the color information that is applied to polygons. In the case of an unanimated sprite, the texture is applied to a Quad (a square made of two triangles), and makes the sprite. In the case of an animated sprite, several textures are used to give the appearance of animation. Additionally, textures can be used on 3D objects as well, in which case it is the color data (or other data) that gets dumped onto the faces of a 3d object. \$\endgroup\$ – TASagent Sep 26 '13 at 18:35
  • \$\begingroup\$ With that being said, in the tutorial above, what is the benefit of rendering the sprite using a Geometry Shader? \$\endgroup\$ – bluejamesbond Sep 26 '13 at 18:39
  • \$\begingroup\$ The Geometry Shader is an Extra, Optional step that can be inserted between the (somewhat) mandatory Vector and Pixel shader steps. It has a variety of uses, like the tutorial says for particle systems and tessellation, but understanding how it works or is useful requires first knowing about what the Vector Shader and Pixel Shaders are, something covered in a very early step of the tutorial. \$\endgroup\$ – TASagent Sep 26 '13 at 18:47
  • \$\begingroup\$ When you create a vertex array, it is made of floating point values. Are those values actual pixel positions on the screen? Or do you have to multiply by the world x view x projection matrices to get the screen pixels? If so, what are vertex array positions relative to? And are there as many world, view, and projection matrices as there the number of models? I know I have asked you a lot on a comment, but I do sincerely thank you so much for your help. \$\endgroup\$ – bluejamesbond Oct 11 '13 at 8:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.