PDA

View Full Version : pb with VC++ and running opengl prgms



romb
07-29-2002, 09:21 AM
hello !
i have 2 pbs :
-the first one is that when i run my prgm with VC++, textures don't appear but the bitmap do, and when i run the compiled prgm with explorer textures appear but the bitmap doesn't. Somebody has a solution ?

-the second : the piece of code under is made for putting a bitmap (called rasters) on a 3d scene, maybe it is not optimized. If somebody could help me ...

//***************************************

glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

// afficher le bitmap
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho (0.0,Winw,0.0,Winh,-1.0,1.0);
glRasterPos2i (Winw/2, Winh*50/100);
glDrawPixels(12,12,GL_RGBA,GL_BYTE,rasters);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
// passer la 3d ...
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

gluLookAt(3,2,3,0,0,0,0,1,0);
glRotated(a,0,1,0);

glBindTexture(GL_TEXTURE_2D,Image[0]);

glBegin(GL_QUADS);

MikeC
07-30-2002, 11:54 AM
The first thing I'd look at is where you're loading your bitmap and textures from. Typically when running under the VS IDE an app executes in the project directory, call it Foo. When you double-click on the exe in Explorer, it's probably in the build directory, e.g. Foo\Debug or Foo\Release.

Now, suppose your folder structure looks like this:




Foo
Release
Foo.exe
MyTexture.bmp
MyBitmap.bmp


Now, suppose your app tries to load its textures and bitmaps without specifying a full path, and suppose your loading functions don't have as much error checking as perhaps they might. That would explain what you're seeing.

Or might be barking up the wrong tree completely, but without any detail to go on nothing else springs to mind.

HTH
Mike

kevinhoque
07-30-2002, 12:05 PM
Hi romb, not sure what the answer to your questions is but Mike has given you some good pointers. Perhaps the beginners' forum would a better place to post this kind query though...

Kevin