java - OpenGL - Unable to render colors other than white after texture mapping -


I am trying to render the color cube after presenting the textures with the other cubes I have several "drawer" There are objects that are analogous to the drawer interface, and I pass each context of the GL object to the Draw (Last GL GL) method of each individual implementation class. However, whatever I do, I'm unable to provide any color cube.

Code sample:

  gl.glDisable (GL.GL_TEXTURE_2D); Gl.glColor3f (1f, 0f, 0f); Gl.glBegin (GL.GL_QUADS); // Front Face Point 3F Point = Player .getPosition (); Gl.glNormal3f (0.0f, 0.0f, 1.0f); //gl.glTexCoord2f (0.0.0 f, 0.0f); Gl.glVertex3f (-point.x - 1.0f, -1.0f, -point.z + 1.0f); //gl.glTexCoord2f (1.0f, 0.0f); Gl.glVertex3f (-point.x + 1.0f, -1.0f, -point.z + 1.0f); // Continue the rest of the cube rendering ... gl.glEnd (); Gl.glEnable (GL.GL_TEXTURE_2D);  

I have tried to throw the glColor3f call before every top call, but it still gives me a white cube. What is happening?

There are some things that you need to make sure that you do.

First of all:

  gl.glEnable (gl.GL_COLOR_MATERIAL);  

With this you can apply color to your corner. (Call it before your call glColor3f.)

If it still does not solve the problem, make sure you are using the blending properly (if you use all the blending .)

For most applications, you might want to use

  gl.glEnable (gl.GL_BLEND); Gl.glBlendFunc (gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA);  

If none of these things resolves your problem, then give us some more information about what you are doing / prior to this section of your code. May fall.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -