1 Simple Question and a request for advice !

Started by
1 comment, last by Bagpuss 21 years, 7 months ago
OK, I have what I hope is a really simple question, and a much more complex one. Please bear with me as I am an OGL newbie. I have implemented a simple OGL class (using MFC) to draw a triangle and a line to a screen. The triangle works fine, but I can''t get the line to appear. (I have been thru what I have of NeHe''s documents and I seem to be using the same structure of code as he does). I will paste the code at the bottom of this message. Also, (again using MFC) I want to implement a colour picker popup box, and have the colours selected displayed on my OGL context. Does anyone have any ideas / hints / advice on the best way to do (or not to do this) - I am open to ideas on the design of the popup too, as I don''t want a huge array of buttons, but I only want a subset of colours for the user (say 32) to pick from . thanks in advance for any help I recieve, Bp. (Code pasted below. Triangle works as expected, lines are no where to be seen)
  
int CMapCreationEngine::DrawGLScene()
{
	
	//Setup Drawing Area Back Colour

	glClearColor(m_BackColour.fRed, m_BackColour.fGreen, m_BackColour.fBlue, m_BackColour.fAlpha);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// Draw the Grid if Required


	glTranslatef(2.5f, -1.5f, -6.0f);
	
	glBegin(GL_TRIANGLES);
		glColor3f(1.0f, 0.0f, 1.0f);
		glVertex3f(0.0f, 1.0f, 0.0f);
		glColor3f(1.0f, 0.0f, 0.0f);
		glVertex3f(-1.0f, -1.0f, 0.0f);
		glColor3f(1.0f, 1.0f, 1.0f);
		glVertex3f(1.0f, -1.0f, 0.0f);
	glEnd();

	glTranslatef(-2.5f, 1.5f, 6.0f);

	glBegin(GL_LINES);
		glColor3f(1.0f, 1.0f, 1.0f);
		glVertex2d(5, 5);
		glVertex2d(-5,-5);
	glEnd();

    SwapBuffers(wglGetCurrentDC());

	return TRUE;
}
  
Advertisement
The line is in 0,0,0 ?
I think your near plane is on 0.1 so you can''t see the line.


Thanks, I thought that the question was probably simple to answer.

Anyone know or got advice on converting windows colour codes to OGL RGBA format ?

If my application is set to 24 bit colour is this 6 Bits * 4 channels (RGBA), or 8 bits * 3 channels + a seperate Alpha channel ?

TIA,

Bp.

This topic is closed to new replies.

Advertisement