It is currently Mon Apr 24, 2017 1:59 pm

All times are UTC - 5 hours




 Page 4 of 4 [ 92 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject:
PostPosted: Sat Apr 24, 2010 10:23 am 

Joined: Sun Apr 18, 2010 11:46 am
Posts: 8
Well, I ran it through the debugger, but I'm just not sure exactly what to look for.

This is where the problem occurs:

int iPixelFormat = ChoosePixelFormat( m_hDC, &pfd );
   if (!iPixelFormat) {
      DestroyWnd();
      m_pErrorHandler->SetError(EC_OpenGL,"Could not find suitable OpenGL pixel format to use.");
      return false;
   }


In the debugger, I'm watching the variables that I'm putting into the ChoosePixelFormat function when I call it (because that is whats causing iPixelFormat to be 0, and thus causing the program to end.

This is what the values are:
m_hDC = 0x00000000 {unused=??? }
&pfd = 0x0013f330 {nSize=40 nVersion=1 dwFlags=37 ...} tagPIXELFORMATDESCRIPTOR *

So, m_hDC doesn't have a value? Could that be part of the problem?


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Apr 24, 2010 10:57 am 

Joined: Fri Sep 04, 2009 3:24 am
Posts: 30
In GameOGL::create scroll down to the CreateWindowEx area.

Look for the if check if (m_hDC == NULL)

Make sure it isn't set to if (m_hDC = NULL)

If it's ok, there should be a line above it m_hDC = GetDC(m_hWnd);

After that, I'm out of ideals.


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Apr 24, 2010 11:19 am 

Joined: Sun Apr 18, 2010 11:46 am
Posts: 8
Thank you! It works fine now!

However, its saying I'm getting between 800 and 1000 FPS, how is that possible?


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Apr 24, 2010 11:45 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1094
Location: Ontario Canada
AdamD wrote:
Thank you! It works fine now!

However, its saying I'm getting between 800 and 1000 FPS, how is that possible?


What did you have to change to make your code work?

There are two possibilities that I can think of that would cause you to have a frame rate of 800-1000.

a) you have a typo in the math used to calculate your frame rate
b) you have VSync turned off http://www.marek-knows.com/phpBB3/viewt ... =1104#1104


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Apr 24, 2010 11:52 pm 

Joined: Fri Sep 04, 2009 3:24 am
Posts: 30
I've actually experienced the same issue with the frame rate. The original system I had was xp, 2ghz processor and 9500GT vid. I didn't have any issue like this. I've since upgraded to Win 7 64-bit, quad 3.4 processor and an ati 5870 vid. and this crops up from time to time. My numbers are around 100 or 1k as well.

I did the vsync vmk and it bounces between 4-6k. I'm assuming it has something to do with the newer ati drivers and the older 1.1 GL file or maybe window 7 or the new processor. It hasn't affected anything, so I haven't persued it. But I am curious as to why it's happening as well.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 3 - GameOGL class (RESOLVED)
PostPosted: Fri Apr 15, 2011 11:42 am 

Joined: Thu Jul 10, 2008 6:04 am
Posts: 5
Hi Marek,

I am retyping the VMK's using VS C++ Express 2010. All seems well except for the Performance timers - I get the following errors:

gameogl.cpp(52): error C3867: 'GameOGL::GetTimePerformanceHigh': function call missing argument list; use '&GameOGL::GetTimePerformanceHigh' to create a pointer to member

gameogl.cpp(63): error C3867: 'GameOGL::GetTimePerformanceRegular': function call missing argument list; use '&GameOGL::GetTimePerformanceRegular' to create a pointer to member

Not sure what "argument list" it's referring to. However, when I do what they suggest, it compiles and links okay, only to crash with a access violation error.

Note: When I build your source code, it compiles and run as expected.

Any clues?
CD

Time passes....

After some debugging, it seems to fail on this line:

m_hWnd = CreateWindowEx(dwStyleEx,
m_pszClassName,
m_pszClassName,
dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
0,0,
rcWnd.right - rcWnd.left, //window width
rcWnd.bottom - rcWnd.top, //window height
NULL,
NULL,
m_hInst,
(void*)this);

Unhandled exception at 0x00413008 in GameEngine.exe: 0xC0000005: Access violation reading location 0x00000000.

Looks like a NULL was passed into the Messagehandler - Oops!

pWnd = (GameOGL*) GetWindowLong(hWindow, GWL_USERDATA);
if (NULL != pWnd) {
bProcessed = pWnd->messageHandler(iMessage, wParam, lParam);
}

I had: if(pWnd == NULL)

Sorry for the false alarm.
CD


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 3 - GameOGL class
PostPosted: Fri Apr 15, 2011 5:19 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1094
Location: Ontario Canada
No problem, I'm glad you were able to solve the problem yourself before I was able to get to a computer to respond!


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 3 - GameOGL class
PostPosted: Mon Jul 22, 2013 3:41 pm 

Joined: Sun Jul 21, 2013 5:17 pm
Posts: 17
Hi, thank you for the tutorial. Very great =)

I have a little problem... the text in the windows bar title is not in a language I know :-(

Here is a screenshot
http://i.minus.com/iEPyu8SfGhfv8.jpg

I have debugged and szTitle is containing the right characters, nothing strange here in :-(

Thank you!


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 3 - GameOGL class
PostPosted: Mon Jul 22, 2013 5:00 pm 

Joined: Sat Aug 16, 2008 7:58 am
Posts: 447
In your project settings for the GameOGL under the ConfigurationProperties -> General section, what is your Character Set set to? Is it Unicode, Mulitbyte etc ? If you are following Marek if I remember correctly he is using Multibyte.

Also if using VS2010 check under Tools->Options: Environment->InternationalSettings and check to see if it is English or SameAsWindows.

These are the only two things I can think of. Hope these help.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 3 - GameOGL class
PostPosted: Mon Jul 22, 2013 5:06 pm 

Joined: Sat Aug 16, 2008 7:58 am
Posts: 447
After looking at your code a little more from your screen shot, I see that you have an error. Im not gonna tell you directly but I will point you in the right direction. If you can answer these two questions the bug in your code should be quite evident. First one, what type of data are you trying to print to the screen in this function? Second, what kind of data are you actually sending to the print call ?


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 3 - GameOGL class
PostPosted: Mon Jul 22, 2013 5:07 pm 

Joined: Sun Jul 21, 2013 5:17 pm
Posts: 17
skilz80 wrote:
In your project settings for the GameOGL under the ConfigurationProperties -> General section, what is your Character Set set to? Is it Unicode, Mulitbyte etc ? If you are following Marek if I remember correctly he is using Multibyte.

This fixed it. had to set it to Multibyte =)

Thank you

and changed all LPCWSTR to LPCSTR


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 3 - GameOGL class
PostPosted: Mon Jul 22, 2013 5:10 pm 

Joined: Sun Jul 21, 2013 5:17 pm
Posts: 17
skilz80 wrote:
After looking at your code a little more from your screen shot, I see that you have an error. Im not gonna tell you directly but I will point you in the right direction. If you can answer these two questions the bug in your code should be quite evident. First one, what type of data are you trying to print to the screen in this function? Second, what kind of data are you actually sending to the print call ?

the LPCWSTR?
I really don't know why, but the compiler told me that the function needed LPCWSTR :\
After changing the general settings to multi-byte the compiler changed idea and told me he need LPCSTR =D and now it's working =)
Was this the bug?

the other bug was this

sprintf(szFPS, " %d FPS",m_fps);


I changed it only for testing, changed back to this
sprintf(szFPS, " %2.0f FPS",m_fps);


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 3 - GameOGL class
PostPosted: Mon Jul 22, 2013 5:20 pm 

Joined: Sat Aug 16, 2008 7:58 am
Posts: 447
excellent glad it is working for you


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 3 - GameOGL class
PostPosted: Mon Jul 22, 2013 5:29 pm 

Joined: Sat Aug 16, 2008 7:58 am
Posts: 447
I believe so, because the unicode character set vs the multibyte character set are stored and encoded differently in the internal compiler. Their signatures are different and their memory bandwith is not the same. If you have your solution set to use unicode but are using multibyte calling convention, then the compiler might complain to you, or if it does build and run, you will get garbage displaying. The same should be true the other way around. For example, if you are passing a string litteral into a function and you are using multibyte it should look like this SomeFunc( "Hello" );
if you are using unicode i believe it would look like this SomeFunc( L"Hello" ); the L before the string in quotes tells the compiler that it is a wide string i think. Not 100% sure. Strings and character types have always been a bit of struggle for me, between different types or remember the rules between them. If someone else knows a little more about this, they can correct me.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 3 - GameOGL class
PostPosted: Sat Dec 21, 2013 12:34 pm 

Joined: Tue May 21, 2013 11:23 am
Posts: 5
I am having an odd problem, in which its putting me in Full-Screen even though I have it set to being windowed.
For some reason, every-time
return (SwapBuffers(m_hDC) ? true : false);
inside function RenderPost() is called, it sends my window into full-screen, when it wasn't before this. When I comment out the SwapBuffers line, my program works just fine in windowed. I am not sure what I have done wrong.

Any Ideas?

http://pastebin.com/2rS2t6sq (This is my gameOGL.CPP file, figured you might need to see that.)


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 3 - GameOGL class
PostPosted: Sun Dec 22, 2013 6:51 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1094
Location: Ontario Canada
The first thing that comes to mind is that your m_hDC is configured incorrectly. Has your code always behaved this way or did you recently make a change and now you are seeing this problem?


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 3 - GameOGL class
PostPosted: Mon Dec 23, 2013 1:09 pm 

Joined: Tue May 21, 2013 11:23 am
Posts: 5
I had a previous project that was farther along in the VMK's, but that was months ago, and I lost/deleted it.
This project I've had this problem with from when we first run it in VMK 03B. I am currently going over the VMK's again to try and catch what I've done wrong.

-- found my problem.. Can't believe I overlooked it so many times. For some reason I had an m_hWnd, and an hWnd in the class, and I used GetDC on a NULL pointer(hWnd was null)

Anyways, thanks for responding as fast as you did.


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 4 of 4 [ 92 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

cron