|
Hello,
Lets assume I have two different graphic effects: a particle system (stars coming out of teh center of the screen) and a simple rotating cube. Both consist of textures which have a z-value when blitted / written into the render-pipeline. I want the particle-stars (although their z-value gets lower if they come nearer) to be always behind the cube. It could be possible thet one of the particles suddenly pops out of the cube, thats not wanted.
Someone told me that I should erase the zbuffer before drawing the next layer. Is that possible in DirectX8 and can solve my problem?
Thank you,
Chris
|
|
|
|
|
Hi,
Can anyone suggest me some good books in implementing code for image/video frames processing in c++. I would like to learn programming some image processing techniques and to create programs where I can apply transforms, shifts and find some characteristics from the video frames of images in visual c++. It would be great if anyone can suggest me with good books or tutorials with loads of image/video frame grabbing/processing programming discussed extensively.
thanks,
-Pav
|
|
|
|
|
If you don't mind using OpenCV this might help[^]
As for books when I looked a couple of years ago there weren't any decent books on directshow[if you want to use that], though there were some in the pipelines.
The Quran's Rational Arguments (Audio)
Background on Prophet Muhammad (in progress)
"They are MUSLIM. It does not matter how you split it up: all msulims (so they say) see every other muslim as a brother, regardless of origin or nationality." -legalAlien. Alhamdullah for the blessing of Islam
|
|
|
|
|
Hi,
thanks for ur reply.
Ok here u go. I am thinking of learning pattern recognition and extraction of charateristics. so, i thought it would be better to start off with some good image processing coding books in c++. for example, I would like to find the blood velocity from a video file of retina from a patient, in which I can see the blood vessels flowing. From all the frames my goal is to find out the velocity of blood. Hope u understand the track in which i am thinking of .
thanks,
-Pav
|
|
|
|
|
Are you looking for an book with c++ algorithims for image processing? If so I am not really familiar with any that deal with estimating speed of movement[in your case do you have to worry about depth?] but there are many that deal with subject but not as an 'algorthim book for c++'
The Quran's Rational Arguments (Audio)
Background on Prophet Muhammad (in progress)
"They are MUSLIM. It does not matter how you split it up: all msulims (so they say) see every other muslim as a brother, regardless of origin or nationality." -legalAlien. Alhamdullah for the blessing of Islam
|
|
|
|
|
Are you looking for an book with c++ algorithims for image processing?
yes, but not just algorithms. I would like to see the coding part too on how to enhance the processing time and computation speeds.
[in your case do you have to worry about depth?]
Nope. To say we will be having a movie from which we have to find the velocity
'algorthim book for c++'
I need some sort of this type but for image processing/handling.
I always wonder how people write codes for media players etc in C/C++ with all sorts of functions like capturing frames saving as images etc.
-Pavan.
|
|
|
|
|
Hi all, maybe somebody can help me out with this.
if i do this:
class CSomeClass
{
......
};
CArray <csomeclass, csomeclass&=""> objSomeClassArray;
CSomeClass objSomeClass;
objSomeClassArray.Add(objSomeClass);
...
objSomeClassArray.RemoveAll();
my question is:
does the RemoveAll() method in this case free also the memory?
if not what should i do to free them?
thanks a lot
|
|
|
|
|
In your example, I believe memory is naturally freed. However, if you created the ObjSomeClass via the heap (using new), you would have to manually free the memory via delete.
|
|
|
|
|
This is what MSDN says about it:
Notice the difference between deleting an element's object and removing the element itself. Removing an element from the list merely removes the list's reference to the object. The object still exists in memory. When you delete an object, it ceases to exist and its memory is reclaimed. Thus, it is important to remove an element immediately after the element's object has been deleted so that the list won't try to access objects that no longer exist.
CArray<CPerson*, CPerson*> myArray;
<font color=blue>int</font> i = 0;
<font color=blue>while</font> (i < myArray.GetSize() )
{
<font color=blue>delete</font> myArray.GetAt( i++ );
}
myArray.RemoveAll();
Owner drawn
Jesus Loves
|
|
|
|
|
Objects are usualy responsible for freeing the memory they use. If your CArray is storing objects, then they will free the memory when they are removed. But if the CArray is only storing pointers to objects, then you are responsible for freeing the memory [associated with each object]. The reason for this is that the array object does not actualy know whether it is storing an object or a pointer to an object.
INTP
Every thing is relative...
|
|
|
|
|
consider the small situation:-
funcFCC()
{
ClassA a;
}
here the object is destroyed when the function scope end....
funcFCC()
{
ClassA *a=new ClassA;
}
here the Memory is not freed when scope of function end.. resulted in memory leak...
same apply for the RemoveAll function.. hope you understand this!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
thanks for all the responses,
please look at this code:
void COtherClass::FirstFunction(CArray<CSomeClass, CSomeClass&> & pSomeClassArray)
{
CSomeClass objSomeClass;
pSomeClassArra.Add(objSomeClass);
......
}
void COtherClass::SecondFunction()
{
// m_objSomeClassArray is a member variable array of COtherClass (Type CSomeClass)
FirstFunction(&m_objSomeClassArray);
......
m_objSomeClassArray.RemoveAll();
}
is this OK?
|
|
|
|
|
Kleser wrote:
void COtherClass::FirstFunction(CArray<CSomeClass, CSomeClass&> & pSomeClassArray)
{
CSomeClass objSomeClass;
pSomeClassArra.Add(objSomeClass);
......
}
void COtherClass::SecondFunction()
{
FirstFunction(&m_objSomeClassArray);
......
m_objSomeClassArray.RemoveAll();
}
Is CSomeClass implement the copy constructor?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
i made a mistake writing the code above. it has to look like this:
void COtherClass::FirstFunction(CArray<CSomeClass, CSomeClass&>* pSomeClassArray)
{
....
}
instead of this:
void COtherClass::FirstFunction(CArray<CSomeClass, CSomeClass&>& pSomeClassArray)
{
....
}
the method has a pointer parameter instead of a reference parameter.
i guess CSomeClass does not implement a copy constructor, i have not added anything in the constructor neither write a new constructor in that class.
i use the class the way it is as i show you before, and it seems to work.
but i want to know how to implement a copy constructor, can you please show me how to do it?
thanks in advance
|
|
|
|
|
Hi, i have a problem with this code i am working on. It does compile correctly but when i input my data file, which is a string of integers it does not seem to work.. pls advice if possible
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main(){
FILE*scores;
float s,y,z,mean,deviation,m,n,A,B,C,D,F;
int k,a,b,c,d,f,q;
scores=fopen("scores.txt","r");
a=b=c=d=f=k=q=0;
s=y=z=mean=deviation=m=n=A=B=C=D=F=0;
while(fscanf(scores,"%f",&s)!=EOF){
y+=s;
z+=(pow(s,2));
k++;
if(90<=s<=100){
a++;
}else if(80<=s<=89.9){
b++;
}else if(70<=s<=79.9){
c++;
}else if(60<=s<=69.9){
d++;
}else{
f++;
}
}
printf("%d\t%d\t%d\t%d\t%d\n",a,b,c,d,f);
mean=y/k;
printf("The average score is %.1f.\n",mean);
m=z/k;
n=pow(mean,2);
deviation=sqrt(m-n);
printf("The standard deviation is %.1f.\n",deviation);
A=a/k*100;
B=b/k*100;
C=c/k*100;
D=d/k*100;
F=f/k*100;
printf("\nA\t%d\t%4.1f\t",a,A);
for(q=1;q<=a;q++){
printf("*");
}
printf("\nB\t%d\t%4.1f\t",b,B);
for(q=1;q<=b;q++){
printf("*");
}
printf("\nC\t%d\t%4.1f\t",c,C);
for(q=1;q<=c;q++){
printf("*");
}
printf("\nD\t%d\t%4.1f\t",d,D);
for(q=1;q<=d;q++){
printf("*");
}
printf("\nF\t%d\t%4.1f\t",f,F);
for(q=1;q<=d;q++){
printf("*");
}
printf("\n");
This code is suppose to calculate mean, std deviation and print a bar chart to represent the distribution.
|
|
|
|
|
scorpiotkh wrote: if(90<=s<=100){
a++;
}else if(80<=s<=89.9){
b++;
}else if(70<=s<=79.9){
c++;
}else if(60<=s<=69.9){
d++;
}else{
f++;
}
Do you see the problem with this? It should instead look like:
if (90.0 <= && s <= 100.0)
a++;
else if (80.0 <= s && s <= 89.9)
b++;
...
scorpiotkh wrote: ...it does not seem to work...
Which means nothing useful. What exactly is not working?
Not that it will correct the problem, but change float to double , and use floating-point constants (e.g., 0.0).
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
It does not really matter what exactly is wrong with this code. This code in itself is wrong. The code looks like it's a copy from one of books on "how NOT to write programs", or "how to write programs so that they do NOT work". I wonder where Scorpio got it, isn't it copyrighted?
|
|
|
|
|
I really have no idea what is the purpose/aim for your sarcasm here. All i request here are constructive comments on how to make this code work to get the desired grade to be printed out when integer values are entered.
As far as i am concern, i am new to programming and i did refer to books and tutorials to get this code up. I would politely request that if you have not have any contructive/helpful comments to add, please do not post in here.
Thanks once again for taking time to read.
|
|
|
|
|
Basically i need help with the input, the program will return a grade when an integer value is entered, but i am not getting that when a value is entered.
Moreover when i opened the textfile, the scores which i input was actually 1 whole sting of numbers all stuck together.
|
|
|
|
|
scorpiotkh wrote: ...the program will return a grade when an integer value is entered...
Entered? I do not see anything in your code that would facilitate this (e.g., scanf , gets ).
scorpiotkh wrote: ...but i am not getting that when a value is entered.
What sort of value?
scorpiotkh wrote: Moreover when i opened the textfile, the scores which i input was actually 1 whole sting of numbers all stuck together.
Your input file should look something like:
12.34
56.78
1.09
...
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
If I have a class CTest, and have provided my own constructor (with zero parameters), I would expect that the compiler (VC++ 6.0 SP5 and VC++ 7.1) would not create the default constructor. However, my constructor only gets called with a statement like...
CTest test;
When I try and instantiate an object of CTest with a statement like...
CTest test();
my constructor never gets called but the program executes and the compiler does not complain. I have an explicit copy constructor as well and it does not come into play as I entertained this possibility for 10 seconds or so. This begs the question, "What is the difference between the two methods of instantiating an object"?
Am I missing something elemetary here?
|
|
|
|
|
bob16972 wrote: CTest test();
That isn't a variable declaration, it's a prototype for a function called "test" that returns a CTest and takes no parameters.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Fair enough.
Thanks. Sorry I didn't catch that earlier
|
|
|
|
|
Michael Dunn answered your question, but ponder this.
Whether you create the constructor or the compiler creates it for you, it is an implicit constructor. Why are explicit constructors needed? (C++ keyword: explicit)
INTP
Every thing is relative...
|
|
|
|
|
Your right. My apologees for using the word "Explicit" and not knowing it was a keyword.
I had to look that up in Meyers Effective C++ (on page 5 so now I'm really embarrassed) though as I've never used that keyword before. If I'm understanding Meyers correctly, is it to prevent implicit casts from being performed?
I have been using C++ for years but I'm just now building my first polymorphic classes and it's been interesting to see how much of this language I have gotten by NOT knowing all this time. I think learning MFC corrupted me and allowed me to get by without needing to know too much. I'm pretty much starting over and learning the language hopefully the right way this time around.
Thanks for the correction.
|
|
|
|