Could someone help me out ?
Hey everyone, I''m new to opengl, about 2 months, and I have been reading through Nehe''s tutorials. There are a few questions that I have, and (seeing as how I''m 15) was wondering if any more experienced people could help me with them.
1. I''ve read over Nehe''s tutorial on texture mapping a billion times, fiddled with it for a couple weeks, looked over my code, and messed with that, but can not, for the life of me figure out how to add more than one texture to my programs. Could someone help me out ?
2. I had an idea for a great minidemo, and sat down to right it, the other day. Silly me, I thought that lighting would automatically generate shadows. Could someone post some code on realtime shadow creation, and how to use it ? Or just plain shadows ?
3. I was thinking the other day about lighting, and how to use it neatly, and then an idea popped into my head, and I don''t know if I can use it or not. Does anyone know how to make volumetric, or surface visible lighting ? Like the kind seen in Quake 3 ?
4. Something I''ve been looking into for a while, and reading up on a little (though not understanding all of it) is collision detection. I''ve seen Nehe call it ''edge detection''(maybe thats something different I don''t know) I''ve seen people call it clipping. What I want to know is how to add it to my minidemos.
Thanks again, everyone, for reading my post, and hopefully heloing me with this. I''ve been looking for alot of this stuff for a while, maybe someone can help me out.
The Kid
I don''t know what the future holds, but I know who holds the future.
I don''t know what the future holds, but I know who holds the future.
July 18, 2000 09:06 AM
You can''t display more than one texture? I don''t understand this. NeHe''s tutorials tell you how do do this...
You need to learn how to use C++ because, quite frankly, displaying more than one texture is easy.
Do you know what a pointer is? I don''t think you do.
Sorry, but you should learn C++ first before you even think about opengl.
You need to learn how to use C++ because, quite frankly, displaying more than one texture is easy.
Do you know what a pointer is? I don''t think you do.
Sorry, but you should learn C++ first before you even think about opengl.
It would probably be helpful (for those who can help you) if you posted a bit of your code, namely that which should be working, but isn''t.
Jeese I thought this would be a nice forum.
Anonymous> Anyway, I have a little background in C++, and am using VC++ 6.0 to compile my OpenGL stuff. I''m learning C++ on my own, and am schedualed to take classes in it too. I don''t know whats up with my code, its probably something small, only a newbie would miss. I''ll dig it off my hard drive, and post a web address if anyone will take me seriously. Just because I''m 15, doesn''t mean I''m incompitant. I''m having the same kind of problems any beginer would have. If you still won''t take me seriously, or atleast try to help, then its not me who needs to grow up a little.
borzwazie> I''ll post some code for you, or others, to look at. I''ll also give the address for you to get the who file, incase I did something wrong earlier, or something stupid like that. Knowing me, its a newbie mistake.
The Kid
I don''t know what the future holds, but I know who holds the future.
Anonymous> Anyway, I have a little background in C++, and am using VC++ 6.0 to compile my OpenGL stuff. I''m learning C++ on my own, and am schedualed to take classes in it too. I don''t know whats up with my code, its probably something small, only a newbie would miss. I''ll dig it off my hard drive, and post a web address if anyone will take me seriously. Just because I''m 15, doesn''t mean I''m incompitant. I''m having the same kind of problems any beginer would have. If you still won''t take me seriously, or atleast try to help, then its not me who needs to grow up a little.
borzwazie> I''ll post some code for you, or others, to look at. I''ll also give the address for you to get the who file, incase I did something wrong earlier, or something stupid like that. Knowing me, its a newbie mistake.
The Kid
I don''t know what the future holds, but I know who holds the future.
I don''t know what the future holds, but I know who holds the future.
July 18, 2000 11:00 PM
To lazy to register!
I have been looking over Nehe''s tutorials for about a month now also, I am a beginner too. By the way im 16. I am not sure about any of your other problems...except the first one. I was easily able to add more than one texture to my program...just by loading another texture. I guess it just must be a very simple mistake that is unbelievably hard to catch ( like in your window callback function under default when you call the default window func handler thingy DefWindowProc()(or something like that) your need to put return DefWindowProc(message) or your program wont start!!! ... actually forgot the return once and ended up wasting an hour figuring out what was wrong!)anyways...i would show you my code ''cept i kinda had to format after trying to upgrade to win2k!!! post some code!
Good Luck
I have been looking over Nehe''s tutorials for about a month now also, I am a beginner too. By the way im 16. I am not sure about any of your other problems...except the first one. I was easily able to add more than one texture to my program...just by loading another texture. I guess it just must be a very simple mistake that is unbelievably hard to catch ( like in your window callback function under default when you call the default window func handler thingy DefWindowProc()(or something like that) your need to put return DefWindowProc(message) or your program wont start!!! ... actually forgot the return once and ended up wasting an hour figuring out what was wrong!)anyways...i would show you my code ''cept i kinda had to format after trying to upgrade to win2k!!! post some code!
Good Luck
I''m only 14 almost 15 and have been reading and coding OpenGL stuff for 2 weeks. To have two different textures in one of NeHe''s programs all you have to do is change the following:
Gluint texture[1];
to
Gluint texture[2];
This makes the space for your second texture in the texture array.
In the LoadGLTextures function you change the following line:
AUX_RGBImageRec *TextureImage[1];
to
AUX_RGBImageRec *TextureImage[2];
Also in LoadGLTextures:
add the following right under the first texture things:
if (TextureImage[1]=LoadBMP("WhateverYouWant.bmp"))
{
Status=TRUE; // Set The Status To TRUE
glGenTextures(1, &texture[1]);
glBindTexture(GL_TEXTURE_2D, texture[1]);
glTexParameter(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameter(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,GL_MODULATE);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[1]->sizeX, TextureImage[1]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[1]->data);
}
if (TextureImage[1])
{
if (TextureImage[1]->data)
{
free(TextureImage[1]->data);
}
free(TextureImage[1]);
}
Then in the your draw3dscene right before you start your cube vectorf stuff do this:
glBindTexture(GL_TEXTURE_2D, texture[1]);
If you want more textures just make the Gluint texture the amount of textures you need and just change the values of the other things. I hope this helps you out because I can understand not knowing how to do things. -Jarred Capellman
Gluint texture[1];
to
Gluint texture[2];
This makes the space for your second texture in the texture array.
In the LoadGLTextures function you change the following line:
AUX_RGBImageRec *TextureImage[1];
to
AUX_RGBImageRec *TextureImage[2];
Also in LoadGLTextures:
add the following right under the first texture things:
if (TextureImage[1]=LoadBMP("WhateverYouWant.bmp"))
{
Status=TRUE; // Set The Status To TRUE
glGenTextures(1, &texture[1]);
glBindTexture(GL_TEXTURE_2D, texture[1]);
glTexParameter(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameter(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,GL_MODULATE);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[1]->sizeX, TextureImage[1]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[1]->data);
}
if (TextureImage[1])
{
if (TextureImage[1]->data)
{
free(TextureImage[1]->data);
}
free(TextureImage[1]);
}
Then in the your draw3dscene right before you start your cube vectorf stuff do this:
glBindTexture(GL_TEXTURE_2D, texture[1]);
If you want more textures just make the Gluint texture the amount of textures you need and just change the values of the other things. I hope this helps you out because I can understand not knowing how to do things. -Jarred Capellman
I want to apologize, if I seemed a bit caustic, I don''t want to offend anyone. Thanks for the code. I looked through mine the other night, and had made some REALLY stupid mistakes.
borzwazie>Thanks anyway, but I found the problem when I compared my code to the code that DarkHacker posted to mine. I was doing some incredibly, dumb stuff. Oh, well.
Thanks again everyone. The Kid.
I don''t know what the future holds, but I know who holds the future.
borzwazie>Thanks anyway, but I found the problem when I compared my code to the code that DarkHacker posted to mine. I was doing some incredibly, dumb stuff. Oh, well.
Thanks again everyone. The Kid.
I don''t know what the future holds, but I know who holds the future.
I don''t know what the future holds, but I know who holds the future.
Take a look at NeHe''s Lesson 20 in the LoadGLTextures() function.
It loads 5 textures. This should help you out.
Zack
It loads 5 textures. This should help you out.
Zack
A moment enjoyed is not wasted. -Gamers.com
actually Darkhacker, why wouldn''t you want to just use the glGenTextures() function with the parameter of creating 2 texture instead of one? oh well, whatever works for you.
JoeMont001@aol.com www.polarisoft.n3.net
JoeMont001@aol.com www.polarisoft.n3.net
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement