|
the typical tool is something that can do a batch 'diff'. something like BeyondCompare.
|
|
|
|
|
Static code analysis Tools:
http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page
http://www.campwoodsw.com/sourcemonitor.html
http://www.gimpel.com/html/pcl.htm
--
"Programming is an art that fights back!"
modified on Thursday, June 10, 2010 12:16 PM
|
|
|
|
|
Reviewboard isn't too bad for the price...
Days spent at sea are not deducted from one's alloted span - Phoenician proverb
|
|
|
|
|
I am working in open gl and i have drawn balls.I want to load the texture on them and i know how to use texturing butr the actual problem is that i donot know which coordinates should i give in glTexcoord() function so that it is exactly mapped on to ball.I am sending the source code.
<br />
<code>
//#include <GL/gl.h>
#include <windows.h>
#include <glut.h>
//#include <stdio.h>
#include <math.h>
//#include <iostream.h>
float pi=180;
const float DEG2RAD = 3.14159/180;
// Initial square position and size
GLfloat x[5];
GLfloat y[5];
GLfloat rsize = 25;
// Step size in x and y directions
// (number of pixels to move each time)
GLfloat xstep[5];
GLfloat ystep[5];
// Keep track of windows changing width and height
GLfloat windowWidth;
GLfloat windowHeight;
void drawEllipse(float xradius, float yradius,float h,float k)
{
glBegin(GL_POLYGON);
for (int i=0; i < 360; i++)
{
glColor3f(0.0f, 0.0f, 1.0f);
//convert degrees into radians
float degInRad = i*DEG2RAD;
glVertex2f(cos(degInRad)*xradius+h,sin(degInRad)*yradius+k);
}
glBegin(GL_TRIANGLE_FAN);
for ( i=0; i < 360; i++)
{
//convert degrees into radians
float degInRad = i*DEG2RAD;
glColor3f(1,1,1);
glVertex2f(cos(degInRad)*xradius+h,sin(degInRad)*yradius+k);
}
glEnd();
}
///////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
{
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Set current drawing color to red
// R G B
// Draw a filled rectangle with current color
for(int i=0;i<5;i++)
{
drawEllipse(20, 20,x[i]+rsize,y[i] - rsize);
//glRectf(x[i], y[i], x[i] + rsize, y[i] - rsize);
}
//glColor3f(1.0f, 1.0f, 0.0f);
//glRectf(x[1], y[1], x[1] + rsize, y[1] - rsize);
// Flush drawing commands and swap
glutSwapBuffers();
}
///////////////////////////////////////////////////////////
// Called by GLUT library when idle (window not being
// resized or moved)
void TimerFunction(int value)
{
for(int i=0;i<5;i++)
{
// Reverse direction when you reach left or right edge
if(x[0] > windowWidth-rsize || x[0] < -windowWidth)
xstep[i] = -xstep[i];
// Reverse direction when you reach top or bottom edge
if(y[i] > windowHeight || y[i] < -windowHeight + rsize)
ystep[i] = -ystep[i];
// Actually move the square
x [i]+= xstep[i];
y[i] += ystep[i];
// Check bounds. This is in case the window is made
// smaller while the rectangle is bouncing and the
// rectangle suddenly finds itself outside the new
// clipping volume
if(x[i] > (windowWidth-rsize + xstep[i]))
x[i] = windowWidth-rsize-1;
else if(x[i] < -(windowWidth + xstep[i]))
x[i] = -windowWidth -1;
if(y[i] > (windowHeight + ystep[i]))
y [i]= windowHeight-1;
else if(y[i] < -(windowHeight - rsize + ystep[i]))
y[i] = -windowHeight + rsize - 1;
}
// Redraw the scene with new coordinates
glutPostRedisplay();//draw the scene everytime this function is called
glutTimerFunc(33,TimerFunction, 0);
//void glutTimerFunc(unsigned int msecs, void (*func)(int value), int value);
}
///////////////////////////////////////////////////////////
// Setup the rendering state
void SetupRC(void)
{
int a=0,b=0;
// Set clear color to blue
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
for(int i=0;i<5;i++)
{
xstep[i]=1.0;
ystep[i]=1.0;
}
x[0]=0;
y[0]=0;
x[1]=-30;
y[1]=-30;
x[2]=-40;
y[2]=40;
x[3]=50;
x[3]=-30;
x[4]=-6;
y[4]=75;
}
///////////////////////////////////////////////////////////
// Called by GLUT library when the window has chanaged size
void ChangeSize(int w, int h)
{
GLfloat aspectRatio;
// Prevent a divide by zero
if(h == 0)
h = 1;
// Set Viewport to window dimensions
glViewport(0, 0, w, h);
// Reset coordinate system
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Establish clipping volume (left, right, bottom, top, near, far)
aspectRatio = (GLfloat)w / (GLfloat)h;
if (w <= h)
{
windowWidth = 100;
windowHeight = 100 / aspectRatio;
glOrtho (-100.0, 100.0, -windowHeight, windowHeight, 1.0, -1.0);
}
else
{
windowWidth = 100 * aspectRatio;
windowHeight = 100;
glOrtho (-windowWidth, windowWidth, -100.0, 100.0, 1.0, -1.0);
}
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
///////////////////////////////////////////////////////////
// Main program entry point
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowSize(800,600);
glutCreateWindow("Bounce");
glutDisplayFunc(RenderScene);
glutReshapeFunc(ChangeSize);
glutTimerFunc(33, TimerFunction, 1);
SetupRC();
glutMainLoop();
return 0;
}
|
|
|
|
|
It appears that you are setting the color of every vertex of the triangle fan and letting OpenGL determine the colors of the pixels inside the triangles. I think that's the right way to do it but you probably don't want to use white for the color. You will be unable to see most shading effects if you do.
For texture mapping you define the [u,v] coordinates on the texture that each vertex maps to and this requires some computation on your part. There are many different algorithms for this and the one to use depends on how the texture image was "unwrapped" from the sphere. This is the same problem faced by cartographers when they draw maps of planets. They have to unwrap the surface of the sphere onto a 2D image. In your case you need to know how that was done so that you can reverse the process.
BTW - [u,v] refers to the (x,y) coordinate in the image that is used for a pixel's color.
|
|
|
|
|
I have a win32 api program which will fetch text from a server and will display it in a multiline text box.
The information is not saved using this program but it just fetch the information to display it for the user.
I give the users an html GUI to save information in UTF.
the html interface is working well like saving Western European characters.
When i display it in the text box i get two junk letter instead of the actual Latin alphabet.
How do i notify or stylize the text box to display extended characters (latin) ???
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
Is your application being compiled for UNICODE? Check under General Properties for the project. If yes then it should handle Unicode characters automatically. If No then you will need to provide conversion between Unicode and MBCS.
It's time for a new signature.
|
|
|
|
|
Sorry i have replied very late.
Yes. I have defined the UNICODE and _UNICODE directives.
I have to mention here that i am using DEV C++ IDE (gnu gcc compiler collection).
The problem is with this IDE and not vc6.0.
In VC6.0 the text boxes are not even accepting unicode chars. Where as when i compiled with DEV c++ ide... the only problem is displaying it as unicode but the text boxes accepts unicode and i can directly type in the unicode strings in message boxes. I tested the message box by directly giving the strings. it worked.
Since DEV c++ is not used by people here i have to find it of my own...
I followed MS document to use unicode in VC6.0 but i cannot save unicode static text in string tables.
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
VC6.0 is very old now, we have gone through 2002/3 - 2005 - 2008 and are now on 2010. I would suggest that if possible you upgrade to VS2010. If it's a question of cost then you can get the free Express Editions[^] from Microsoft.
It's time for a new signature.
|
|
|
|
|
Yes. I am in parallel creating the same application in C# because i cannot do many things in VC6.0 like unicode and SSL(for my socket programs). But i thought i can know the core of windows if i am sticking to VC6.0. I dont know mfc i want to be good in win32 API programming. I hope this can be done in .NET too... It should be. Thank you.
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
Jayapal Chandran wrote: I dont know mfc i want to be good in win32 API programming.
Then I suggest you follow my previous recommendation and get a copy of the free VS 2010 Express Edition C++ system, which will help you learn all about Win32 programming without any requirement to learn MFC.
It's time for a new signature.
|
|
|
|
|
I have(me and my friends) already got 2005 and i am a beginner to .net framework. Do i need the latest 2010 version?
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
The 2005 versions are also a bit old now as we have been through 2008 and are now on 2010. However it is not absolutely necessary to use the latest version if you are just learning; I leave it up to you to decide when to upgrade.
It's time for a new signature.
|
|
|
|
|
Hi experts
I have to migrate some projects from VC 6.0 to visual studio 2005. Is Anything required to achieve it and what waht kind of problem i can face? As far as my knowledge is concerned, All upper version products automatically converts the project from older version to new one.
With regards
R Y K
|
|
|
|
|
you will probably have to fix a lot of these:
for (int x=0...)
{
}
for (x=0;...)
{
}
the scope of the first x is limited to the first for loop, after VC6.
|
|
|
|
|
VC_RYK wrote: Is Anything required to achieve it and what waht kind of problem i can face?
You will likely run into Unicode-related issues. That and variable scope are the two biggest issues I've faced when porting one to the other.
VC_RYK wrote: As far as my knowledge is concerned, All upper version products automatically converts the project from older version to new one.
Yes, it converts the project, not the code.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Why VS2005? Consider VS2008 or VS 2010 (though the latter is a bit of a moving target still).
The step from VC6 to VS2005 is the big one though.
Upgrade Wizard will (try to) port your project files - this usually works ok - but you are alon wiht changes requried to your source code.
Compiler: VS 2005 provides improved standard compatibility, the most common issues being for scope, more rigorous checking of templates, and other minor things. For a list of breaking changes, see here[^] and here[^].
Unicode: Project settings now default to unicode. Moving from ANSI/MBCS to Unicode is a completely different story, you may want to take this as a separate step.
"Safe" CRT functions - many functions of the C/C++ Runtime will now generate a warnign that they should be replaced by safe counterparts - mostly to avoid potential buffer overflows and encourage more rigorous error checking. This is often a barrage of warnings, burying everything else under it. For more information, see here[^].
IDE + Build Performance - Get a really good computer. I mean it.
Windows Headers - we had some problems with some of the more arcane windows library headers moving some declarations around, requiring ugly include reordering and supressing some declarations being made / imported. That's unlikely to bite you, but can be an immense time sink.
|
|
|
|
|
Hello how are u?
I am new here and I have a great problem with my WinCE 5.0 application. I want to call an .NET application by my own developed prog (C/C++). I use the function
CreateProcess(_T("/flashdisk/app.exe"), NULL, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, NULL, &ProcInfo).
If I run my prog the CreateProcess function returns SUCCESS but the other prog cries " .NET CF Initialization Error!
The Application failed to load required components... Support info: -2147479552 (80001000)".
If I doubleklick the other program in the WinCE explorer the application starts with no error message.
Under WinCE6.0 I don't have this problem. Do I have to run an other application first before starting the other prog?
|
|
|
|
|
|
What's a KT ?
|
|
|
|
|
I assume you are talking about a Knowledge Transfer; then why not spell it out so everyone can understand the question? However this forum is for C/C++/MFC questions so I suggest you post in General IT Issues, Collaboration or some more appropriate place.
It's time for a new signature.
|
|
|
|
|
Richard MacCutchan wrote: I assume you are talking about a Knowledge Transfer
Wow, I would never have thaught of that. We have enough acronyms out there: is we start giving acronyms to things like "Knowledge Transfer", were will we end
Oh I know, that's what they call txtspk
|
|
|
|
|
|
Precisely...
It is particulary annoying when you have to read some "papers" about any kind of technology (but the worse is for software)
|
|
|
|
|
Cedric Moonen wrote: where will we end
Exactly; I usually have to go here[^] to find the answer. This was one of the few times when it came to me almost immediately. I must say I agree with you, people who post questions where the main item is a TLA (or TLA) are a PITA.
It's time for a new signature.
|
|
|
|