Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17625

OpenGL texturing problem

$
0
0

I am trying to draw a quad with texturing. The texture should not be pure green (see vector<float> pixel_data).

My source is:

void draw_objects(void)
{
	glDisable(GL_LIGHTING);

	float projection_modelview_mat[16];

	init_perspective_camera(45.0f,
		float(win_x) / float(win_y),
		0.01f, 10000.0f,
		0, 0, 10, // Camera position.
		0, 0, 0, // Look at position.
		0, 1, 0, // Up direction vector.
		projection_modelview_mat);

	glActiveTexture(GL_TEXTURE0);
	glGenTextures(1, &card_tex);
	glBindTexture(GL_TEXTURE_2D, card_tex);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

	vector<float> pixel_data;
	pixel_data.push_back(0);
	pixel_data.push_back(1);
	pixel_data.push_back(0);

	pixel_data.push_back(1);
	pixel_data.push_back(1);
	pixel_data.push_back(0);
	
	pixel_data.push_back(0);
	pixel_data.push_back …

Viewing all articles
Browse latest Browse all 17625

Trending Articles