Click here to Skip to main content
16,004,974 members
Home / Discussions / Graphics
   

Graphics

 
AnswerRe: Open CAD drawing *.DWG without AutoCAD Pin
Drew Stainton17-Jul-07 19:47
Drew Stainton17-Jul-07 19:47 
QuestionCopy screen & render with OpenGL Pin
XTAL2566-Jul-07 3:05
XTAL2566-Jul-07 3:05 
AnswerAAAAAARGH!!! :( Pin
XTAL2569-Jul-07 2:21
XTAL2569-Jul-07 2:21 
GeneralRe: AAAAAARGH!!! :( Pin
Luc Pattyn9-Jul-07 4:05
sitebuilderLuc Pattyn9-Jul-07 4:05 
GeneralRe: AAAAAARGH!!! :( Pin
Christian Graus10-Jul-07 7:51
protectorChristian Graus10-Jul-07 7:51 
QuestionHow to change Hue of image??? Pin
SandipG 6-Jul-07 1:58
SandipG 6-Jul-07 1:58 
QuestionHighlighting a part of an Image Pin
Kavita Verma6-Jul-07 1:26
Kavita Verma6-Jul-07 1:26 
QuestionUnable to properly load PPM texture data Pin
Cyrilix3-Jul-07 15:39
Cyrilix3-Jul-07 15:39 
I'm trying to turn my PPM (lossless image file) into a texture, but the texture is not showing up correctly. I've tried loading a bitmap image as a texture using glaux and a call to auxDIBImageLoad(), however, I would simply like to implement my own parser for PPM. Basically, in PPM, the line after the getting the value for "int maxValue" is a long line of binary data that stores the 8-bit RGB (total 24 bits) going from left to right, top to bottom in the image. If we think about this in a 2D coordinate system, parsing the file would first get you (x, y) = (0, 0), then (1, 0), then (2, 0), until the end of the width, then (0, 1), and etc.

Knowing this, does anyone know why my texture is being parsed incorrectly?

ifstream texFile("brickbump.ppm");
if (texFile.is_open())
{
	//Load texture properties
	char propBuf[8];
	texFile.getline(propBuf, 8);
	string format = propBuf;
	texFile.getline(propBuf, 8);
	int x = atoi(propBuf);
	texFile.getline(propBuf, 8);
	int y = atoi(propBuf);
	texFile.getline(propBuf, 8);
	int maxValue = atoi(propBuf);

	//Load texture data
	char* texArray = new char[3 * x * y];
	int count = 0;
	while (!texFile.eof())
	{
		texFile.get(texArray[count]);
		count++;
	}

	//Generate textures
	glGenTextures(1, &m_textures[0]);
	glBindTexture(GL_TEXTURE_2D, m_textures[0]);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, x, y, 0, GL_RGB, GL_UNSIGNED_BYTE, texArray);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

	delete [] texArray;
}

QuestionImage appears blurred some times?? Pin
SandipG 28-Jun-07 20:36
SandipG 28-Jun-07 20:36 
AnswerRe: Image appears blurred some times?? Pin
Christian Graus29-Jun-07 15:05
protectorChristian Graus29-Jun-07 15:05 
GeneralRe: Image appears blurred some times?? Pin
SandipG 1-Jul-07 18:55
SandipG 1-Jul-07 18:55 
QuestionAbout the GPU Gems 2 Pin
Tal Rasha's Guardianship27-Jun-07 17:17
Tal Rasha's Guardianship27-Jun-07 17:17 
AnswerRe: About the GPU Gems 2 Pin
Dave Kreskowiak29-Jun-07 13:05
mveDave Kreskowiak29-Jun-07 13:05 
AnswerRe: About the GPU Gems 2 Pin
El Corazon1-Jul-07 18:20
El Corazon1-Jul-07 18:20 
QuestionResolution of GDI+ bitmap from resource Pin
bozalina27-Jun-07 10:28
bozalina27-Jun-07 10:28 
AnswerRe: Resolution of GDI+ bitmap from resource Pin
Mark Salsbery27-Jun-07 15:11
Mark Salsbery27-Jun-07 15:11 
GeneralRe: Resolution of GDI+ bitmap from resource Pin
bozalina28-Jun-07 10:45
bozalina28-Jun-07 10:45 
GeneralRe: Resolution of GDI+ bitmap from resource Pin
Mark Salsbery28-Jun-07 13:04
Mark Salsbery28-Jun-07 13:04 
GeneralRe: Resolution of GDI+ bitmap from resource Pin
bozalina29-Jun-07 6:42
bozalina29-Jun-07 6:42 
GeneralRe: Resolution of GDI+ bitmap from resource Pin
Mark Salsbery30-Jun-07 7:16
Mark Salsbery30-Jun-07 7:16 
QuestionWebcam Pin
genna9926-Jun-07 10:42
genna9926-Jun-07 10:42 
QuestionOpenGL, DirectX, WPF ?? Pin
BusyDeveloper21-Jun-07 21:55
BusyDeveloper21-Jun-07 21:55 
AnswerRe: OpenGL, DirectX, WPF ?? Pin
El Corazon26-Jun-07 5:47
El Corazon26-Jun-07 5:47 
QuestionZooming the line in OpenGL Pin
a_david12320-Jun-07 23:19
a_david12320-Jun-07 23:19 
QuestionHow to AddAlpha Values ?? Pin
SandipG 20-Jun-07 18:22
SandipG 20-Jun-07 18:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.