Archived

This topic is now archived and is closed to further replies.

Could someone help me out ?

This topic is 6355 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

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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites