Solved

Rect redrawing

Posted on 2001-07-10
5
281 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
ID: 6276191
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
ID: 6279166
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
ID: 6280137
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
ID: 6301395
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
ID: 6374164
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
game engine recommendation 3 719
Why does this site's Python example code not work? 8 242
old35  java challenge 4 130
Compile GLUT with Visual Studio 2015 1 143
What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

813 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

9 Experts available now in Live!

Get 1:1 Help Now