Jump to content

  • Log In with Google      Sign In   
  • Create Account

rohde

Member Since 29 May 2002
Offline Last Active May 15 2014 05:23 AM

Topics I've Started

Advice on game models

28 January 2009 - 01:14 AM

Hi there. I'm learning myself Cocoa and Objective-C programming (just for the kicks of it), and I have decided to do a small project in order to retain what I've learned about the platform. And that project is to be a small and simple model loader/editor. Although I know (some) graphics and math programming, I haven't coded a model loader before. Therefore I am seeking advice on which model formats are suited for "model beginners" like me. So, which model format(s) is the simplest to start with?

Microsoft OLE DB Provider for SQL Server error

17 June 2006 - 12:51 AM

Whenever I try to use the search feature in the books section: Books @ GameDev.net, i get an error: Microsoft OLE DB Provider for SQL Server error '80040e14' Full-Text Search is not enabled for the current database. Use sp_fulltext_database to enable full-text search for the database. /columns/books/books.asp, line 177 Just so you know.

[MDX] Lost device [SOLVED]

04 June 2006 - 10:32 PM

I am under the impression that Managed DirectX handles the loss of the device during resizes. At least that seems to be the case, but when I shifted my transforms to 2d, I seem to loose the device during window resizes and my scene disappears. What can I do to prevent this? (it worked fine in 3D) SOLVED: I soleved it by doing my own resizing where I reset the render states. Don't know why I wasn't necessary in 3D..oh well. [Edited by - rohde on June 5, 2006 5:24:00 AM]

World Cup

01 June 2006 - 01:09 AM

So, the world cup is just around the corner. Are you just as excited as I am? [smile] Who's your favourite team? Since my own country failed to qualify (thanks to those damn Ukranians), I'm rooting for Sweden. Some of the Swedish players are very good. Linderoth, Zlatan, Allbäck and Elmander for example. Of course Brazil will probably win, but maybe Germany can do it now it's taking place in the motherland. Anyway, I'm rooting for Sweden (and Spain too). KOM SÅ SVERIGE...

Rendering problems

07 May 2006 - 12:42 AM

Hi y'all I have some old DX code I need to convert to OpenGL. Unfortunately I'm not well aqauinted with OpenGL so I'm reading up on it (Red book, OpenGL Super Bible, and Astle's Beginning OpenGL Game Programming (we must supports the Rhino right [smile])). Anyway, the following code should display a trianlge (it's adapted from Astle's book), but the triangle doesn't show. The window is setup proberly because I can change the background colour just fine. Maybe it has something to do with the transformations? Anyway this is the rendering code:
void opengl_render::render() {
	// Clear the screen and depth buffer
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();

	// Move back 5 units and rotate about all 3 axes
	glTranslatef(0.0, 0.0, -5.0f);
	glRotatef(angle_, 1.0f, 0.0f, 0.0f);
	glRotatef(angle_, 0.0f, 1.0f, 0.0f);
	glRotatef(angle_, 0.0f, 0.0f, 1.0f);

	// Lime greenish color
	glColor3f(0.7f, 1.0f, 0.3f);

	// Draw the triangle such that the rotation point is in the center
	glBegin(GL_TRIANGLES);
		glVertex3f(1.0f, -1.0f, 0.0f);
		glVertex3f(-1.0f, -1.0f, 0.0f);
		glVertex3f(0.0f, 1.0f, 0.0f);
	glEnd();	
}
And this sets up the perspective projection (called in response to any WM_SIZE messages):
void opengl_render::setup_projection(int width, int height) {
	// Avoid a divide by zero
	if(height = 0) {
		height = 1;
	}

	// Reset the viewport to new dimensions
	glViewport(0, 0, width, height);
	// Set projection matrix current matrix
	glMatrixMode(GL_PROJECTION);
	// Reset projection matrix
	glLoadIdentity();
	// Calculate aspect ratio of window
	gluPerspective(52.0f, (GLfloat)width/(GLfloat) height, 1.0f, 1000.0f);

	// Set modelview matrix
	glMatrixMode(GL_MODELVIEW);
	// Reset modelview matrix
	glLoadIdentity();

	window_width_	= width;
	window_height_	= height;
}
So, what did I do wrong? I only see a black window (or whatever color I use for the glClearColor (this call is in another method not shown above)).

PARTNERS