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

C / C++ / MFC

 
GeneralRe: raytracer Pin
leon de boer30-Sep-17 7:39
leon de boer30-Sep-17 7:39 
GeneralRe: raytracer Pin
bluatigro1-Oct-17 0:35
bluatigro1-Oct-17 0:35 
GeneralRe: raytracer Pin
bluatigro1-Oct-17 1:00
bluatigro1-Oct-17 1:00 
GeneralRe: raytracer Pin
leon de boer1-Oct-17 4:45
leon de boer1-Oct-17 4:45 
GeneralRe: raytracer Pin
bluatigro1-Oct-17 5:56
bluatigro1-Oct-17 5:56 
GeneralRe: raytracer Pin
leon de boer1-Oct-17 16:20
leon de boer1-Oct-17 16:20 
GeneralRe: raytracer Pin
bluatigro2-Oct-17 1:34
bluatigro2-Oct-17 1:34 
GeneralRe: raytracer Pin
leon de boer2-Oct-17 3:46
leon de boer2-Oct-17 3:46 
Still not following why you are doing software renderer you are on windows you can setup the hardware accelerated renderer.

Beside that 2 other comments ...

1.) Your value of Pi is wrong
1000 places of Pi[^]
2.) You obviously struggling to make frame filename and frame is already use .. try this
void frameName (TCHAR* buffer, int bufsize, const TCHAR* nameStart, const TCHAR* ext, int no, int len)
{
	// format string must be ascii .. do not change these 2 lines even on unicode
    // I know its strange but thats the way it is .. format strings are always ascii
	char fmtstring[32];	
	sprintf_s(fmtstring, _countof(fmtstring), "%s%i%s", "%s%0", len, "i.%s");
	// Okay now we swing unicode/ascii for actual string
	_stprintf_s(buffer, bufsize, fmtstring, nameStart, no, ext);
}

It looks slightly strange because you have to make the format string.
"%s%08i.%s" is an example format string, which basically says string + integer to 8 digits + . + string
The problem is you don't want a constant 8 you want Len so you have to 1st build the format string
Example of use of what I suspect you are trying to do. Len I assume is length of number padded with "0"'s
TCHAR buf[256];
frameName(buf, _countof(buf), _T("test"), _T("bmp"), 1, 6); // Will give Test000001.bmp in buf

If you haven't run across TCHAR before it is a character type that changes with compile mode.
In Ansi mode it is char
In unicode mode it is wchar

I have no idea if you are compiling in ansi mode or unicode, you had both so I am trying to be careful
to support either which is what using TCHAR does. However you need to be aware TCHAR size changes.
That is the reason for using _countof() rather than sizeof() for the buffer size.
In vino veritas


modified 2-Oct-17 10:21am.

GeneralRe: raytracer Pin
leon de boer2-Oct-17 10:00
leon de boer2-Oct-17 10:00 
GeneralRe: raytracer Pin
bluatigro2-Oct-17 22:57
bluatigro2-Oct-17 22:57 
GeneralRe: raytracer Pin
leon de boer3-Oct-17 4:47
leon de boer3-Oct-17 4:47 
GeneralRe: raytracer Pin
bluatigro6-Oct-17 1:30
bluatigro6-Oct-17 1:30 
GeneralRe: raytracer Pin
bluatigro22-Oct-17 22:37
bluatigro22-Oct-17 22:37 
QuestionCPP Syntax Pin
Bram van Kampen28-Sep-17 11:17
Bram van Kampen28-Sep-17 11:17 
AnswerRe: CPP Syntax Pin
CPallini28-Sep-17 22:16
mveCPallini28-Sep-17 22:16 
GeneralRe: CPP Syntax Pin
Bram van Kampen6-Oct-17 13:51
Bram van Kampen6-Oct-17 13:51 
QuestionComparing Files for Differences Pin
Member 1343302227-Sep-17 3:42
Member 1343302227-Sep-17 3:42 
AnswerRe: Comparing Files for Differences Pin
jeron127-Sep-17 4:09
jeron127-Sep-17 4:09 
QuestionRe: Comparing Files for Differences Pin
David Crow27-Sep-17 5:24
David Crow27-Sep-17 5:24 
AnswerRe: Comparing Files for Differences Pin
jschell27-Sep-17 9:23
jschell27-Sep-17 9:23 
GeneralRe: Comparing Files for Differences Pin
Member 1343302228-Sep-17 2:41
Member 1343302228-Sep-17 2:41 
GeneralRe: Comparing Files for Differences Pin
Jochen Arndt28-Sep-17 3:29
professionalJochen Arndt28-Sep-17 3:29 
GeneralMessage Closed Pin
29-Sep-17 4:00
Member 1343302229-Sep-17 4:00 
GeneralRe: Comparing Files for Differences Pin
jeron129-Sep-17 4:47
jeron129-Sep-17 4:47 
GeneralRe: Comparing Files for Differences Pin
Jochen Arndt29-Sep-17 4:58
professionalJochen Arndt29-Sep-17 4:58 

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.