Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?

[OpenGL, GLUT, C++] Ładowanie tekstur

Ostatnio zmodyfikowano 2013-06-02 12:51
Autor Wiadomość
Menos
Temat założony przez niniejszego użytkownika
[OpenGL, GLUT, C++] Ładowanie tekstur
» 2013-04-30 21:37:26
Witam.
Pobrałem gotowy Loadres plików bmp, do tekstur .

Uruchamiam program... i błąd.. Siedze nad tym już 3 dzień i nie moge zrozumieć o co chodzi..

C/C++
#include <windows.h>              // musi byæ, nie mo¿na u¿yæ <stdio.h> zamiast tego
#define GLUT_DISABLE_ATEXIT_HACK  // musi byæ u¿yte przed includowaniem "glut.h"
#include <gl/glut.h>
#include <gl/glu.h>
#include <gl/gl.h>
#include <math.h>
#include "imageloader.h"
/****/
void BezruchMyszy( int mx, int my );
void idle( int val );
void pressKey( int key, int x, int y );
void releaseKey( int key, int x, int y );
void processNormalKeys( unsigned char key, int x, int y );
void domek( float dl );
void zorientujMnie( float ang, float angy );
void ruchMyszki( int mx, int my );
void BezruchMyszy( int mx, int my );
void MyszWyszla( int stan );
void Mysz( int klawisz, int stan, int mx, int my );
void PlaskiRuch( int i );
void Reshape( int w, int h );
void renderScene( void );
void createMenus();
GLuint loadTexture( Image * image );
void zaladujObrazy();
/****/
int wys, szer;
float kat = 0.0, katY = 0.0, deltakat = 0.0, deltakatY = 0.0, ratio; // obroty
float x = 0.0, y = 0.75, z = 5.0;
float lx = 0.0, ly = 0.0, lz = - 1.0;
int deltaRuch = 0; // ruch przód-ty³
int kolorT = 0, kolorZ = 0, ksztaltF = 0; // Do Menu

GLuint _textureId, _textureId2, _textureId3;

GLuint loadTexture( Image * image )
{
    GLuint textureId;
    glGenTextures( 1, & textureId ); //Tworzymy miejsce dla tekstury
    glBindTexture( GL_TEXTURE_2D, textureId ); //Mówimy OpenGl jaka tekstura
    //Map the image to the texture
    glTexImage2D( GL_TEXTURE_2D, //zawsze GL_TEXTURE_2D
    0, //0 teraz
    GL_RGB, //Format OpenGL użyty dla obrazu
    image->width, image->height, //Szerokość i wysokość
    0, //Ramka obrazu
    GL_RGB, //GL_RGB, pixele są w tym formacie
    GL_UNSIGNED_BYTE, //GL_UNSIGNED_BYTE, pixele są takimi zmiennymi
    image->pixels ); //uaktualnienie pixeli
    return textureId; //zwraca identyfikator tekstury;
}
void idle( int val )
{
    glutPostRedisplay();
}
void zaladujObrazy()
{
    Image * image = loadBMP( "domek.bmp" );
    _textureId = loadTexture( image );
    delete image;
   
}

Loader mam z :

http://www.videotutorialsrock.com/opengl_tutorial/textures/text.php


A taki mam błąd:

Assertion failed (!input.fail() )|| (!"Could not find file")
P-81634
akwes
» 2013-04-30 21:41:49
I błąd Ci nic nie mówi?
P-81635
Menos
Temat założony przez niniejszego użytkownika
» 2013-04-30 21:44:52
Właśnie nie wiem o co w niej chodzi za bardzo..... pododawałem pliki zainckludowałem pliki od loadera..
I nie wiem....
P-81636
Gabes
» 2013-04-30 22:02:20
Twoja bitmapa powinna mieć 24-bitową głębie kolorów.
P-81638
Menos
Temat założony przez niniejszego użytkownika
» 2013-04-30 22:06:23
Mam 24 oraz 8.  Nie działa...
P-81641
SeaMonster131
» 2013-04-30 22:06:55
Gdzie znajduje się plik graficzny, który wczytujesz?
P-81642
akwes
» 2013-04-30 22:07:40
C/C++
Image * loadBMP( const char * filename ) {
    ifstream input;
    input.open( filename, ifstream::binary );
    assert( !input.fail() || !"Could not find file" );
    // ...

@up, zgadnij ;> Pewnie nie tam gdzie powinien.
P-81643
Menos
Temat założony przez niniejszego użytkownika
» 2013-04-30 22:08:11
Tam gdzie main.cpp w którym jest cały kod, w tym samym katalogu
P-81645
« 1 » 2 3 4
  Strona 1 z 4 Następna strona