Solved

Rect redrawing

Posted on 2001-07-10
5
279 Views
Last Modified: 2013-12-26
In all the samples of dx 8.0 whole render target(window or full screen) is redrawn. If we want to redraw only the rect enclosing the object. How can wee determine the coordinate of rect. Better explain with reference to any of sample.
0
Comment
Question by:Sumia
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:cybermike3d
Comment Utility
Do you want to draw a bounding box rectangle around an object or do you want to redraw just the rectangular area containing the object. Is this a 3d or a 2D application ie is this a direct3d or a directdraw query ? I am sorry ... I dont understand the question fully ... whould you please rephrase it and give more detail. The question can be answered in various ways ... but I want to be sure of the context of the question first.
0
 

Author Comment

by:Sumia
Comment Utility
I only want to determine the bounding rectangle in directx graphics or you can say direct3d in a 3d application. I have given the untransformed vertices and I want to reach the vertices used by the rasterrizer of directx graphics.
0
 
LVL 2

Expert Comment

by:cybermike3d
Comment Utility
Have u looked at the computeboundingbox command ?

D3DX8.ComputeBoundingBox
Computes a bounding box.

object.ComputeBoundingBox( _
    PointsFVF As Any, _
    NumVertices As Long, _
    FVF As Long, _
    MinArray As D3DVECTOR, _
    MaxArray As D3DVECTOR)

Parts
object
Object expression that resolves to a D3DX8 object.
PointsFVF
Buffer containing the vertex data around which to calculate the bounding box.
NumVertices
Number of vertices.
FVF
Combination of flexible vertex format flags that describes the vertex format.
MinArray
D3DVECTOR type, describing the returned lower-left corner of the bounding box.  
MaxArray
D3DVECTOR type, describing the returned upper-right corner of the bounding box.  

Or do u want the actual algorithm to do it ?
0
 

Author Comment

by:Sumia
Comment Utility
dx graphics does not apply the transformations unless drawprimitive is called. As I have explained earlier that I want to know the transformed vertices(screen cordinates) when I have supplied the world co-ordinates . With compute bounding box the problem remains the same that it performs the calculations on vertex buffer we give to it. But how to obtain the vertex buffer that contains the transformed co-ordintate. I have seen a function ProcessVertices but I can not understand how it works.
0
 

Accepted Solution

by:
GuyJohnston earned 100 total points
Comment Utility
You might consider applying transformation matrix
directly to the object verticies rather than use the
world transformation matrix. This way the verticies
are transformed directly. You can then get the bounding
box from the transformed verticies.

Depending on what you are doing, you may have to create
a reference vertex array to compute your transformations
from.

I used this method in a flying saucer game and it worked
quite well.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now