Sign in to follow this  
Shadowwoelf

OpenGL Textures missing?

Recommended Posts

I cannot seem to figure out why the textures won't display. So far all I get is a white quad. Here is the render function
int MENU_STATE::render(){
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);			// Clear The Screen And The Depth Buffer
	glLoadIdentity();											// Reset The Modelview Matrix
	glEnable(GL_TEXTURE_2D);
	glColor3ub(255,255,255);
	glBindTexture(GL_TEXTURE_2D, texture[1].texID);			// ( CHANGE )
	glBegin(GL_QUADS);							// Start Drawing Quad
		glTexCoord2f(roll+0.0f, 0.0f); glVertex2f(0,  0);	// Bottom left
		glTexCoord2f(roll+0.0f, 1.0f); glVertex2f(0, Height);	// Bottom Right
		glTexCoord2f(roll+1.0f, 1.0f); glVertex2f(Width, Height);	// Top right
		glTexCoord2f(roll+1.0f, 0.0f); glVertex2f(Width, 0);	// Top left
	glEnd();
	glBindTexture(GL_TEXTURE_2D, texture[0].texID);			// ( CHANGE )
	glBegin(GL_QUADS);							// Start Drawing Quads
		glTexCoord2f(0.0f, 1.0f); glVertex2f((Width/3),  (Height/3));	// Top left
		glTexCoord2f(0.0f, 0.0f); glVertex2f((Width/3), (Height*(.8f)) );	// Bottom left
		glTexCoord2f(1.0f, 0.0f); glVertex2f(((.6f)*Width), (Height*(.8f)) );	// Bottom right
		glTexCoord2f(1.0f, 1.0f); glVertex2f(((.6f)*Width), (Height/3));	// Top right
	glEnd();
	glLineWidth(2.3f);
	glDisable(GL_TEXTURE_2D);
	glBegin(GL_LINE_LOOP);
		glColor3ub(Ycolor,Ycolor,0);			// yellow
		glVertex2f((Width/2.55f),  (Height/1.68f)+yOffset);	// Top left
		glVertex2f((Width/2.55f), (Height*(.625f))+yOffset);	// Bottom left
		glVertex2f(((.535f)*Width), (Height*(.625f))+yOffset);	// Bottom right
		glVertex2f(((.535f)*Width), (Height/1.68f)+yOffset);	// Top right
	glEnd();
	return 0;
	};

And here is the function that loads the texture
MENU_STATE::MENU_STATE(){
	selector=0, max_selector=4;
	Ycolor = 255;
	Width=640, Height=480;
	roll=0;									// Rolling Texture
	colordown=true;
	yOffset=0;
	change=false;

	int Status=FALSE;											// Status Indicator

	// Load The Bitmap, Check For Errors.
	if (LoadTGA(&texture[0], "Data/Menu_Copy.tga") &&
		LoadTGA(&texture[1], "Data/cloud_bg copy.tga"))
	{
		Status=TRUE;
		for (int loop=0; loop<2; loop++)						// Loop Through Both Textures
		{
			// Typical Texture Generation Using Data From The TGA ( CHANGE )
			glGenTextures(1, &texture[loop].texID);				// Create The Texture ( CHANGE )
			glBindTexture(GL_TEXTURE_2D, texture[loop].texID);
			glTexImage2D(GL_TEXTURE_2D, 0, texture[loop].bpp / 8, texture[loop].width, texture[loop].height, 0, texture[loop].type, GL_UNSIGNED_BYTE, texture[loop].imageData);
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

			if (texture[loop].imageData)						// If Texture Image Exists ( CHANGE )
			{
				free(texture[loop].imageData);					// Free The Texture Image Memory ( CHANGE )
			}
		}
	}
}	

The thing is it should display it but I have no idea why it doesn't. It loads it into the memory as far as I can tell, but then draws a white screen. *on a side note* when functionA changes the state of opengl does functionB also get affected by the change? eg. functionA turns off blending and then functionA returns nothing is blending still turned off for functionB?

Share this post


Link to post
Share on other sites
I don't like the look of this:

glTexImage2D(GL_TEXTURE_2D, 0, texture[loop].bpp / 8, texture[loop].width, texture[loop].height, 0, texture[loop].type, GL_UNSIGNED_BYTE, texture[loop].imageData);





I'm not sure that the BPP / 8 will give a correct format parameter. Try sticking GL_RGB in there.

EDIT: Just a small thought, I seem to remember problems with calling glTexImage2D before setting the filter parameters. Try setting the filters before the glTexImage2D.

Share this post


Link to post
Share on other sites
Deadstar the code worked before and I pretty much ripped it to the same thing.

Here is the old code
Initialize function

int InitGL(GLvoid) // All Setup For OpenGL Goes Here
{
if (!LoadGLTextures()) // Jump To Texture Loading Routine
{
return FALSE; // If Texture Didn't Load Return FALSE
}
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Clear The Background Color To Black
glClearDepth(1.0); // Enables Clearing Of The Depth Buffer
glDepthFunc(GL_LEQUAL); // The Type Of Depth Test To Do
glShadeModel(GL_SMOOTH); // Enables Smooth Color Shading
glEnable(GL_TEXTURE_2D); // Enable 2D Texture Mapping
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Enable Alpha Blending (disable alpha testing)
glEnable(GL_BLEND); // Enable Blending (disable alpha testing)
return TRUE; // Initialization Went OK
}



heres the actual drawing

int RenderMenustate(DWORD ElapsedTime){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The Modelview Matrix
glColor3ub(255,255,255);
glBindTexture(GL_TEXTURE_2D, texture[1].texID); // ( CHANGE )
glBegin(GL_QUADS); // Start Drawing Quads

glTexCoord2f(roll+0.0f, 0.0f); glVertex2f(0, 0); // Bottom left
glTexCoord2f(roll+0.0f, 1.0f); glVertex2f(0, Height); // Bottom Right
glTexCoord2f(roll+1.0f, 1.0f); glVertex2f(Width, Height); // Top right
glTexCoord2f(roll+1.0f, 0.0f); glVertex2f(Width, 0); // Top left
glEnd();
glBindTexture(GL_TEXTURE_2D, texture[0].texID); // ( CHANGE )
glBegin(GL_QUADS); // Start Drawing Quads
glTexCoord2f(0.0f, 1.0f); glVertex2f((Width/3), (Height/3)); // Top left
glTexCoord2f(0.0f, 0.0f); glVertex2f((Width/3), (Height*(.8f)) ); // Bottom left
glTexCoord2f(1.0f, 0.0f); glVertex2f(((.6f)*Width), (Height*(.8f)) ); // Bottom right
glTexCoord2f(1.0f, 1.0f); glVertex2f(((.6f)*Width), (Height/3)); // Top right
glEnd();

glLineWidth(2.3f);
glDisable(GL_TEXTURE_2D);
glBegin(GL_LINE_LOOP);
glColor3ub(Ycolor,Ycolor,0); // yellow
glVertex2f((Width/2.55f), (Height/1.68f)+yOffset); // Top left
glVertex2f((Width/2.55f), (Height*(.625f))+yOffset); // Bottom left
glVertex2f(((.535f)*Width), (Height*(.625f))+yOffset); // Bottom right
glVertex2f(((.535f)*Width), (Height/1.68f)+yOffset); // Top right
glEnd();
glEnable(GL_TEXTURE_2D);

roll+=0.033f/(ElapsedTime); // Increase Our Texture Roll Variable

if(colordown==true){
Ycolor-=1; //takes one away from Ycolor to make it fade
}
if(colordown==false){
Ycolor+=1; //Adds one to Ycolor to brighten
}

if(Ycolor<=100){ //Makes sure that we don't go too low or too high with the color values
colordown=false;
}
if(Ycolor>=255){
colordown=true;
}

if (roll>1.0f) // Is Roll Greater Than One
{
roll-=1.0f; // Subtract 1 From Roll
}
return TRUE; // Keep Going
}



And here is my load function


int LoadGLTextures() // Load Bitmaps And Convert To Textures
{
int Status=FALSE; // Status Indicator

// Load The Bitmap, Check For Errors.
if (LoadTGA(&texture[0], "Data/Menu_Copy.tga") &&
LoadTGA(&texture[1], "Data/cloud_bg copy.tga"))
{
Status=TRUE; // Set The Status To TRUE

for (int loop=0; loop<2; loop++) // Loop Through Both Textures
{
// Typical Texture Generation Using Data From The TGA ( CHANGE )
glGenTextures(1, &texture[loop].texID); // Create The Texture ( CHANGE )
glBindTexture(GL_TEXTURE_2D, texture[loop].texID);
glTexImage2D(GL_TEXTURE_2D, 0, texture[loop].bpp / 8, texture[loop].width, texture[loop].height, 0, texture[loop].type, GL_UNSIGNED_BYTE, texture[loop].imageData);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

if (texture[loop].imageData) // If Texture Image Exists ( CHANGE )
{
free(texture[loop].imageData); // Free The Texture Image Memory ( CHANGE )
}
}
}
return Status; // Return The Status
}


Share this post


Link to post
Share on other sites
Here is what GLintercept said about my window.


GL Intercept Log. Version : 0.5 Compile Date: Dec 3 2005 Run on: Tue Jul 29 02:24:07 2008

===================================================
Function glGenTextures is being called before context creation
Call to glGenTextures made outside of context/init
Function glBindTexture is being called before context creation
Call to glBindTexture made outside of context/init
Function glTexImage2D is being called before context creation
Call to glTexImage2D made outside of context/init
Function glTexParameteri is being called before context creation
Call to glTexParameteri made outside of context/init
Function glTexParameteri is being called before context creation
Call to glTexParameteri made outside of context/init
Function glGenTextures is being called before context creation
Call to glGenTextures made outside of context/init
Function glBindTexture is being called before context creation
Call to glBindTexture made outside of context/init
Function glTexImage2D is being called before context creation
Call to glTexImage2D made outside of context/init
Function glTexParameteri is being called before context creation
Call to glTexParameteri made outside of context/init
Function glTexParameteri is being called before context creation
Call to glTexParameteri made outside of context/init
Function glClearColor is being called before context creation
Call to glClearColor made outside of context/init
Function glClearDepth is being called before context creation
Call to glClearDepth made outside of context/init
Function glDepthFunc is being called before context creation
Call to glDepthFunc made outside of context/init
Function glShadeModel is being called before context creation
Call to glShadeModel made outside of context/init
Function glEnable is being called before context creation
Call to glEnable made outside of context/init
Function glBlendFunc is being called before context creation
Call to glBlendFunc made outside of context/init
Function glEnable is being called before context creation
Call to glEnable made outside of context/init
Function glGenTextures is being called before context creation
Call to glGenTextures made outside of context/init
Function glBindTexture is being called before context creation
Call to glBindTexture made outside of context/init
Function glTexImage2D is being called before context creation
Call to glTexImage2D made outside of context/init
Function glTexParameteri is being called before context creation
Call to glTexParameteri made outside of context/init
Function glTexParameteri is being called before context creation
Call to glTexParameteri made outside of context/init
Function glGenTextures is being called before context creation
Call to glGenTextures made outside of context/init
Function glBindTexture is being called before context creation
Call to glBindTexture made outside of context/init
Function glTexImage2D is being called before context creation
Call to glTexImage2D made outside of context/init
Function glTexParameteri is being called before context creation
Call to glTexParameteri made outside of context/init
Function glTexParameteri is being called before context creation
Call to glTexParameteri made outside of context/init
Function glClearColor is being called before context creation
Call to glClearColor made outside of context/init
Function glClearDepth is being called before context creation
Call to glClearDepth made outside of context/init
Function glDepthFunc is being called before context creation
Call to glDepthFunc made outside of context/init
Function glShadeModel is being called before context creation
Call to glShadeModel made outside of context/init
Function glEnable is being called before context creation
Call to glEnable made outside of context/init
Function glBlendFunc is being called before context creation
Call to glBlendFunc made outside of context/init
Function glEnable is being called before context creation
Call to glEnable made outside of context/init
ConfigParser::Parse - Unable to open file D:\Projects\Lesson33\Release\gliConfig.ini
ConfigData::ReadConfigData - Unable to read config data file - D:\Projects\Lesson33\Release\gliConfig.ini
FunctionParser::Parse - Unable to open file gliIncludes.h
Diagnostic: Unknown function glBegin being logged.
Diagnostic: Unknown function glEnd being logged.
Diagnostic: Unknown function glNewList being logged.
Diagnostic: Unknown function glEndList being logged.
Diagnostic: Unknown function glGetError being logged.
Diagnostic: Unknown function glClearIndex being logged.
Diagnostic: Unknown function glClearColor being logged.
Diagnostic: Unknown function glClear being logged.
Diagnostic: Unknown function glIndexMask being logged.
Diagnostic: Unknown function glColorMask being logged.
Diagnostic: Unknown function glAlphaFunc being logged.
Diagnostic: Unknown function glBlendFunc being logged.
Diagnostic: Unknown function glLogicOp being logged.
Diagnostic: Unknown function glCullFace being logged.
Diagnostic: Unknown function glFrontFace being logged.
Diagnostic: Unknown function glPointSize being logged.
Diagnostic: Unknown function glLineWidth being logged.
Diagnostic: Unknown function glLineStipple being logged.
Diagnostic: Unknown function glPolygonMode being logged.
Diagnostic: Unknown function glPolygonOffset being logged.
Diagnostic: Unknown function glPolygonStipple being logged.
Diagnostic: Unknown function glGetPolygonStipple being logged.
Diagnostic: Unknown function glEdgeFlag being logged.
Diagnostic: Unknown function glEdgeFlagv being logged.
Diagnostic: Unknown function glScissor being logged.
Diagnostic: Unknown function glClipPlane being logged.
Diagnostic: Unknown function glGetClipPlane being logged.
Diagnostic: Unknown function glDrawBuffer being logged.
Diagnostic: Unknown function glReadBuffer being logged.
Diagnostic: Unknown function glEnable being logged.
Diagnostic: Unknown function glDisable being logged.
Diagnostic: Unknown function glIsEnabled being logged.
Diagnostic: Unknown function glEnableClientState being logged.
Diagnostic: Unknown function glDisableClientState being logged.
Diagnostic: Unknown function glGetBooleanv being logged.
Diagnostic: Unknown function glGetDoublev being logged.
Diagnostic: Unknown function glGetFloatv being logged.
Diagnostic: Unknown function glGetIntegerv being logged.
Diagnostic: Unknown function glPushAttrib being logged.
Diagnostic: Unknown function glPopAttrib being logged.
Diagnostic: Unknown function glPushClientAttrib being logged.
Diagnostic: Unknown function glPopClientAttrib being logged.
Diagnostic: Unknown function glRenderMode being logged.
Diagnostic: Unknown function glGetString being logged.
Diagnostic: Unknown function glFinish being logged.
Diagnostic: Unknown function glFlush being logged.
Diagnostic: Unknown function glHint being logged.
Diagnostic: Unknown function glClearDepth being logged.
Diagnostic: Unknown function glDepthFunc being logged.
Diagnostic: Unknown function glDepthMask being logged.
Diagnostic: Unknown function glDepthRange being logged.
Diagnostic: Unknown function glClearAccum being logged.
Diagnostic: Unknown function glAccum being logged.
Diagnostic: Unknown function glMatrixMode being logged.
Diagnostic: Unknown function glOrtho being logged.
Diagnostic: Unknown function glFrustum being logged.
Diagnostic: Unknown function glViewport being logged.
Diagnostic: Unknown function glPushMatrix being logged.
Diagnostic: Unknown function glPopMatrix being logged.
Diagnostic: Unknown function glLoadIdentity being logged.
Diagnostic: Unknown function glLoadMatrixd being logged.
Diagnostic: Unknown function glLoadMatrixf being logged.
Diagnostic: Unknown function glMultMatrixd being logged.
Diagnostic: Unknown function glMultMatrixf being logged.
Diagnostic: Unknown function glRotated being logged.
Diagnostic: Unknown function glRotatef being logged.
Diagnostic: Unknown function glScaled being logged.
Diagnostic: Unknown function glScalef being logged.
Diagnostic: Unknown function glTranslated being logged.
Diagnostic: Unknown function glTranslatef being logged.
Diagnostic: Unknown function glIsList being logged.
Diagnostic: Unknown function glDeleteLists being logged.
Diagnostic: Unknown function glGenLists being logged.
Diagnostic: Unknown function glCallList being logged.
Diagnostic: Unknown function glCallLists being logged.
Diagnostic: Unknown function glListBase being logged.
Diagnostic: Unknown function glVertex2d being logged.
Diagnostic: Unknown function glVertex2f being logged.
Diagnostic: Unknown function glVertex2i being logged.
Diagnostic: Unknown function glVertex2s being logged.
Diagnostic: Unknown function glVertex3d being logged.
Diagnostic: Unknown function glVertex3f being logged.
Diagnostic: Unknown function glVertex3i being logged.
Diagnostic: Unknown function glVertex3s being logged.
Diagnostic: Unknown function glVertex4d being logged.
Diagnostic: Unknown function glVertex4f being logged.
Diagnostic: Unknown function glVertex4i being logged.
Diagnostic: Unknown function glVertex4s being logged.
Diagnostic: Unknown function glVertex2dv being logged.
Diagnostic: Unknown function glVertex2fv being logged.
Diagnostic: Unknown function glVertex2iv being logged.
Diagnostic: Unknown function glVertex2sv being logged.
Diagnostic: Unknown function glVertex3dv being logged.
Diagnostic: Unknown function glVertex3fv being logged.
Diagnostic: Unknown function glVertex3iv being logged.
Diagnostic: Unknown function glVertex3sv being logged.
Diagnostic: Unknown function glVertex4dv being logged.
Diagnostic: Unknown function glVertex4fv being logged.
Diagnostic: Unknown function glVertex4iv being logged.
Diagnostic: Unknown function glVertex4sv being logged.
Diagnostic: Unknown function glNormal3b being logged.
Diagnostic: Unknown function glNormal3d being logged.
Diagnostic: Unknown function glNormal3f being logged.
Diagnostic: Unknown function glNormal3i being logged.
Diagnostic: Unknown function glNormal3s being logged.
Diagnostic: Unknown function glNormal3bv being logged.
Diagnostic: Unknown function glNormal3dv being logged.
Diagnostic: Unknown function glNormal3fv being logged.
Diagnostic: Unknown function glNormal3iv being logged.
Diagnostic: Unknown function glNormal3sv being logged.
Diagnostic: Unknown function glIndexd being logged.
Diagnostic: Unknown function glIndexf being logged.
Diagnostic: Unknown function glIndexi being logged.
Diagnostic: Unknown function glIndexs being logged.
Diagnostic: Unknown function glIndexub being logged.
Diagnostic: Unknown function glIndexdv being logged.
Diagnostic: Unknown function glIndexfv being logged.
Diagnostic: Unknown function glIndexiv being logged.
Diagnostic: Unknown function glIndexsv being logged.
Diagnostic: Unknown function glIndexubv being logged.
Diagnostic: Unknown function glColor3b being logged.
Diagnostic: Unknown function glColor3d being logged.
Diagnostic: Unknown function glColor3f being logged.
Diagnostic: Unknown function glColor3i being logged.
Diagnostic: Unknown function glColor3s being logged.
Diagnostic: Unknown function glColor3ub being logged.
Diagnostic: Unknown function glColor3ui being logged.
Diagnostic: Unknown function glColor3us being logged.
Diagnostic: Unknown function glColor4b being logged.
Diagnostic: Unknown function glColor4d being logged.
Diagnostic: Unknown function glColor4f being logged.
Diagnostic: Unknown function glColor4i being logged.
Diagnostic: Unknown function glColor4s being logged.
Diagnostic: Unknown function glColor4ub being logged.
Diagnostic: Unknown function glColor4ui being logged.
Diagnostic: Unknown function glColor4us being logged.
Diagnostic: Unknown function glColor3bv being logged.
Diagnostic: Unknown function glColor3dv being logged.
Diagnostic: Unknown function glColor3fv being logged.
Diagnostic: Unknown function glColor3iv being logged.
Diagnostic: Unknown function glColor3sv being logged.
Diagnostic: Unknown function glColor3ubv being logged.
Diagnostic: Unknown function glColor3uiv being logged.
Diagnostic: Unknown function glColor3usv being logged.
Diagnostic: Unknown function glColor4bv being logged.
Diagnostic: Unknown function glColor4dv being logged.
Diagnostic: Unknown function glColor4fv being logged.
Diagnostic: Unknown function glColor4iv being logged.
Diagnostic: Unknown function glColor4sv being logged.
Diagnostic: Unknown function glColor4ubv being logged.
Diagnostic: Unknown function glColor4uiv being logged.
Diagnostic: Unknown function glColor4usv being logged.
Diagnostic: Unknown function glTexCoord1d being logged.
Diagnostic: Unknown function glTexCoord1f being logged.
Diagnostic: Unknown function glTexCoord1i being logged.
Diagnostic: Unknown function glTexCoord1s being logged.
Diagnostic: Unknown function glTexCoord2d being logged.
Diagnostic: Unknown function glTexCoord2f being logged.
Diagnostic: Unknown function glTexCoord2i being logged.
Diagnostic: Unknown function glTexCoord2s being logged.
Diagnostic: Unknown function glTexCoord3d being logged.
Diagnostic: Unknown function glTexCoord3f being logged.
Diagnostic: Unknown function glTexCoord3i being logged.
Diagnostic: Unknown function glTexCoord3s being logged.
Diagnostic: Unknown function glTexCoord4d being logged.
Diagnostic: Unknown function glTexCoord4f being logged.
Diagnostic: Unknown function glTexCoord4i being logged.
Diagnostic: Unknown function glTexCoord4s being logged.
Diagnostic: Unknown function glTexCoord1dv being logged.
Diagnostic: Unknown function glTexCoord1fv being logged.
Diagnostic: Unknown function glTexCoord1iv being logged.
Diagnostic: Unknown function glTexCoord1sv being logged.
Diagnostic: Unknown function glTexCoord2dv being logged.
Diagnostic: Unknown function glTexCoord2fv being logged.
Diagnostic: Unknown function glTexCoord2iv being logged.
Diagnostic: Unknown function glTexCoord2sv being logged.
Diagnostic: Unknown function glTexCoord3dv being logged.
Diagnostic: Unknown function glTexCoord3fv being logged.
Diagnostic: Unknown function glTexCoord3iv being logged.
Diagnostic: Unknown function glTexCoord3sv being logged.
Diagnostic: Unknown function glTexCoord4dv being logged.
Diagnostic: Unknown function glTexCoord4fv being logged.
Diagnostic: Unknown function glTexCoord4iv being logged.
Diagnostic: Unknown function glTexCoord4sv being logged.
Diagnostic: Unknown function glRasterPos2d being logged.
Diagnostic: Unknown function glRasterPos2f being logged.
Diagnostic: Unknown function glRasterPos2i being logged.
Diagnostic: Unknown function glRasterPos2s being logged.
Diagnostic: Unknown function glRasterPos3d being logged.
Diagnostic: Unknown function glRasterPos3f being logged.
Diagnostic: Unknown function glRasterPos3i being logged.
Diagnostic: Unknown function glRasterPos3s being logged.
Diagnostic: Unknown function glRasterPos4d being logged.
Diagnostic: Unknown function glRasterPos4f being logged.
Diagnostic: Unknown function glRasterPos4i being logged.
Diagnostic: Unknown function glRasterPos4s being logged.
Diagnostic: Unknown function glRasterPos2dv being logged.
Diagnostic: Unknown function glRasterPos2fv being logged.
Diagnostic: Unknown function glRasterPos2iv being logged.
Diagnostic: Unknown function glRasterPos2sv being logged.
Diagnostic: Unknown function glRasterPos3dv being logged.
Diagnostic: Unknown function glRasterPos3fv being logged.
Diagnostic: Unknown function glRasterPos3iv being logged.
Diagnostic: Unknown function glRasterPos3sv being logged.
Diagnostic: Unknown function glRasterPos4dv being logged.
Diagnostic: Unknown function glRasterPos4fv being logged.
Diagnostic: Unknown function glRasterPos4iv being logged.
Diagnostic: Unknown function glRasterPos4sv being logged.
Diagnostic: Unknown function glRectd being logged.
Diagnostic: Unknown function glRectf being logged.
Diagnostic: Unknown function glRecti being logged.
Diagnostic: Unknown function glRects being logged.
Diagnostic: Unknown function glRectdv being logged.
Diagnostic: Unknown function glRectfv being logged.
Diagnostic: Unknown function glRectiv being logged.
Diagnostic: Unknown function glRectsv being logged.
Diagnostic: Unknown function glVertexPointer being logged.
Diagnostic: Unknown function glNormalPointer being logged.
Diagnostic: Unknown function glColorPointer being logged.
Diagnostic: Unknown function glIndexPointer being logged.
Diagnostic: Unknown function glTexCoordPointer being logged.
Diagnostic: Unknown function glEdgeFlagPointer being logged.
Diagnostic: Unknown function glGetPointerv being logged.
Diagnostic: Unknown function glArrayElement being logged.
Diagnostic: Unknown function glDrawArrays being logged.
Diagnostic: Unknown function glDrawElements being logged.
Diagnostic: Unknown function glInterleavedArrays being logged.
Diagnostic: Unknown function glShadeModel being logged.
Diagnostic: Unknown function glLightf being logged.
Diagnostic: Unknown function glLighti being logged.
Diagnostic: Unknown function glLightfv being logged.
Diagnostic: Unknown function glLightiv being logged.
Diagnostic: Unknown function glGetLightfv being logged.
Diagnostic: Unknown function glGetLightiv being logged.
Diagnostic: Unknown function glLightModelf being logged.
Diagnostic: Unknown function glLightModeli being logged.
Diagnostic: Unknown function glLightModelfv being logged.
Diagnostic: Unknown function glLightModeliv being logged.
Diagnostic: Unknown function glMaterialf being logged.
Diagnostic: Unknown function glMateriali being logged.
Diagnostic: Unknown function glMaterialfv being logged.
Diagnostic: Unknown function glMaterialiv being logged.
Diagnostic: Unknown function glGetMaterialfv being logged.
Diagnostic: Unknown function glGetMaterialiv being logged.
Diagnostic: Unknown function glColorMaterial being logged.
Diagnostic: Unknown function glPixelZoom being logged.
Diagnostic: Unknown function glPixelStoref being logged.
Diagnostic: Unknown function glPixelStorei being logged.
Diagnostic: Unknown function glPixelTransferf being logged.
Diagnostic: Unknown function glPixelTransferi being logged.
Diagnostic: Unknown function glPixelMapfv being logged.
Diagnostic: Unknown function glPixelMapuiv being logged.
Diagnostic: Unknown function glPixelMapusv being logged.
Diagnostic: Unknown function glGetPixelMapfv being logged.
Diagnostic: Unknown function glGetPixelMapuiv being logged.
Diagnostic: Unknown function glGetPixelMapusv being logged.
Diagnostic: Unknown function glBitmap being logged.
Diagnostic: Unknown function glReadPixels being logged.
Diagnostic: Unknown function glDrawPixels being logged.
Diagnostic: Unknown function glCopyPixels being logged.
Diagnostic: Unknown function glStencilFunc being logged.
Diagnostic: Unknown function glStencilMask being logged.
Diagnostic: Unknown function glStencilOp being logged.
Diagnostic: Unknown function glClearStencil being logged.
Diagnostic: Unknown function glTexGend being logged.
Diagnostic: Unknown function glTexGenf being logged.
Diagnostic: Unknown function glTexGeni being logged.
Diagnostic: Unknown function glTexGendv being logged.
Diagnostic: Unknown function glTexGenfv being logged.
Diagnostic: Unknown function glTexGeniv being logged.
Diagnostic: Unknown function glGetTexGendv being logged.
Diagnostic: Unknown function glGetTexGenfv being logged.
Diagnostic: Unknown function glGetTexGeniv being logged.
Diagnostic: Unknown function glTexEnvf being logged.
Diagnostic: Unknown function glTexEnvi being logged.
Diagnostic: Unknown function glTexEnvfv being logged.
Diagnostic: Unknown function glTexEnviv being logged.
Diagnostic: Unknown function glGetTexEnvfv being logged.
Diagnostic: Unknown function glGetTexEnviv being logged.
Diagnostic: Unknown function glTexParameterf being logged.
Diagnostic: Unknown function glTexParameteri being logged.
Diagnostic: Unknown function glTexParameterfv being logged.
Diagnostic: Unknown function glTexParameteriv being logged.
Diagnostic: Unknown function glGetTexParameterfv being logged.
Diagnostic: Unknown function glGetTexParameteriv being logged.
Diagnostic: Unknown function glGetTexLevelParameterfv being logged.
Diagnostic: Unknown function glGetTexLevelParameteriv being logged.
Diagnostic: Unknown function glTexImage1D being logged.
Diagnostic: Unknown function glTexImage2D being logged.
Diagnostic: Unknown function glGetTexImage being logged.
Diagnostic: Unknown function glGenTextures being logged.
Diagnostic: Unknown function glDeleteTextures being logged.
Diagnostic: Unknown function glBindTexture being logged.
Diagnostic: Unknown function glPrioritizeTextures being logged.
Diagnostic: Unknown function glAreTexturesResident being logged.
Diagnostic: Unknown function glIsTexture being logged.
Diagnostic: Unknown function glTexSubImage1D being logged.
Diagnostic: Unknown function glTexSubImage2D being logged.
Diagnostic: Unknown function glCopyTexImage1D being logged.
Diagnostic: Unknown function glCopyTexImage2D being logged.
Diagnostic: Unknown function glCopyTexSubImage1D being logged.
Diagnostic: Unknown function glCopyTexSubImage2D being logged.
Diagnostic: Unknown function glMap1d being logged.
Diagnostic: Unknown function glMap1f being logged.
Diagnostic: Unknown function glMap2d being logged.
Diagnostic: Unknown function glMap2f being logged.
Diagnostic: Unknown function glGetMapdv being logged.
Diagnostic: Unknown function glGetMapfv being logged.
Diagnostic: Unknown function glGetMapiv being logged.
Diagnostic: Unknown function glEvalCoord1d being logged.
Diagnostic: Unknown function glEvalCoord1f being logged.
Diagnostic: Unknown function glEvalCoord1dv being logged.
Diagnostic: Unknown function glEvalCoord1fv being logged.
Diagnostic: Unknown function glEvalCoord2d being logged.
Diagnostic: Unknown function glEvalCoord2f being logged.
Diagnostic: Unknown function glEvalCoord2dv being logged.
Diagnostic: Unknown function glEvalCoord2fv being logged.
Diagnostic: Unknown function glMapGrid1d being logged.
Diagnostic: Unknown function glMapGrid1f being logged.
Diagnostic: Unknown function glMapGrid2d being logged.
Diagnostic: Unknown function glMapGrid2f being logged.
Diagnostic: Unknown function glEvalPoint1 being logged.
Diagnostic: Unknown function glEvalPoint2 being logged.
Diagnostic: Unknown function glEvalMesh1 being logged.
Diagnostic: Unknown function glEvalMesh2 being logged.
Diagnostic: Unknown function glFogf being logged.
Diagnostic: Unknown function glFogi being logged.
Diagnostic: Unknown function glFogfv being logged.
Diagnostic: Unknown function glFogiv being logged.
Diagnostic: Unknown function glFeedbackBuffer being logged.
Diagnostic: Unknown function glPassThrough being logged.
Diagnostic: Unknown function glSelectBuffer being logged.
Diagnostic: Unknown function glInitNames being logged.
Diagnostic: Unknown function glLoadName being logged.
Diagnostic: Unknown function glPushName being logged.
Diagnostic: Unknown function glPopName being logged.
Diagnostic: Unknown function wglChoosePixelFormat being logged.
Diagnostic: Unknown function wglCopyContext being logged.
Diagnostic: Unknown function wglCreateContext being logged.
Diagnostic: Unknown function wglCreateLayerContext being logged.
Diagnostic: Unknown function wglDeleteContext being logged.
Diagnostic: Unknown function wglDescribeLayerPlane being logged.
Diagnostic: Unknown function wglDescribePixelFormat being logged.
Diagnostic: Unknown function wglGetCurrentContext being logged.
Diagnostic: Unknown function wglGetCurrentDC being logged.
Diagnostic: Unknown function wglGetDefaultProcAddress being logged.
Diagnostic: Unknown function wglGetLayerPaletteEntries being logged.
Diagnostic: Unknown function wglGetPixelFormat being logged.
Diagnostic: Unknown function wglGetProcAddress being logged.
Diagnostic: Unknown function wglMakeCurrent being logged.
Diagnostic: Unknown function wglRealizeLayerPalette being logged.
Diagnostic: Unknown function wglSetLayerPaletteEntries being logged.
Diagnostic: Unknown function wglSetPixelFormat being logged.
Diagnostic: Unknown function wglShareLists being logged.
Diagnostic: Unknown function wglSwapBuffers being logged.
Diagnostic: Unknown function wglSwapLayerBuffers being logged.
Diagnostic: Unknown function wglUseFontBitmapsA being logged.
Diagnostic: Unknown function wglUseFontBitmapsW being logged.
Diagnostic: Unknown function wglUseFontOutlinesA being logged.
Diagnostic: Unknown function wglUseFontOutlinesW being logged.
===================================================
Log End.




This is what worries me

Function glGenTextures is being called before context creation
Call to glGenTextures made outside of context/init

But I have no clue what it means

Share this post


Link to post
Share on other sites
It means that there is no GL context when you are making those GL function calls. You need to setup the pixelformat on your window, then create an GL conext (wglCreateContext) and make the GL context current (wglMakeCurrent). That's if you are on Windows.
If you are using GLUT, then glutCreateWindow must be called first before making GL function calls.

Share this post


Link to post
Share on other sites
AHA! Thank you! When you said that I was wondering how was that possible since I haven't changed my create windows function BUT when I looked at when it was called it was called AFTER I set up my variables in WinMain so thus it didn't know what to do with the calls.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Forum Statistics

    • Total Topics
      628294
    • Total Posts
      2981876
  • Similar Content

    • By mellinoe
      Hi all,
      First time poster here, although I've been reading posts here for quite a while. This place has been invaluable for learning graphics programming -- thanks for a great resource!
      Right now, I'm working on a graphics abstraction layer for .NET which supports D3D11, Vulkan, and OpenGL at the moment. I have implemented most of my planned features already, and things are working well. Some remaining features that I am planning are Compute Shaders, and some flavor of read-write shader resources. At the moment, my shaders can just get simple read-only access to a uniform (or constant) buffer, a texture, or a sampler. Unfortunately, I'm having a tough time grasping the distinctions between all of the different kinds of read-write resources that are available. In D3D alone, there seem to be 5 or 6 different kinds of resources with similar but different characteristics. On top of that, I get the impression that some of them are more or less "obsoleted" by the newer kinds, and don't have much of a place in modern code. There seem to be a few pivots:
      The data source/destination (buffer or texture) Read-write or read-only Structured or unstructured (?) Ordered vs unordered (?) These are just my observations based on a lot of MSDN and OpenGL doc reading. For my library, I'm not interested in exposing every possibility to the user -- just trying to find a good "middle-ground" that can be represented cleanly across API's which is good enough for common scenarios.
      Can anyone give a sort of "overview" of the different options, and perhaps compare/contrast the concepts between Direct3D, OpenGL, and Vulkan? I'd also be very interested in hearing how other folks have abstracted these concepts in their libraries.
    • By aejt
      I recently started getting into graphics programming (2nd try, first try was many years ago) and I'm working on a 3d rendering engine which I hope to be able to make a 3D game with sooner or later. I have plenty of C++ experience, but not a lot when it comes to graphics, and while it's definitely going much better this time, I'm having trouble figuring out how assets are usually handled by engines.
      I'm not having trouble with handling the GPU resources, but more so with how the resources should be defined and used in the system (materials, models, etc).
      This is my plan now, I've implemented most of it except for the XML parts and factories and those are the ones I'm not sure of at all:
      I have these classes:
      For GPU resources:
      Geometry: holds and manages everything needed to render a geometry: VAO, VBO, EBO. Texture: holds and manages a texture which is loaded into the GPU. Shader: holds and manages a shader which is loaded into the GPU. For assets relying on GPU resources:
      Material: holds a shader resource, multiple texture resources, as well as uniform settings. Mesh: holds a geometry and a material. Model: holds multiple meshes, possibly in a tree structure to more easily support skinning later on? For handling GPU resources:
      ResourceCache<T>: T can be any resource loaded into the GPU. It owns these resources and only hands out handles to them on request (currently string identifiers are used when requesting handles, but all resources are stored in a vector and each handle only contains resource's index in that vector) Resource<T>: The handles given out from ResourceCache. The handles are reference counted and to get the underlying resource you simply deference like with pointers (*handle).  
      And my plan is to define everything into these XML documents to abstract away files:
      Resources.xml for ref-counted GPU resources (geometry, shaders, textures) Resources are assigned names/ids and resource files, and possibly some attributes (what vertex attributes does this geometry have? what vertex attributes does this shader expect? what uniforms does this shader use? and so on) Are reference counted using ResourceCache<T> Assets.xml for assets using the GPU resources (materials, meshes, models) Assets are not reference counted, but they hold handles to ref-counted resources. References the resources defined in Resources.xml by names/ids. The XMLs are loaded into some structure in memory which is then used for loading the resources/assets using factory classes:
      Factory classes for resources:
      For example, a texture factory could contain the texture definitions from the XML containing data about textures in the game, as well as a cache containing all loaded textures. This means it has mappings from each name/id to a file and when asked to load a texture with a name/id, it can look up its path and use a "BinaryLoader" to either load the file and create the resource directly, or asynchronously load the file's data into a queue which then can be read from later to create the resources synchronously in the GL context. These factories only return handles.
      Factory classes for assets:
      Much like for resources, these classes contain the definitions for the assets they can load. For example, with the definition the MaterialFactory will know which shader, textures and possibly uniform a certain material has, and with the help of TextureFactory and ShaderFactory, it can retrieve handles to the resources it needs (Shader + Textures), setup itself from XML data (uniform values), and return a created instance of requested material. These factories return actual instances, not handles (but the instances contain handles).
       
       
      Is this a good or commonly used approach? Is this going to bite me in the ass later on? Are there other more preferable approaches? Is this outside of the scope of a 3d renderer and should be on the engine side? I'd love to receive and kind of advice or suggestions!
      Thanks!
    • By nedondev
      I 'm learning how to create game by using opengl with c/c++ coding, so here is my fist game. In video description also have game contain in Dropbox. May be I will make it better in future.
      Thanks.
    • By Abecederia
      So I've recently started learning some GLSL and now I'm toying with a POM shader. I'm trying to optimize it and notice that it starts having issues at high texture sizes, especially with self-shadowing.
      Now I know POM is expensive either way, but would pulling the heightmap out of the normalmap alpha channel and in it's own 8bit texture make doing all those dozens of texture fetches more cheap? Or is everything in the cache aligned to 32bit anyway? I haven't implemented texture compression yet, I think that would help? But regardless, should there be a performance boost from decoupling the heightmap? I could also keep it in a lower resolution than the normalmap if that would improve performance.
      Any help is much appreciated, please keep in mind I'm somewhat of a newbie. Thanks!
    • By test opty
      Hi,
      I'm trying to learn OpenGL through a website and have proceeded until this page of it. The output is a simple triangle. The problem is the complexity.
      I have read that page several times and tried to analyse the code but I haven't understood the code properly and completely yet. This is the code:
       
      #include <glad/glad.h> #include <GLFW/glfw3.h> #include <C:\Users\Abbasi\Desktop\std_lib_facilities_4.h> using namespace std; //****************************************************************************** void framebuffer_size_callback(GLFWwindow* window, int width, int height); void processInput(GLFWwindow *window); // settings const unsigned int SCR_WIDTH = 800; const unsigned int SCR_HEIGHT = 600; const char *vertexShaderSource = "#version 330 core\n" "layout (location = 0) in vec3 aPos;\n" "void main()\n" "{\n" " gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n" "}\0"; const char *fragmentShaderSource = "#version 330 core\n" "out vec4 FragColor;\n" "void main()\n" "{\n" " FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n" "}\n\0"; //******************************* int main() { // glfw: initialize and configure // ------------------------------ glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // glfw window creation GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "My First Triangle", nullptr, nullptr); if (window == nullptr) { cout << "Failed to create GLFW window" << endl; glfwTerminate(); return -1; } glfwMakeContextCurrent(window); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); // glad: load all OpenGL function pointers if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { cout << "Failed to initialize GLAD" << endl; return -1; } // build and compile our shader program // vertex shader int vertexShader = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vertexShader, 1, &vertexShaderSource, nullptr); glCompileShader(vertexShader); // check for shader compile errors int success; char infoLog[512]; glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success); if (!success) { glGetShaderInfoLog(vertexShader, 512, nullptr, infoLog); cout << "ERROR::SHADER::VERTEX::COMPILATION_FAILED\n" << infoLog << endl; } // fragment shader int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fragmentShader, 1, &fragmentShaderSource, nullptr); glCompileShader(fragmentShader); // check for shader compile errors glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success); if (!success) { glGetShaderInfoLog(fragmentShader, 512, nullptr, infoLog); cout << "ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\n" << infoLog << endl; } // link shaders int shaderProgram = glCreateProgram(); glAttachShader(shaderProgram, vertexShader); glAttachShader(shaderProgram, fragmentShader); glLinkProgram(shaderProgram); // check for linking errors glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success); if (!success) { glGetProgramInfoLog(shaderProgram, 512, nullptr, infoLog); cout << "ERROR::SHADER::PROGRAM::LINKING_FAILED\n" << infoLog << endl; } glDeleteShader(vertexShader); glDeleteShader(fragmentShader); // set up vertex data (and buffer(s)) and configure vertex attributes float vertices[] = { -0.5f, -0.5f, 0.0f, // left 0.5f, -0.5f, 0.0f, // right 0.0f, 0.5f, 0.0f // top }; unsigned int VBO, VAO; glGenVertexArrays(1, &VAO); glGenBuffers(1, &VBO); // bind the Vertex Array Object first, then bind and set vertex buffer(s), //and then configure vertex attributes(s). glBindVertexArray(VAO); glBindBuffer(GL_ARRAY_BUFFER, VBO); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0); glEnableVertexAttribArray(0); // note that this is allowed, the call to glVertexAttribPointer registered VBO // as the vertex attribute's bound vertex buffer object so afterwards we can safely unbind glBindBuffer(GL_ARRAY_BUFFER, 0); // You can unbind the VAO afterwards so other VAO calls won't accidentally // modify this VAO, but this rarely happens. Modifying other // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind // VAOs (nor VBOs) when it's not directly necessary. glBindVertexArray(0); // uncomment this call to draw in wireframe polygons. //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); // render loop while (!glfwWindowShouldClose(window)) { // input // ----- processInput(window); // render // ------ glClearColor(0.2f, 0.3f, 0.3f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); // draw our first triangle glUseProgram(shaderProgram); glBindVertexArray(VAO); // seeing as we only have a single VAO there's no need to // bind it every time, but we'll do so to keep things a bit more organized glDrawArrays(GL_TRIANGLES, 0, 3); // glBindVertexArray(0); // no need to unbind it every time // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.) glfwSwapBuffers(window); glfwPollEvents(); } // optional: de-allocate all resources once they've outlived their purpose: glDeleteVertexArrays(1, &VAO); glDeleteBuffers(1, &VBO); // glfw: terminate, clearing all previously allocated GLFW resources. glfwTerminate(); return 0; } //************************************************** // process all input: query GLFW whether relevant keys are pressed/released // this frame and react accordingly void processInput(GLFWwindow *window) { if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); } //******************************************************************** // glfw: whenever the window size changed (by OS or user resize) this callback function executes void framebuffer_size_callback(GLFWwindow* window, int width, int height) { // make sure the viewport matches the new window dimensions; note that width and // height will be significantly larger than specified on retina displays. glViewport(0, 0, width, height); } As you see, about 200 lines of complicated code only for a simple triangle. 
      I don't know what parts are necessary for that output. And also, what the correct order of instructions for such an output or programs is, generally. That start point is too complex for a beginner of OpenGL like me and I don't know how to make the issue solved. What are your ideas please? What is the way to figure both the code and the whole program out correctly please?
      I wish I'd read a reference that would teach me OpenGL through a step-by-step method. 
  • Popular Now