• Advertisement

Archived

This topic is now archived and is closed to further replies.

Lesson 2

This topic is 5749 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

OK, so I''m not getting very far on my own. Laugh if you must. How I am studing this is that I first ran through lesson 1 (good move, eric) by cutting and pasting the lines from the .asp into my MSDEV. And reading everything as I go. Well, this is an error prone method, and thus I discover things when I fail to cut and paste correctly. For example I learned in lesson 1 how important it is to call SetPixelFormat() before trying to call wglCreateContext(). So here I am, I have patched lesson 1 with lesson 2 code fragments, and everything seems to be right, except I have some kind of a bug, and I want to know what it is. I downloaded the full code from lesson 2 and it works just fine. I compared the the two files line by line and I can''t see what is different.... Well I did see one difference in the while(!done) loop in WinMain(), but I patched that too. So what''s happening to me? The window is created, but inside the window are the pixels from what was previously there before the window was created. And as I move the window, the image inside the window moves with it. What should this be telling me is wrong? I just don''t want to simply copy code, I need to be able to debug it too. (and maybe one day write my own ) Never speak in absolutes. -me

Share this post


Link to post
Share on other sites
Advertisement
If it is realy the same code, try to reboot ur PC.... Check, if u have linked everything.....


If it doesnt work it CANT be the same code, like in the files u have downloaded.

Tipp: Download the NeHe Framework and try to insert all the new code into it. The Window Code ist too importent fpr the beginning. but if u wnat to do some better Programms you will have to understand it, too.

(plz, dont flame me :-))

____
void signatur();

Share this post


Link to post
Share on other sites
Well, I know that it must not be the same code.
I have opened two instances of MSDEV. One opens thet full downloaded version, and one opens the patched version.

The patched doesn''t work and the downloaded does.
I have formatted the whitespace and brackets to my liking in the patched version of the program, so it''s not really easy to do a windiff on the files.

I can''t see what is different, my hope was that someone could suggest where I should look based on the symptoms I have described.

I will probably continue onto lesson 3, but I would like to get this mystery solved so that my understanding of the framework is stronger.

Thanks for the reply/bump.

Never speak in absolutes.
-me

Share this post


Link to post
Share on other sites
Sounds like your window is never updated. Are you calling Clear/SwapBuffers?

And for debugging, learn glGetError and Win32 GetLastError.

[edited by - IndirectX on May 31, 2002 7:07:34 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by IndirectX
Sounds like your window is never updated. Are you calling Clear/SwapBuffers?

And for debugging, learn glGetError and Win32 GetLastError.

[edited by - IndirectX on May 31, 2002 7:07:34 PM]


And FormatMessage to get a readable Message of the GetLastError value.

LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
// Process any inserts in lpMsgBuf.
// ...
// Display the string.
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
// Free the buffer.
LocalFree( lpMsgBuf );

The LocalFree is important to remember! Or you''ll have a memory leak...

As for your problem...
Try commenting out pieces of the working code to see if it''ll cause the same error.
Also put breakpoints on the first line of all the functions. And the case''s in the Window Procedure function. Then run the program and remove the breakpoints when there called.
If any don''t get called (like the drawing code) then you know whats not happening!

My guess is that the drawing code is not being called.

quote:
Laugh if you must.

I think I won''t... I remember being at that point all to well!
The sad face is because that was 15 years ago.

l8r,
Rob

-----------------------------------
"An it harm none, do as ye will"

Share this post


Link to post
Share on other sites

  • Advertisement