|
That's a good question!
How do I use a palette?
I thought just using the marco ...
<br />
PALETTEINDEX(c));<br />
... would handle all that for me
Something is going on as my program shows
the mandelbrot set all in green!
|
|
|
|
|
the simplest way is to just come up with an array of COLORREF values:
COLORREF pal[MAXITERATIONS];
pal[0] = RGB(0,0,0);
pal[1] = RGB(64,64,0);
pal[2] = RGB(128,128,0);
...etc
then, in your loop, just use "pal[c]" instead of that PALETTEINDEX macro.
an 8-bit display is pretty rare these days. you might as well just aim for 24-bit color.
-c
Please stand by
|
|
|
|
|
How should I set pal[3] through pal[255]?
Am I using a 8-bit display?
How do I use a 24-bit color?
|
|
|
|
|
rbc wrote:
How should I set pal[3] through pal[255]?
pick a set of colors that looks good. in my opinion: 1. fractals work best when the palette fades between two or three colors and 2. generating the palette is as important as picking the right region to render: http://www.smalleranimals.com/thumbfrax/thumbs/_index.htm[^]
rbc wrote:
Am I using a 8-bit display?
i don't know.
rbc wrote:
How do I use a 24-bit color?
don't do anything. just render the pixels by using their COLORREF values.
-c
Please stand by
|
|
|
|
|
Cool web page. You are obviously no stranger to generating
fractals! Yet I am. How would you write a mandelbrot program
in Visual C++?
|
|
|
|
|
rbc wrote:
How would you write a mandelbrot program
in Visual C++?
i would start by doing exactly what you're doing just to get a feel for how things work. then i would add controls to move around (zoom in/out, pan, etc.). then i would add palette creation UI (no idea what i'd do for that). then i'd add a bunch of other fractal types.
a tiny mandelbrot program[^]
#include "stdio.h"
main()
{
int b=0,c=0,q=60,_=q;for(float i=-20,o,O=0,l=0,j,p;j=O*O,p=l*l,
(!_--|(j+p>4)?fputc(b?q+(_/3):10,(i+=!b,p=j=O=l=0,c++,stdout)),
_=q:l=2*O*l+i/20,O=j-p+o),b=c%q,c<2400;o=-2+b*.05);
}
-c
Please stand by
|
|
|
|
|
|
I need to program a code in which I have to return the execution time of a function in lowest time unit possible(like in millisec. or even lower) by the operating system. Can someone tell me what library call I can use in WindowsXp environment.
Thanks
Matthew
|
|
|
|
|
::time is a C runtime function, declared in ctime, which should do what you want. Look up time_t in MSDN.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
|
|
I had this problem a while back, mainly on the file fate/time in differnt time zones with daylight saving time, try this:-
// Allow for daylight saving, file dtm is the GMT value not BST
ntimeBias = 0;
if((dwError = GetTimeZoneInformation(&timeZoneInfo)) != TIME_ZONE_ID_UNKNOWN)
{
if(dwError == TIME_ZONE_ID_DAYLIGHT && !bFAT)
ntimeBias = timeZoneInfo.DaylightBias;
}
// Plus the bias from GMT
ntimeBias += timeZoneInfo.Bias;
modifiedTime = m_OleLastTime + COleDateTimeSpan(0, 0, ntimeBias, 0);
|
|
|
|
|
Sorry missed this!
bFat was just to check it it was a FAT drive as the file times were allegedly stored differently, you probably won't want this.
|
|
|
|
|
|
I see what you mean, apart from maintianing your own list I can't see a solution
Have a look at MSDN ID: Q221542
Unless there is something like _tsetlocale, which sets the time and not just the locale.
Happy hunting!
|
|
|
|
|
If no-one answered your post the first time, posting again twenty minutes is unlikely to help (although, of course, in this particular case... )
This first error is the one you want to look at. All the others are caused by it as well. You need to find which header file CDate is defined in and #include it.
Although a quick scan of the MSDN seems to indicate that there's no such class - did you just make it up?
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
First of all, every request is urgent to the person asking. It helps if instead you say what it's about.
Once your compiler finds a problem, it is confused and will probably find many more which really relate back to the first one. So don't worry about the big list.
Basically, your compiler does not know what a CDate is. To tell it, you need to include the header that declares it. I searched MSDN for CDate in MFC and it could not find it. Unless MSDN is not working in this case ( very possible ) MFC does not define a CDate class, and the standard sure doesn't. Where did you get the code you're using from ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
hi,
make sure u r including afx.h and instead of CDate (What is that?) use CTime.
a bit of suggestion
try using COleDateTime instead of CTime (Include afxdisp.h). the implementation of this class is similiar to CTime but it offers u a wide range of dates.
regards
rishabhs
|
|
|
|
|
Check if m_sDate is in the scope from where you are trying to access(have you declared it somewhere ?) , the second error is because of the first one.
Cheers
Kannan
|
|
|
|
|
CWhateverDateTypeYouEndedUpUsed m_MyDate;
Obviously not literally, but that is what you've failed to do somewhere.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
m_sTime is a CString and you've not created it. Put CString m_sTime; in your header file.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
a tip for more efficienct programming ->
instead of using 2 objects curDate & curTime, u can use a single COleDateTime object to get the date as well as time.
anyways,
to extract day, month etc values from COleDateTime obj,
u can use Format Function.
eg.
COleDateTime::GetCurrentTime().Format( "%a, %d/%m/%Y %H:%M:%S ")
where a , d, m, H etc. means weekday, day, month etc.
rishabhs
"If something looks easy, it's actually difficult. But if somethings looks difficult, it's damn IMPOSSIBLE" (Murphy's Laws)
Cheers!
|
|
|
|
|
dear all,
i'm creating an mfc app and i want to check if the info about my application is stored in registry or not.
how do i go about it?
and how to save my entries if the don't exist?
regards,
rishabhs
|
|
|
|
|
Take a look at RegCreateKey api.
First you need to decide on where you want your app. specific settings to be stored in the registry, typically it would be HKEY_CURRENT_USER\Software\<app name="">
once decided you can use the above API to create (for the first time) or Open the key if it already exist.
Alternately, if you can also try using this ATL class CRegKey
Also if you are using VC++ wizard to generate MFC code, have a look at InitInstance function, where there is a call to SetRegistryKey function.
Cheers
Kannan
|
|
|
|
|
Hi..
you all know the auto-complete thing that vc have..
you know.. when you write a function you have this vars tha need to be pasted to the function. or if you have a class object something like CSring obj and you write obj. then youll have this drop down list of all then function and vars inside it...
so.. for some reason it stoped working in here(Only the DirectX funtion, The win32 API is OK)...
how in the name of all gods do i set it back to work..
What I do is:
1): Set the right Include & Lib path and put them to the top
2); close the VC, delte the *.ncb file, Then opent the VC, but it' wrong also
What should I do ??!!
It's me, code_cold
|
|
|
|
|