Click here to Skip to main content
15,922,574 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: OpenGL stencil not working... Pin
Vaclav_23-Apr-20 8:11
Vaclav_23-Apr-20 8:11 
QuestionCross Reference/Reporting Tool avaiable which does not resolve macros? Pin
Hans99922-Apr-20 0:57
Hans99922-Apr-20 0:57 
AnswerRe: Cross Reference/Reporting Tool avaiable which does not resolve macros? Pin
Richard MacCutchan22-Apr-20 3:47
mveRichard MacCutchan22-Apr-20 3:47 
AnswerRe: Cross Reference/Reporting Tool avaiable which does not resolve macros? Pin
k505422-Apr-20 4:07
mvek505422-Apr-20 4:07 
SuggestionRe: Cross Reference/Reporting Tool avaiable which does not resolve macros? Pin
David Crow22-Apr-20 5:18
David Crow22-Apr-20 5:18 
GeneralRe: Cross Reference/Reporting Tool avaiable which does not resolve macros? Pin
Richard MacCutchan22-Apr-20 6:25
mveRichard MacCutchan22-Apr-20 6:25 
GeneralRe: Cross Reference/Reporting Tool avaiable which does not resolve macros? Pin
David Crow22-Apr-20 6:43
David Crow22-Apr-20 6:43 
GeneralRe: Cross Reference/Reporting Tool avaiable which does not resolve macros? Pin
Richard MacCutchan22-Apr-20 6:51
mveRichard MacCutchan22-Apr-20 6:51 
Question'get_osfhandle': identifier not found Pin
_Flaviu20-Apr-20 0:13
_Flaviu20-Apr-20 0:13 
AnswerRe: 'get_osfhandle': identifier not found Pin
Richard MacCutchan20-Apr-20 0:37
mveRichard MacCutchan20-Apr-20 0:37 
GeneralRe: 'get_osfhandle': identifier not found Pin
leon de boer20-Apr-20 2:05
leon de boer20-Apr-20 2:05 
GeneralRe: 'get_osfhandle': identifier not found Pin
Richard MacCutchan20-Apr-20 3:28
mveRichard MacCutchan20-Apr-20 3:28 
QuestionSOLVED Passing function with parameters as parameter Pin
Vaclav_18-Apr-20 8:38
Vaclav_18-Apr-20 8:38 
AnswerRe: Passing function with parameters as parameter Pin
Greg Utas18-Apr-20 9:07
professionalGreg Utas18-Apr-20 9:07 
GeneralRe: Passing function with parameters as parameter Pin
Vaclav_18-Apr-20 9:22
Vaclav_18-Apr-20 9:22 
AnswerRe: Passing function with parameters as parameter Pin
Greg Utas18-Apr-20 10:24
professionalGreg Utas18-Apr-20 10:24 
GeneralRe: Passing function with parameters as parameter Pin
Vaclav_18-Apr-20 10:52
Vaclav_18-Apr-20 10:52 
GeneralRe: Passing function with parameters as parameter Pin
Greg Utas18-Apr-20 11:04
professionalGreg Utas18-Apr-20 11:04 
GeneralRe: Passing function with parameters as parameter Pin
Vaclav_19-Apr-20 5:47
Vaclav_19-Apr-20 5:47 
GeneralRe: Passing function with parameters as parameter Pin
Greg Utas19-Apr-20 6:05
professionalGreg Utas19-Apr-20 6:05 
GeneralSOLVED Re: Passing function with parameters as parameter Pin
Vaclav_19-Apr-20 9:03
Vaclav_19-Apr-20 9:03 
AnswerRe: Passing function with parameters as parameter Pin
Richard MacCutchan18-Apr-20 21:21
mveRichard MacCutchan18-Apr-20 21:21 
QuestionMath problem with C code Pin
Vaclav_18-Apr-20 6:47
Vaclav_18-Apr-20 6:47 
Just FYI, this is NOT a repost.
As usual I have posted the original in WRONG pew.
However, I found another even weirder failure of simple math case and I really do not have a clue what I am doing wrong.
Are my local variable assignments incorrect ?
Is "printf" lying to me ?

Here is the entire test code
C++
#define MAX_CIRCLES 5

struct TAG_Circles {
	float radius;
	float center;
	float center_x;
	float center_y;

} REAL_Circle[MAX_CIRCLES], IMG_Circle[MAX_CIRCLES];

void OpenGL_Stencil_Circle_Build(void);
// copy last circle to stencil
void OpenGL_Stencil_Circle_Build(void) {
	//
	int index = 5;
	{
		// last circle
		float radius = IMG_circle[index].radius;
		float center_x = IMG_circle[index].center_x;
		float center_y = IMG_circle[index].center_y;
		printf("\n Last circle #%i  radius struct %f radius  %f", index,
				REAL_Circle[index].radius, radius);
		printf("\n Last circle #%i center_x  struct %f center_x  %f", index,
				REAL_Circle[index].center_x, center_x);
		printf("\n Last circle #%i center_y  struct %f center_y  %f", index,
				REAL_Circle[index].center_y, center_y);

	}
}


Here is the output
Last circle #5  radius struct 0.065789 radius  0.131579
Last circle #5 center_x  struct 0.000000 center_x  0.118421
Last circle #5 center_y  struct 0.000000 center_y  0.000000


The questions are NOT what I am trying to accomplish with the code ,
the questions are:

1. why values printed FROM struct DO NOT match assigned values ?
2. why is "radius" TWICE of the value assigned from struct?

PS
Only
radius struct 0.065789
is of correct value.

Cheers
AnswerRe: Math problem with C code Pin
k505418-Apr-20 7:00
mvek505418-Apr-20 7:00 
GeneralSOLVED Re: Math problem with C code Pin
Vaclav_18-Apr-20 8:16
Vaclav_18-Apr-20 8:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.