Advertisement

nooby programmer posting results

Started by January 09, 2004 07:52 AM
19 comments, last by TykeiL 21 years, 1 month ago
ive been doing programming for 3 months and this is the result so far, its really messy and full of shit and stuff but im sure you understand, i kinda just want to see if its worth a few crits and stuff, wanting to get involved with the community since you have been a great help to me, nehe''s tut''s started me on the opengl way. binary with extra''s http://apache.airnet.com.au/~praisegd/miscelanious/glwindowloader_bin.zip source( really messy code and i mean really messy) http://apache.airnet.com.au/~praisegd/miscelanious/glwindowloader_src.zip things i have begun learning int eh last 3 months, c++, OpenGL API, windows API, maxscript. and theres so much more to learn cheers !!My bRaiN is FiLLEd With HappY Juice!!
!!My bRaiN is FiLLEd With HappY Juice!!
For someone who just started programming it look pretty good actually, only the lights act a little wierd.
Ow, and involved in the community? You are participating the forums, so you are .
Advertisement
Its quite impressive after 3 months of programming experience (or did you do any porgramming before this?)
First the bug report
-when i try to launch a window second time, it exits immediately
-in "elven" mode the window borders and header are visible
But its really nice! (my window has far more bugs)

How many triangles/vertices this elven thing is built of? That 60-70 fps in seems to be poor
And a ting about lighting: you should set up lighting in each frame according to your light position (after loading camera matrix you should call glLightfv to give the correct coordinates);

You said you are learning maxscript. So i guess you made this model in 3dsmax and exported it. If this is so, PLEASE PLEASE help me! Im hunting for somebody who does this job for me! (in exchange i help you improve your prog... i do it anyways if you want to)
"Knowledge is no more expensive than ignorance, and at least as satisfying." -Barrin
orbano, about the window that exits immediately:
Click on destroy window, else the window won''t be destroyed .
Being the nice guy I am I fixed your lighting problem for you. Just add something like:

float NewLightPosition[4] = {LightPosition[1] - CameraPosX,
LightPosition[2] - CameraPosY,
LightPosition[3] - CameraPosZ,
LightPosition[4]};
glLightfv(GL_LIGHT1, GL_POSITION,LightPosition);

right after gluLookAt() in DrawGLScene();
You have gluLookAt going well but that function only modifies all the points drawn. The light is left alone, so you have to re-declare its position where it's supposed to be. Don't worry about missing that one - the only reason I knew what to look for is a week ago I wasted several hours debugging my entry to Creative. Stuff like that you don't forget!

Great program! Especially for a "newbie"! In fact - getting someone to ask you for help as soon as they see your program is merit in itself!

[edited by - strider44 on January 9, 2004 10:16:59 AM]
The Love Of Trees
Plus a fix for having the bar on the top during Fullscreen mode. All you do is change the forth value of *MainWindow = CreateWindowEx() in the SamCreateWindow() function from WS_SYSMENU to WS_POPUP when full screen. Just create a variable that is WS_SYSMENU when windowed and WS_POPUP when fullscreen and put it in instead of WS_SYSMENU.

in Lesson 1:
if (fullscreen)								// Are We Still In Fullscreen Mode?{   dwExStyle=WS_EX_APPWINDOW;// Window Extended Style   dwStyle=WS_POPUP;	  // Windows Style   ShowCursor(FALSE);	  // Hide Mouse Pointer}else{   dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;  // Window Extended Style   dwStyle=WS_OVERLAPPEDWINDOW;		// Windows Style}


and in CreateWindoeEx():
hWnd=CreateWindowEx(dwExStyle,	// Extended Style For The Window"OpenGL",				// Class Nametitle,					// Window TitleWS_CLIPSIBLINGS |			// Required Window StyleWS_CLIPCHILDREN |			// Required Window StyledwStyle,				// Selected Window Style0, 0,					// Window PositionWindowRect.right-WindowRect.left,	// Calculate Adjusted Window WidthWindowRect.bottom-WindowRect.top,	// Calculate Adjusted Window HeightNULL,					// No Parent WindowNULL,					// No MenuhInstance,				// InstanceNULL)



@Tree Penguin: Doesn''t make a difference - try it! You can''t open a window twice. Thought about searching for that problem but I''m tired and I''m going to bed.
The Love Of Trees
Advertisement
Tree Penguin: cheers mate :O) and yeah those lights are strange. and the second window cant be made again, theres something screwed in my code( a friend once told me, if you are going to spend more time debugging than it took you to write the code in the first place, start again).

orbano: thanks , i havent done any programming before 3 months ago, unless you count a bit of basic on the c64 when i was like 8 or 9 and i didnt go anywhere with that :O), about the maxscript thing, currently it exports the vertexnormals then the vertex tex coords then the vertex position, i think there may be a few more things i have to worry about but i will figure them out later, i want it to export light positions aswell, and camera start position, im still new to all of this so its kind of in the air atm, plus my file handling skill is very basic, i will need to learn more about file parsing to get really good results, and the polycount for the elvenarrowtip is 7100 or so, the poor framerate is due to my lack of knowledge about how to use GL, after i learn vertex arrays and model my models to use trianglestrips and quad strips it will surely step up the framerate

strider44: cheers and thanks heaps for the lighting and the window style help, that border in fullscreen was getting on mynervs :O) and im not sure but i think my file exporter and parser doesnt deal with the vertex normals properly, mabe i need to use face normals and not deal with the vertex's so individually cause that might fix the lighting and thanks for being a nice guy

the maxscript for people who are interested, just load it up in max and select all the text and drag and drop it onto a toolbar :O)
http://apache.airnet.com.au/~praisegd/miscelanious/xportmesh3.ms

!!My bRaiN is FiLLEd With HappY Juice!!

[edited by - TyKeiL on January 9, 2004 6:07:02 PM]
!!My bRaiN is FiLLEd With HappY Juice!!
he he, you're welcome. On rereading my post damn I sounded arrogant

Anyway, the lighting seems great if you add the two lines that I did. Here, I'll give you the whole modified DrawGLScene() func so you know exactly where to put them:

int DrawGLScene(){	glLoadIdentity();	gluPerspective(CameraPerspective, (GLfloat) Width/ (GLfloat) Height, 0.1f, 100.0f);	glLoadIdentity();	PointX =(float) sin(ChangerY)+CameraPosX;	PointY =(float) tan(ChangerX)+CameraPosY;	PointZ =(float) cos(ChangerY)+CameraPosZ;	VectorX = (PointX - CameraPosX)/10;	VectorY = (PointY - CameraPosY)/10;	VectorZ = (PointZ - CameraPosZ)/10;		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	glLoadIdentity();	gluLookAt(CameraPosX,CameraPosY,CameraPosZ,		PointX,PointY,PointZ,			  			0.0f,  1.0f,  0.0f);/////////////////////////NEW////////////////////////////////	float NewLightPosition[4] = {LightPosition[1] - CameraPosX,								 LightPosition[2] - CameraPosY,								 LightPosition[3] - CameraPosZ,								 LightPosition[4]};	glLightfv(GL_LIGHT1, GL_POSITION,LightPosition);////////////////////////END NEW////////////////////////////	Draw_Grid();		glBegin(GL_TRIANGLES);	for(int a=0; a < numfaces; a++)	{		for(int b=0; b < 3; b++)		{			glNormal3f(Tgeometry[a][b][0],Tgeometry[a][b][2],Tgeometry[a][b][1]);			glTexCoord3f(Tgeometry[a][b][0],Tgeometry[a][b][2],Tgeometry[a][b][1]);			glVertex3f(geometry[a][b][0],geometry[a][b][2],geometry[a][b][1]);		}	}	glEnd();	return TRUE;}


The lighting is great then!

Here's two pics, from above and below:



+ a little extra info: if the normals aren't done properly the actual lighting shouldn't change when you move the camera - the model's polygons just look strange. Since the polygons are the wrong shade they are clearly visible, and you can easily pick them out. Your ones look fine, even without the change in lighting.

[edited by - strider44 on January 9, 2004 10:41:10 PM]
The Love Of Trees
well i knew there was something wrong, it seems that in the drawscene thing i had the normals referancing the texture coordinate data :O) silly me,

!!My bRaiN is FiLLEd With HappY Juice!!
Ah you''re right aren''t you? It looks great anyways with the texture data going through
How come I don''t see a texture on there though? Haven''t you added it in yet?
The Love Of Trees

This topic is closed to new replies.

Advertisement