Jump to content
  • Advertisement

Snouty

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

100 Neutral

About Snouty

  • Rank
    Newbie
  1. At the moment, I use the SOIL-Library. I tried it also with DevIL but then I had the problem, that all of the textures are completely black.
  2. Hey, the problem is, that I have to use these images. I am working on a project for my computer graphics course and the images are given from the professor. i uploaded the tex2.jpg to http://s14.directupl...8q8p6v5_jpg.htm. The curious thing is, that nobody else has such problems with the images - thus I thought it might be a problem with my pc oder something like this. Edit: The crash is caused by else { /* user want OpenGL to do all the work! */ glTexImage2D( opengl_texture_target, 0, internal_texture_format, width, height, 0, original_texture_format, GL_UNSIGNED_BYTE, img ); check_for_GL_errors( "glTexImage2D" ); /*printf( "OpenGL DXT compressor\n" ); */ } within the SOIL-library. Done. I get the same error.
  3. Hey guys, last week, I had the problem, that I could not load jpeg-Files with devil (and with no other library). This problem is solved, but today I run into a new problem. I have 2 jpg-files tex1.jpg and tex2.jpg When I want to load tex1.jpg, everything is fine. But when ! want to load the second texture, I get an assertion fault. I checked the textures, both are ok, in the right folder and I could open them with GIMP without any problems. I also tried to load a different texture (tex3.jpg) which is twice as large as tex2.jpg and everything was fine. So my problem is: I dont know why, but I can load several jpg-files, without any problems. But when I try to load tex2.jpg, everything crashes. Are there differences between jpg-files? Even when they are created by the same program (i.e. GIMP)? I tried different libraries as DevIL, SOIL, etc. Everytime I get the same error. Does anybody know what that might be? Thanks a lot Here is a piece of code: bool loadTexture(GLuint* tex_id, const char* filename){ // load image file as opengl texture cout << "Texture " << filename; *tex_id = SOIL_load_OGL_texture(filename, SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y); if(*tex_id == 0){ cout << " could not be loaded!" << endl; return false; } else{ cout << "...ok" << endl; } .... return true; } int main(int argc, char** argv) { glutInit(&argc, argv); // init display mode: glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); center(); glutInitWindowSize (mainw_w, mainw_h); glutInitWindowPosition (mainw_x, mainw_y); glutCreateWindow(mainw_title); // init OpenGL initGL(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutMainLoop(); return 0; }
  4. Hey guys, sorry my laptop broke down last week after I posted my question. -.- Thanks a lot for your answers. I tried the first one and it worked directly I have also another solution: I tried my "old" code together with visual studion 2010 premium and visual studio 2008 express...and it works. So, I am not sure, but for me it seems like there is a bug with respect to visual studio 2010 professional. So again...thank you
  5. Hey, I have problems to load an jpg-image. I googled for a while and in general, using DevIL seems to be a good way to do this. But unfortunately, everytime I call ilLoadImage("texture.jpg"), IL reports the error 1291 (IL_INVALID_EXTENSION) and I just don't know why. Does anybody know, where the problem in my code is? Now, I'm really at a loss and would be grateful for any hint. Thanks a lot for your help #include "stdafx.h" #include <cmath> #include <iostream> #include <fstream> #include <string> #include <assert.h> #include "Terrain.h" #include <GL\SDL.h> #include <SDL_image.h> #include <GL\glext.h> #include <IL\il.h> #include <IL\ilu.h> #include <IL\ilut.h> using namespace std; //#define NO_VBOS // If Defined, VBOs Will Be Forced Off bool g_vbo_supp = false; // ARB_vertex_buffer_object support bool g_multitex_supp = false; // ARB_multitexture support bool g_texcombine_supp = false; // ARB_texture_env_combine support //global variables for the heightmap ... GLuint map_tex; ... ILuint maptex_id; void initGL(void){ LoadGLTextures(); ... } int LoadGLTextures(){ ilGenImages(1, &maptex_id); ilBindImage(maptex_id); if(!ilLoadImage("texture.jpg")){ ilDeleteImages(1, &maptex_id); ILenum error = ilGetError(); std::cout << "Image load failed - IL reports error: " << error << " - " << iluErrorString(error) << std::endl; return false; } else{ ... }// Return Success } int main(int argc, char** argv) { ilutRenderer(ILUT_OPENGL); ilInit(); iluInit(); ilutInit(); ilutRenderer(ILUT_OPENGL); glutInit(&argc, argv); // init display mode: glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); glutInitWindowSize (mainw_w, mainw_h); glutInitWindowPosition (mainw_x, mainw_y); glutCreateWindow (mainw_title); // init OpenGL initGL(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutMainLoop(); //Quit SDL SDL_Quit(); return 0; }
  • 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!