Sign in to follow this  

Using Devil

This topic is 4693 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to create a program that displays a quad texture on it. I try to use Devil to load images but I didnt find a good example code or any tutorial for it. What's the problem and how to fix it? So i tried something like this: // in WinMain ILuint texture = 0; ilInit(); if (!CreateWnd(800, 600, "OpenGL window")) return 0; ilutRenderer(ILUT_OPENGL); ilGenImages(1, &texture); ilBindImage(texture); ilLoadImage("keke.bmp"); glTexImage2D(GL_TEXTURE_2D, 0, 3, 128, 128, 0, GL_RGB, GL_UNSIGNED_BYTE, ilGetData()); if(ilGetError() != IL_NO_ERROR) MessageBox(NULL, "Error", "Info", MB_OK); glViewport(0, 0, 800, 600); glMatrixMode(GL_PROJECTION); gluOrtho2D(0, 800, 0, 600); glMatrixMode(GL_MODELVIEW); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture); while(1) { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message==WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } else { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(0, 0, -5); glBegin(GL_QUADS); glColor3f(1, 0, 0); glTexCoord2f(0, 0); glVertex3f(-1, 1, 0); glTexCoord2f(1, 0); glVertex3f( 1, 1, 0); glTexCoord2f(1, 1); glVertex3f( 1, -1, 0); glTexCoord2f(0, 1); glVertex3f(-1, -1, 0); glEnd(); SwapBuffers(hdc); } } ilDeleteImages(1, &texture); [Edited by - Liquid_Vision on February 8, 2005 3:02:52 PM]

Share this post


Link to post
Share on other sites
That texture mapping tutorial Lesson 6 on nehe.gamedev.net is also available in OpenIL(Devil) but its for Visual C++ and I tried to compile it with Dev-C++ and an error occured during the program was running. No errors when compiling. There are not so much differences between Visual C++ and Dev-C++ so i wonder if that code example works on Visual C++ either..

I would be really happy if someone tried to help me

Share this post


Link to post
Share on other sites
Check this thread:

http://www.gamedev.net/community/forums/topic.asp?topic_id=290348

We use devil to load our images (full source included). Its a long thread so you're going to have to do a bit of digging.

Hope this helps :),
- llvllatrix

Share this post


Link to post
Share on other sites

This topic is 4693 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this