PDA

View Full Version : help on the nutty cubemap tutorial!!!



gunslinger
12-17-2003, 06:01 AM
i have a strange and at my eyes inexplicable trouble with opengl:
I am worlking on the nutty cubemap tutorial. I managed to construct correctly the skybox. Next to that i try to render the six projections of the skyobx, and print em on the cubemap stuff.
Now i am using these transformations:

float CubeMapRots[6][4] = { //4, cos it's angle, then XYZ component of that angle.
{ -90.0f, 0.0f, 1.0f, 0.0f },
{ 90.0f, 0.0f, 1.0f, 0.0f },

{ -90.0f, 1.0f, 0.0f, 0.0f },
{ 90.0f, 1.0f, 0.0f, 0.0f },

{ 180.0f, 1.0f, 0.0f, 0.0f },
{ 180.0f, 0.0f, 0.0f, 1.0f },
};

(just copied from nutty's page)

in this piece of code:

void DynamycCubeMap()
{
glViewport(0,0,128,128);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

gluPerspective(90,1.0,1,5000);

glMatrixMode(GL_MATRIX_MODE);

for (int keel=0;keel<6;keel++)
{
glClear(GL_DEPTH_BUFFER_BIT);

glLoadIdentity();


glRotatef(CubeMapRots[keel][0], CubeMapRots[keel][1], CubeMapRots[keel][2], CubeMapRots[keel][3]);

if(keel==0&#0124; &#0124;keel==1)
{
glRotatef(180,0,0,1);
}

RenderSkyBox();

glEnable(GL_TEXTURE_CUBE_MAP_EXT);
glBindTexture(GL_TEXTURE_CUBE_MAP_EXT, global.texID);

glTexParameterf(GL_TEXTURE_CUBE_MAP_EXT,GL_TEXTURE _WRAP_S,GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_CUBE_MAP_EXT,GL_TEXTURE _WRAP_T,GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_CUBE_MAP_EXT,GL_TEXTURE _MAG_FILTER,GL_LINEAR);
glTexParameterf(GL_TEXTURE_CUBE_MAP_EXT,GL_TEXTURE _MIN_FILTER,GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DE CAL);


glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X_EX T+keel,0,GL_RGB8,0,0,128,128,0);

glFinish();
glDisable(GL_TEXTURE_CUBE_MAP_EXT);

}}

Reshape(global_width,global_height);

}

looking at it , i see no problem in theory, but when i use it, it just renders on the cube map 6 times the first face of the skybox. This is impossible! Even if the xfoms aren't correct, the should at least change view when i rendere the scene on the back buffer. If i comment the glLoadIdentity, the image in the cubemap changes. It loads the six images (in a wrong way,c ause if i don't reser the MODELVIEW matrix i can't find the right rotation angles. Just why it can't work this way?????? Where am i doing The Wrong Thing?

kon
12-17-2003, 06:15 AM
It's glMatrixMode(GL_MODELVIEW);

gunslinger
12-17-2003, 06:22 AM
hehe yes... i saw it one second after posting this... i guess my morning coffee just exausted effect http://www.opengl.org/discussion_boards/ubb/smile.gif (aka: my worst problem is being myself)

Madoc
12-17-2003, 06:52 AM
what's the "glEnable(GL_TEXTURE_CUBE_MAP_EXT)"? Is this necessary for the cubemapping _extension_? Seems absolutely useless, surely the texture target is enough. I've only used cubemapping as ogl 1.3 and never had enable/disable involved and it works fine.

gunslinger
12-17-2003, 06:56 AM
well Madoc
I am not really a pro (as u may have figured out from my LAME messages).
Anyway i followed the instructions of nvidia gurus to get the whole thing running.
U may find the stuff i have used here: http://developer.nvidia.com/object/IO_20010830_4778.html
next steps for the gunslinger:
radiosity, realistic shadows and much more!

good night The Gunslinger

Madoc
12-17-2003, 07:10 AM
Nevermind, just being terribly stupid. I had "forgotten" about enabling texture modes (duh!). Looked weird written like that, I'm too used to my texture manager abstracting this stuff.

AdrianD
12-17-2003, 09:36 AM
Originally posted by gunslinger:
[...]next steps for the gunslinger:
radiosity, realistic shadows and much more!

good night The Gunslinger
imo, next steps for the gunslinger:
OpenGL programming, API basics.
(i suggest you to gain more exirience in opengl coding before you start with the advanced stuff)

cutting_crew
12-17-2003, 10:00 AM
hey ADrianD, i hear you worked for 3dfx or is this untrue?

AdrianD
12-17-2003, 10:53 AM
Originally posted by cutting_crew:
hey ADrianD, i hear you worked for 3dfx or is this untrue?

no, i didn't work for 3dfx, i worked with 3dfx.
i was employed by a company which created a voodo1-based accelerator, capable of displaying the output of an voodoo-1 system in a window with up to 1600x1200 window size.
mabye you still remember, voodoo1 was a pass-throu soultion, so you could choose: desktop or 3d-fullscreen, 640x480 or 800x600 but nothing else.
but anyway, i was the driver coder of this project, and i had to get my hands on the glide code to get this stuff running.
It took the manager months of NDA-signing but finaly we've got the full sources for glide. And because gilde was still under development, i also contributed some general bugfixes, besides of my modifications.
did i mention, it was for the mac ? i you wonder, why you can't rember such solution, that's probably the reason.

as i said, i am "a guy who contributed to glide".
i am not saying i am "the guy who has written glide".

gunslinger
12-17-2003, 10:31 PM
well adrian what can i tell you?
Actually i've been working with opengl for some time as a uni student (so i didn't have much help understanding the basics). Now i am working as a sort of developer, but yet no specific training at all, just requests from my boss, so i guess i am back again in the solo teaching of advanced stuff. Sorry to bother you, but i don't really know how to learn the advanced stuff other then asking some hint to those who know more than me.

Nutty
12-17-2003, 11:47 PM
You got it working?

gunslinger
12-17-2003, 11:55 PM
yes, thank you.
yesterday i finally managed to get it working. As for now it is just basic glut, with just one reflective sphere and the rotating skybox around.
i hope to get as good as you one day http://www.opengl.org/discussion_boards/ubb/smile.gif anyway i'll be better get again appling some theory studing...
bye and hear from you soon!
The Gunslinger

AdrianD
12-18-2003, 02:14 AM
Originally posted by gunslinger:
well adrian what can i tell you?
Actually i've been working with opengl for some time as a uni student (so i didn't have much help understanding the basics). Now i am working as a sort of developer, but yet no specific training at all, just requests from my boss, so i guess i am back again in the solo teaching of advanced stuff.

get used to it. this is how this buisness works. a professional developer needs to learn every day new stuff, without any help from others. btw. the most of the pro gamedevelopers ot there, didn't have any specific training for this job...


Sorry to bother you, but i don't really know how to learn the advanced stuff other then asking some hint to those who know more than me.

you didn't bother me !(nobody forces me to read and answer this posts... http://www.opengl.org/discussion_boards/ubb/wink.gif).
i have just seen that you have very much questions about very basic api issues, and i just suggested you to get rid of this problems, before you start coding really complex things. it was meant as seroius help. sorry, if it sounded different.
i mean with "expirience", that you not only learn how to code OpenGL, that also involves that you learn how to solve such problems. this is a very important skill. That's why i suggested it.
or to say it with RPG-terms:
you need to get "opengl coding +20" and "coding endurance+35" before you can use the "shadow-spell,level 10" together with the "holy-ring-of-radiosiy" to fight the evil global-illumination-dragon, level 50. http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/smile.gif

Madoc
12-18-2003, 02:27 AM
Originally posted by gunslinger:
Actually i've been working with opengl for some time as a uni student (so i didn't have much help understanding the basics). Now i am working as a sort of developer, but yet no specific training at all, just requests from my boss, so i guess i am back again in the solo teaching of advanced stuff. Sorry to bother you, but i don't really know how to learn the advanced stuff other then asking some hint to those who know more than me.

Ai, ai, ai! In Italia? E che vorresti fare? Videogiochi? O c'e' un prof che ti schiavizza per fare ricerche/prototipi? Oppure quella fase e' passata, e dopo una bella tesi, il prof a deciso di metterti al lavoro... Sarebbe buffo se ho azzeccato.

Anyway, I would suggest you do whatever motivates you, learn from your mistakes and pick up theory as you need it. I don't really see any other way to it without specific training. Your lack of theory might even bring you to innovative ideas which there's still plenty of space for.
I have to admit that basic API stuff is not really too much appreciated on this particular forum, but what to do, there's plenty of it anyway.

gunslinger
12-18-2003, 03:15 AM
what to say?
it is good to find so much nice ppl online. Since I am figuring out a career tightly connected with opengl, i hope that it will be nice "working" a bit with all you guys.
enven having at least some idea sharing now and then looks great.
To answer Madoc (sorry for non-italian folks):
Si sono italiano. Mi sn laureato a luglio con una tesi su un simulatorino (inoinoino) di volo, sempre in vista di una sfolgorante carriera nel ramo dei giochi. Dato che cmq come vedi per ora sn una schiappa, ho trovato un lavoro come programmatore Ogl per una piccola ditta che si occupa di visualizzazione, giusto per farmi le ossa nella maniera "sporca". Un gg magari metterņ su una squadra e mi lancerņ! In fondo noi italiani siamo un popolo di poeti santi e navigatori no? http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/smile.gif
Ok, sorry 4 the italian excursus, I'll got back to work... even if i am a bit stick with all the light algorithms stuff....
See u soon The Gunslinger