Author Topic: OpenGL won't work on netbook PC  (Read 15159 times)

Wyzemann

  • Regular
  • **
  • Posts: 26
    • View Profile
OpenGL won't work on netbook PC
« on: 2011-02-12, 10:01:00 PM »
I recently found SGDK and I am intrigued by it, especially its scripting features. I have been playing with version 1 since version 2 uses opengl which doesn't work on my system. I was hoping there was a way to get it to work since I spend most of my time on this computer anymore.

It may be that my integrated video board is not compatible with SGDK. However, it does seem to meet the minimum requirements.
I have updated the video driver to no avail. It is running Windows XP Home edition SP3. (Running on AtomN450, 2GB RAM).

GPU Shark v0.3.2 utility provides this information:

GPU: Intel GMA 3150
Memory size: 384 MB
Open GL Platform: Intel Pineview
Open GL 1.4.0

I went through the tutorial step by step and when I got to the map editor it produced the following error:

An error occurred while drawing the display in the map editor. In order to attempt to avoid fatal errors...
Details:
System.Exception:InvalidEnum
 at SGDK2.Display.CheckError()
 at SGDK2.Display.DrawFrame(TextureRef texture, Rectangle sourceRect,Point[] corners,Int32 offsetX,Int32 offsetY)
 at SGDK2.Layer.Draw(Display Display, Size ViewSize)
 at SGDK2.frmMapEditor.MaoDisplay_Paint(Object sender, PaintEventArgs e)

A second dialog box appears

GL_ARB_texture_rectangle may be required for proper operation. The current video driver does not support this feature. Try updating your video drivers.

Then after I click OK the first dialog appears again. Then it just doesn't work.
I am aware of a similar problem that was mentioned in the forums. It was actually repaired by changing the source code to omit error detection. That was a problem with OpenGL 3.x I did this and it didn't change anything. Also note that it does the same thing if I try to run any games created with SGDK 2.1.x

The directX versions of SGDK work without any issues.
Is there a workaround for this or is it simply incompatible? Is there a way to get the latest SGDK to use directX so it will work on my netbook?

Chris

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: OpenGL won't work on netbook PC
« Reply #1 on: 2011-02-13, 08:59:05 AM »
As indicated by the error message, your hardware and OpenGL driver need to support GL_ARB_texture_rectangle.  Try running an OpenGL diagnostic utility such as OpenGL Extension Viewer and check the "Extensions" section for "GL_ARB_texture_rectangle" in the "Extensions" folder's "ARB" branch.  I don't know why some hardware/drivers do not support this.  It seems like a really simple thing.  If you can find it in the list, I would be interested to know what it looks like (what child items appear under it) and if it is supported on your system.

Wyzemann

  • Regular
  • **
  • Posts: 26
    • View Profile
Re: OpenGL won't work on netbook PC
« Reply #2 on: 2011-02-13, 12:30:15 PM »
I downloaded and ran the OpenGL extension viewer.
ARB_texture_rectangle is not there.

Here is the list:
GL_ARB_depth_texture
GL_ARB_fragment_program
GL_ARB_multitexture
GL_ARB_point_parameters
GL_ARB_shadow
GL_ARB_texture_border_clamp
GL_ARB_texture_compression
GL_ARB_texture_cube_map
GL_ARB_texture_env_add
GL_ARB_texture_env_combine
GL_ARB_texture_env_crossbar
GL_ARB_texture_env_dot3
GL_ARB_transpose_matrix
GL_ARB_vertex_buffer_object
GL_ARB_vertex_program
GL_ARB_window_pos
WGL_ARB_buffer_region
WGL_ARB_extensions_string
WGL_ARB_make_current_read
WGL_ARB_pbuffer
WGL_ARB_pixel_format

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: OpenGL won't work on netbook PC
« Reply #3 on: 2011-02-13, 09:02:14 PM »
Is there any reason you use the ARB_texture_rectangle extension?  Would it be that much more difficult to draw polygons as necessary?  It seems like it would be more supported.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: OpenGL won't work on netbook PC
« Reply #4 on: 2011-02-14, 06:23:37 AM »
I use texture-rectangle because it allows me to use pixel coordinates and NPOTS textures.  I'm rather fuzzy in this general area, though ... I don't know what capabilities require what features to be present or what my alternatives are in drawing 2-D graphics while applying transformations.  I found one solution, but don't know what others might be available.

Wyzemann

  • Regular
  • **
  • Posts: 26
    • View Profile
Re: OpenGL won't work on netbook PC
« Reply #5 on: 2011-02-14, 02:54:33 PM »
Thanks for looking into it. I appreciate it. Looks like I'll just have to stick with version 1 for now.

Chris

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: OpenGL won't work on netbook PC
« Reply #6 on: 2011-02-14, 04:25:28 PM »
My experience is mainly with OpenGL ES, which handles drawing textures differently, but the problem of pixel coordinates and NPOTS textures is shared.  The problem can be solved relatively simply using a Texture wrapper class that determines if the graphics card supports NPOT textures and if it doesn't, creates an image at the next largest power of 2 at runtime, draws the base image into that image, then stores the scale necessary when drawing the image.  As for pixel coordinates, that could also be solved in the Texture wrapper class.

Out of curiosity, do you do any optimization when drawing multiple frames from the same texture?  On maps, for example, if all of the tiles are from one frameset which are all from one graphic sheet, all of the tiles could be draw in one draw call using glDrawElements.  I suppose most of the time it's not too big an issue as far as speed is concerned, since it's only a 2-D game, but it's a potential bottleneck if you've got lots of tiles onscreen at the same time that could be remedied.  I don't know if it would be easy or if it would require a lower-level change, like requiring tilesets to be defined as taking all tiles from one graphic sheet, or something.  It could possibly be something you detect at compile time, whether to enable that method of drawing tiles or not, depending on where tiles are coming from.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: OpenGL won't work on netbook PC
« Reply #7 on: 2011-02-14, 06:00:52 PM »
I think there is optimization when drawing multiple frames from the same texture.  When DrawFrame is called on the display, it will only call functions to output texture coordinates and viewport vertices (nothing to select a texture) if the previous drawing operation was also DrawFrame and used the same texture.  So that works pretty well.

I did try to go back to DirectX when the previous person who found a problem with ARB_texture_rectangle had this same problem, but I gave up when I discovered that DirectX isn't as flexible as OpenGL when it comes to 2-D transforms.  I have to supply the original transformation matrix, not just the 4 corner points that I want to output.  And getting a transformation matrix out of 4 corners is much more difficult that getting 4 corners our of a transformation matrix.  Since I had already updated SGDK2 to track only the 4 corners and discard the transformation matrix, I gave up.  So maybe I'll have to attack this problem again going after your solution instead of trying to go back to DirectX.  I also neglected to improve the error reporting for sprite rules and plan rules.  So many things to do ... so much TV to interfere with getting any of it done.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: OpenGL won't work on netbook PC
« Reply #8 on: 2011-02-15, 10:57:26 AM »
Well, I can try to clean up the prototype for error reporting that I have working somewhat and upload that.  It's all colorful and stuff, even.

If you decide to do anything with having all graphics be from the same texture and using glDrawElements, you could still use four points and not have to deal with transformation matrices, and draw all the tiles at once.  It would be a bit of a leap from how things are done now, though.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: OpenGL won't work on netbook PC
« Reply #9 on: 2011-02-15, 05:29:05 PM »
I thought I was drawing all the tiles at once.  I guess there's a way to do it even more at once.  But I'm not sure it's worth it.  I'm more interested in making SGDK2 more compatible than making it perform better at the moment.  Runtime performance doesn't seem to be much of an issue.  I think I just need some time before I can look into the error reporting thing, whether it's reviewing your code or writing my own.  How do you feel about your code -- is it clean, or do you think it deserves some review?

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: OpenGL won't work on netbook PC
« Reply #10 on: 2011-02-15, 10:19:17 PM »
Well, I wouldn't put it in as-is.  It seems pretty stable, so at least it won't crash or anything, but it might be inaccurate at times, depending on if you have multiple copies of the same rule doing something wrong in the same way in a single rule list.

As for compatibility, it seems like using glDrawElements or glDrawArrays would be the most compatible with any graphics card available.  You'd just have to deal with non-pixel coordinates and possibly scaling of images drawn into power-of-two textures, if the card doesn't support NPOT textures.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: OpenGL won't work on netbook PC
« Reply #11 on: 2011-02-16, 06:41:54 AM »
I don't think glDrawElements would be any more compatible than glVertex2 and glTexCoord2, would it?

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: OpenGL won't work on netbook PC
« Reply #12 on: 2011-02-16, 01:42:52 PM »
Those methods don't exist in OpenGL ES, so I'm not familiar with them, but I imagine it's just another way of doing the same thing... is that what you're using now, or are you doing something different to use the ARB_texture_rectangle extension?
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: OpenGL won't work on netbook PC
« Reply #13 on: 2011-02-17, 06:13:14 AM »
That's what I'm using now.  Those functions have different behavior depending on whether I've created the texture using GL_ARB_texture_rectangle or not, I think.  I think the same functions would be used if I weren't using GL_ARB_texture_rectangle.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: OpenGL won't work on netbook PC
« Reply #14 on: 2011-02-17, 07:11:00 PM »
Ah, I had assumed the extension was used in how you draw, not how you create textures.  So you could probably create a texture wrapper class to handle all that stuff as necessary rather than relying on the GL_ARB_texture_rectangle extension to do it for you.  Or you could test to see if the extension is supported before deciding whether to use a wrapper class or not.
Edward Dassmesser