Problem with OpenGL

"Please leave a message at the beep, we will get back to you when your support contract expires."

Moderators: phlip, Moderators General, Prelates

Posts: 21
Joined: Sat Jan 01, 2011 8:11 pm UTC
Location: An underground bunker somewhere is Eastern Europe

Problem with OpenGL

Postby theknownuniverse » Tue Oct 07, 2014 6:25 am UTC

I don't know if this is the right place for this (it's a homework problem), but I'm kinda desperate, so I thought I'd ask.

I'm taking an intro to game programming class, and I'm running into some problems with Space Invaders. Rather than rendering any of the sprites, the program is only rendering a white square in the corner of the screen. If you need to see my code, it's here: in the folder HW3.

User avatar
It's pronounced 'double u'
Posts: 674
Joined: Wed Jul 30, 2008 4:09 pm UTC
Location: California

Re: Problem with OpenGL

Postby scarecrovv » Wed Oct 08, 2014 7:07 am UTC

I took a quick glance, but didn't see anything glaring. If you want to help us help you (and perhaps help yourself in the process) try writing the smallest program you can that demonstrates the problem, preferably <100 lines. It will be much easier for us, and possibly you, to see what's wrong if the program isn't full of unrelated things.

User avatar
Posts: 230
Joined: Tue May 22, 2012 5:14 pm UTC
Location: Seoul

Re: Problem with OpenGL

Postby WanderingLinguist » Wed Oct 08, 2014 7:42 am UTC

I notice you're not doing any OpenGL error checking. Any of the OpenGL calls could be failing and you wouldn't know it. Generally, for testing, I define a macro* that calls glGetError and logs (printf or whatever) the line number and error code if there's an error. I then use that macro after EVERY OpenGL call that I make. For production, you can just #define the macro to nothing.

That won't solve your problem, but it might give you an idea of where it's failing.

* I know, ugh, macro, but for OpenGL error handling it's the best way I know.

[edit: typos]

Return to “The Help Desk”

Who is online

Users browsing this forum: No registered users and 10 guests