Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

OpenGL_Guru

glColor3f to coloring by texture coordinates.

This topic is 5193 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am coloring my heightmap by glColor3f calls but now i would like to put a texture on top of the heightmap and color each coordinate by color so i can get a smooth shading betweeen grid points. with glColor3f you get a blocky look between different colors. to color by texture coordinates using a 1D texture i presume?..for those of you that have done this do you just make your texture or how would you paste a texture on an object and then color it by its coordinates. thanks abunch!

Share this post


Link to post
Share on other sites
Advertisement
The simplest way is just a 1D texture. Figure out your maximum heightmap height (say, 32) then all your texture coords can become 1/maxHeight. Or you could use texture coord generation to do the same thing but it wouldn''t really gain you anything.

One nice trick with this is that you can paint strong black points on your texture and you''ll automagically get contour lines, handy for radar drawing or similar.

Share this post


Link to post
Share on other sites
well lemme explain why i want to go this route and then maybe i can get your feedback. i read in some data for the heightmap and one of the arguments read in is at each vertex point(xyz) there is an associated value, either 0 or 1. 0 is for land and 1 is for water. so right now all my vertices are colored according to that using glColor3f. now i would like to take each vertex and color the texture coord based on whether or not i get a 0 or 1 and as i understand it, the texture will interpolate between texels to give me the smooth color shading that i desire. is this all correct?

i guess what also i am really asking is if i dont have a texture to start with do i just make one up? or get one off the web and just modify the texels on the texture that way or what?
i guess im just a little baffled. before i had a heightmap that was colored by the height. now this is not necessarily the case. its a simple as 0 or land and 1 for water but maybe i am making things to hard for myself

[edited by - opengl_guru on March 5, 2004 12:03:25 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!