Jump to content
  • Advertisement

Obed Zorg

Member
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

145 Neutral

About Obed Zorg

  • Rank
    Newbie
  1. Obed Zorg

    My presentation

    my bad my bad it's indeed oop or oriented object programmation
  2. Hi fellows I encounter some issues in the loading of texture here is the code I wrote You have to assume that the Load3Dmesh() and Draw3Dmesh() work perfectly When I lunch the program I have a untextured plane which not should be the case int main(int argc, char *argv[]) { int l = 0; SDL_Init(SDL_INIT_VIDEO); if ( SDL_WasInit(SDL_INIT_VIDEO) == -1) { exit(1); } SDL_Surface *ecran = NULL; SDL_WM_SetCaption("Render", NULL); ecran = SDL_SetVideoMode(400,400,32,SDL_OPENGL); if ( ecran == NULL) { exit(1); } MeshData plane; plane.filename = "Plane.txt"; plane.texfilename = "Uvtest.png"; FreeImage_Initialise(TRUE); glMatrixMode(GL_PROJECTION); FREE_IMAGE_FORMAT fifmt = FreeImage_GetFileType(plane.texfilename, 0); FIBITMAP *dib = FreeImage_Load(fifmt, plane.texfilename,0); dib = FreeImage_ConvertTo32Bits(dib); glGenTextures( 1, &g_textureID ); glBindTexture( GL_TEXTURE_2D, g_textureID ); glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR ); BYTE *bits = malloc( FreeImage_GetWidth(dib) * FreeImage_GetHeight(dib) * 3 ); BYTE *pixels = (BYTE*)FreeImage_GetBits(dib); //FreeImage store file in BGR format so we swap the bits to have a RGB format int pix; for(pix=0; pix<FreeImage_GetWidth(dib) * FreeImage_GetHeight(dib); pix++) { bits[pix*3+2]=pixels[pix*3+0]; bits[pix*3+1]=pixels[pix*3+1]; bits[pix*3+0]=pixels[pix*3+2]; } glTexImage2D( GL_TEXTURE_2D, 0, 3, FreeImage_GetWidth(dib), FreeImage_GetHeight(dib), 0,GL_RGB, GL_UNSIGNED_BYTE, bits); glBindTexture( GL_TEXTURE_2D, g_textureID ); glLoadIdentity(); glPushMatrix(); gluPerspective(70, (float)400/400, 1, 1000); int count = 1; Load3Dmesh(&plane); SDL_Event event; while(count) { SDL_WaitEvent(&event); switch(event.type) { case SDL_QUIT : count = 0;break; case SDL_KEYDOWN : switch(event.key.keysym.sym) { case SDLK_ESCAPE : count = 0;break; };break; } DrawInit(); glScaled(2,2,2); Draw3Dmesh(plane); SDL_GL_SwapBuffers(); } SDL_Quit(); FreeImage_DeInitialise(); getchar(); return 1; } What's wrong ? I thank people you will help me
  3. Obed Zorg

    My presentation

    HI fellows I'm a french student , I'm 21 year old. I used to modelling and programming for 4 years. I'm using blender for modelling and I'm developing in C. At present I am developping a 3D Engine in C I've already developped the loading and the rendering of 3D models (point, wireframe, faces). But I encounter some issues with the C langage (I need to use POO to optimize the project) so I plan to learn D langage and rewrite the whole project. That's all folks please take care of me With regards Obed Zorg
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!