Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 26 Aug 2005
Offline Last Active Nov 23 2015 09:29 AM

Topics I've Started

Crash depending on file name

10 February 2013 - 09:11 PM

So this has had me stumped for several hours today, and I finally was able to track down what was causing my crash, but I'm not sure why.  A little background:


My project is using GLFW to handle creating the OpenGL context.  Everything was working fine until I tried to add some files from an open source project to do some file parsing.  The library contained some *.cc files.  After adding these files, my program would always crash when trying to create the window, down in dbgheap.c (_CrtIsValidHeapPointer).  


The first weird thing I noticed was that this crash would happen even if I wasn't calling into any of the new library.  So I started removing more and more of the library until I was left with a single *empty* .cc file.  Removing the *.cc file fixed the problem.  If I re-added the .cc file, the crash would immediately start happening again.  


So I started experimenting some more.  Renaming the file to a .h file *inside VS* wouldn't fix the crash, but if I removed the file from VS, renamed it from the file explorer, and then re-added it as a .h, it wouldn't crash.  Oddly, once I had added it as a .h, I could rename it back to .cc inside VS and it would be fine.


Also, I noticed that the crash only happens during a Debug build.  Release is fine.


So, I'm not entirely sure what's going on here, but it might have something to do with the .cc file causing VS to use some different versions of the standard libraries, which are somehow causing a crash?  I thought .cc was just another extension for C++ files.  Can somebody explain what exactly is going on here?  

Crash calling SOIL_load_image

07 February 2013 - 08:00 PM

I'm trying to use SOIL (Simple OpenGL Image Library) to load images in my project.  However, it is crashing whenever I call SOIL_load_image, from an unhandled exception writing location 0x00000014.  (I'm following this tutorial, btw: http://open.gl/textures).  


I'm unsure of what I can do to fix this issue, but I think its something related to how I'm setting up the library.  Yesterday, I was trying to do something similar with libPNG and was running into a similar crash when the library attempted to do some file IO.  At the time, I thought it was probably an issue with the library, but now that I'm getting another crash with a different library, I think it might be me.


For the SOIL library, I built the project and copied the debug SOIL.lib to my VC/lib directory, and SOIL.h to the VC/include directory.  It seems to be building fine, but is crashing.  I tried it with the release .lib as well and the same thing happens.


Where I'm trying to load the image (GLTextureFactory.cpp):

#include "GLTextureFactory.h"

#pragma comment(lib, "SOIL")

#include <SOIL.h>

#include "GLTexture.h"





GLTexture *GLTextureFactory::createTextureForImage(const char *imageFilename)
    int width, height;

    unsigned char* image = SOIL_load_image(imageFilename, &width, &height, 0, SOIL_LOAD_RGB);
    //glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image );

    return new GLTexture(0);


I have included GLM in my project, and am also linking against:
#pragma comment(lib, "GLFW")
#pragma comment(lib, "opengl32")
#pragma comment(lib, "glu32")
#pragma comment(lib, "glew32")
Any help is very appreciated!

glReadPixels color order

12 April 2010 - 08:09 AM

glReadPixels(x, y, w, y+h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, buff);
Is there a way to tell what order the R G B A are written out in? It seems like some devices switch R and B...

rendering glitch

31 March 2010 - 03:45 AM

Hi, I'm working on an AR project on android, using OpenGL. For some reason, on one particular phone, drawing a textured quad is 'glitching' and looks terrible. Its hard to describe; the quad is drawn overhead, and depending on the orientation of the camera, it will either draw correctly, or draw with triangular sections missing, as you can see in this screenshot: http://www.tc.umn.edu/~atki0090/graphics_glitch.png correct: http://www.tc.umn.edu/~atki0090/normal.png My guess is that I am incorrectly configuring opengl on this device, but I am not sure at all what I am setting incorrectly, as I've never seen an artifact like this before. Does anybody have an idea what could cause this?

glReadPixels draw issue

18 March 2010 - 08:54 AM

I'm working on an Android project and having trouble with glReadPixels. In order to determine what the user is clicking on, I am giving each object a unique color and redrawing the scene. I use glReadPixels to get the pixel color where they touched, and then I'm able to use that color and figure out what object they touched. The (simplified) flow of the draw function looks something like this:
  if (bScreenWasTouched)
    glReadPixels();//read pixel they touched
    glClear(color | depth);

The problem is that on some android devices the screen isn't getting cleared when glClear is called (you can see the results of drawSceneWithTouchColors when I would expect it to be gone). If I remove only the glReadPixels call, then everything works correctly. This really confuses me since I'm still doing all the drawSceneWithTouchColors drawing. At first I thought maybe it was a bug with the device's opengl implementation, but I am seeing this on another phone as well (other phones work fine), which makes me think I'm doing something wrong and most phones are handling my error more gracefully. Any ideas? I'm kinda stumped on this..