Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

102 Neutral

About clayrab

  • Rank
  1. Okay, so in hope of finding a clue I printf'ed the entire buffer and found some very strange behaviour. Each byte is seperated by a colon. This is what 'one hit' looks like on OSX 1:-2823681:-2823681:96:1:-2823681:-2823681:123:0:-2823681:-2823681:201:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0: This looks perfectly normal. There are two extra hits, but those are simply leftover from another frame, the buffer isn't zeroed out every frame, that would be a waste. In Windows, however, the buffer looks like this: [font="monospace"]12:12:0:0:0:0:0:4:0:0:0:0:0:0:0:0:0:4:0:251658240:0:-2127593169:637567279:-2051201536:0:0:0:0:1065353216:-998637568:1148846080:0:0:515:0:1155930377:0:0:6408:0:9728:83886080:66336:0:0:65536:66817:0:0:65536:0:0:0:1158479872:0:0:0:0:0:0:335616264:0:1154637824:0:52430080:838860801:0:0:0:338694144:0:0:0:0:335616264:0:0:0:0:0:0:335616264:0:1158537216:0:0:0:0:335616264:0:336887808:0:0:0:0:335616264:0:0:0:0:0:0:335616264:0:1144410112:0:0:0:0:335616264:0:337448960:0:0:0:0:335616264:0:0:0:0:0:0:335616264:0:1142222848:0:0:0:0:335616264:0:332238848:0:0:0:0:335616264:0:0:0:0:0:0:335616264:0:0:0:0:0:0:335616264:0:0:0:0:0:0:335616264:0:104978368:0:0:0:0:335616264:0:9:0:2:1280:800:1:0:4:0:0:0:0:4:0:80:13:1:0:4259840:4:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1:0:18:0:0:2:5120:4:1280:800:1:80:13:1:0:4:0:0:1280:800:1:10:9:0:0:0:0:0:0:0:0:0:0:0:0:0:785907712:0:0:0:0:0:-1091632638:0:1280:800:1:10:9:0:0:12:12:1:0:4:0:0:0:0:0:0:0:0:0:0:0:4:0:0:0:0:0:0:0:4259840:0:0:0:0:1073743168:0:712057992:1359073280:3145728:-2147482368:66336:50331648:0:155794:81:15728640:0:0:0:0:0:0:0:0:0:0:0:0:0:0:16:0:4259840:0:105055264:0:4:0:0:0:0:0:0:0:213:513:2:2:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:4259840:0:0:4259840:0:0:0:0:45519708:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:12:45514250:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1:262144:[/font] [font="monospace"] Complete garbage. Anyway, I found the problem halfway through writing this post but figured I'd include all this anyway in case it helps someone else. The problem was actually quite simple. RTFM!!!!! "glSelectBuffer[font="Times"] must be issued before selection mode is enabled, and it must not be issued while the rendering mode is [/font]GL_SELECT[font="Times"]."[/font] [font="Times"]So, if you have a bunch of garbage in your select buffer, you probably called [/font]glSelectBuffer while in GL_SELECT render mode. [/font]
  2. I have some more details so I figure I might as well add them... The game is also crashing on Windows... Occasionally the VM it's running in crashes as well and twice now my entire system crashed... I was somehow able to get some info from it before my system went down last time though. It was finding 0 or 1 names for a while(which is expected) but then suddenly it found 80 on one frame and then 18 million + on the next! Since I only allocated 512 bytes for the buffer of names, I'm guessing the gl is writing millions of bytes across my memory and this is why everything is crashing... Edit: Additionally, removing ALL of the picking code(everything after glRenderMode(GL_SELECT) and before glRenderMode(GL_RENDER)) stabilizes it.
  3. Hodgman, I'm using gluPickMatrix/glSelectBuffer... Not sure if that answers your question. I actually call gluPickMatrix twice, once for the UI and once for the game board. I'm in GL_SELECT render mode, of course. Edit: it's basically copied from NeHe
  4. I've been developing a game in OSX since last April and the time has come to try to compile it on Windows. Everything works perfectly except for picking and I can't understand why the same code would work one way on windows and another way on OSX... The issue is that sometimes on Windows the picking buffer has 5 names in it... I'm not sure if one of these might actually be the proper name, but regardless, I only give one name to any object so this shouldn't be possible. So, I'm quite lost and am hoping that maybe someone has a clue that could point me in the right direction. I'm using gcc(with mingw on windows) and opengl 2.1. Although, I'm actually dynamically linking against opengl32.dll on Windows, I have confirmed that I'm getting a 2.1 context. Additionally, I *believe* this was working a while ago and have since then added display lists to my code... It's going to be a bit of a pain, but I'm going to rip out that code for now to see if that might be causing an issue since they were deprecated in 3.1... I don't *think* it's the issue but will know shortly and will report back here.
  5. Thanks Bob! That's definitely what's going on. I am only checking the first hit. I just took a closer look at my code, I have a line to confirm that there is only one name for my hit and thought this code was confirming there's only one hit. *facepalm*
  6. Hello everyone, I'm new on gamedev.net but have lurked here for a while. I am developing a turn based strategy game and am having a strange issue with picking that I'm hoping someone here will be able to clarify. In order for the top, i.e. viewable, object to be selected when in picking mode, it seems that I need to draw the objects in the reverse order as when I'm in GL_RENDER mode... I'm a bit confused why this would be and am hoping that this is either expected behavior, or that I'm making some common mistake and that someone here might be able to explain. If I can't figure this out then I can simply track clickable gameboard objects, unclickable gameboard objects, clickable UI objects, and unclickable UI objects separately and then draw them in different orders for each mode, but this is a bit of work and seems quite hacky. Thanks in advance! Clay
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!