Jump to content

  • Log In with Google      Sign In   
  • Create Account

Why can't I change the vertex colour when the texture is alpha only?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 blueshogun96   Crossbones+   -  Reputation: 1094

Like
0Likes
Like

Posted 03 April 2013 - 09:32 AM

For OpenGL ES, I'm working on an iOS game which uses a pre-written font class.  It works great, but I can't change the vertex colour of the primitives used to draw the text.

 

I'm using this code here: http://www.themusingsofalostprogrammer.com/2010/01/how-to-do-font-rendering-in-opengl-on.html

 

I tried to modify the code so I could change the vertex colour, but it doesn't seem to effect it.  Before you say it, I can't use a vertex/fragment program because I'm using a 1st gen iPod which doesn't support it.  Any other ideas?  Would love to share more, but I'm on a bus w/ wifi and I'm about to get off; my stop is coming up.

 

Shogun


Follow Shogun3D on the official website: http://shogun3d.net

 

blogger.png twitter.png tumblr_32.png facebook.png

 

"Yo mama so fat, she can't be frustum culled." - yoshi_lol


Sponsor:

#2 SimonForsman   Crossbones+   -  Reputation: 6304

Like
1Likes
Like

Posted 03 April 2013 - 10:58 AM

have you tried simply calling glColor3f before you use the libraries print function ?
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#3 blueshogun96   Crossbones+   -  Reputation: 1094

Like
0Likes
Like

Posted 03 April 2013 - 12:07 PM

For starters, glColor and friends aren't supported on OpenGL ES.

 

Second, I did modify the vertex array code to include a diffuse colour for each vertex, but that didn't change anything either.

 

Is there a way to do this using glTexEnv?  This is a bit tougher than I thought. blink.png

 

Shogun.


Follow Shogun3D on the official website: http://shogun3d.net

 

blogger.png twitter.png tumblr_32.png facebook.png

 

"Yo mama so fat, she can't be frustum culled." - yoshi_lol


#4 SimonForsman   Crossbones+   -  Reputation: 6304

Like
1Likes
Like

Posted 03 April 2013 - 12:48 PM

glColor4f is available in ES1.0/1.1 (you're right that 3f is missing though), just set alpha to 1.0

do a glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); as well before you render and it should multiply the vertex color with the texture color

You do not need a color array unless you want different colors for each vertex.
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#5 blueshogun96   Crossbones+   -  Reputation: 1094

Like
0Likes
Like

Posted 03 April 2013 - 07:49 PM

Are you sure glColor4f is supported in OpenGL ES 1.1?  Once again, XCode is telling me that it's undefined.  I had to remove it before, and I can't find a definition for it anywhere.

 

I tried using glTexEnvi(...) and it still didn't work.  

 

Shogun.


Follow Shogun3D on the official website: http://shogun3d.net

 

blogger.png twitter.png tumblr_32.png facebook.png

 

"Yo mama so fat, she can't be frustum culled." - yoshi_lol


#6 SimonForsman   Crossbones+   -  Reputation: 6304

Like
1Likes
Like

Posted 04 April 2013 - 03:57 AM

Are you sure glColor4f is supported in OpenGL ES 1.1?  Once again, XCode is telling me that it's undefined.  I had to remove it before, and I can't find a definition for it anywhere.

 

I tried using glTexEnvi(...) and it still didn't work.  

 

Shogun.

 

Yes, glColor4f is available in OpenGL:ES 1.1 (its not in 2.0 though)

 

GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);


should be in OpenGLES/ES1/gl.h (or whatever path you use on iOS)

I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#7 mhagain   Crossbones+   -  Reputation: 8276

Like
1Likes
Like

Posted 04 April 2013 - 05:58 AM

GL ES 1.1 does support glColor4f: http://www.khronos.org/opengles/sdk/1.1/docs/man/ - if XCode is telling you that it's undefined then you've a problem with  XCode.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#8 blueshogun96   Crossbones+   -  Reputation: 1094

Like
0Likes
Like

Posted 04 April 2013 - 12:18 PM

Okay, it's working now.  I don't know why, but it's working now.

 

I reopened the project and it just started compiling without error.  Meh, unless I subconsciously spelled it as glColour4f, I have no idea why it wasn't working before.  Well, that did the trick.  Now I feel stupid again...

 

I'll give you both ratings for your troubles >.<

 

Shogun


Follow Shogun3D on the official website: http://shogun3d.net

 

blogger.png twitter.png tumblr_32.png facebook.png

 

"Yo mama so fat, she can't be frustum culled." - yoshi_lol


#9 tom_mai78101   Members   -  Reputation: 577

Like
0Likes
Like

Posted 07 April 2013 - 01:27 PM

I'll tell you why it didn't work before, but it worked afterwards.

 

Reason: You didn't refresh/clean your project. XCode may happened to have some old data that's hiddenly conflicting. Sometimes, it happens on my Eclipse for Java/Android.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS