Jump to content
  • Advertisement
Sign in to follow this  
moujot

texture not showing up

This topic is 5408 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

Hi there, A friend of mine is developping a procedural texture app based on perlin noise, and we're having a problem, textures generated do not show up but on his machine. The app consist of merely two textures, that you modifiy and display using keys and sliders, all procedurals; on his machine, using an ATI Rage pro 128 textures show up without problem, on my machine using a geforce 2 they don't, would anyone have an idea as of why ? The app has been tested on a couple other computers, one using a newer ATI, another using a geforce 4, but still to no avail. here is a piece of code that apparently is causing textures not to show up: inline unsigned int MakeTexFromImg(GTexture::Image *i) { unsigned int id = 0; glGenTextures(1, &id); glBindTexture(GL_TEXTURE_2D, id); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexImage2D(GL_TEXTURE_2D, 0, i->format, i->width, i->height, 0, i->format, GL_UNSIGNED_BYTE, i->data); delete [] i->data; delete i; return id; } unsigned int MakePerlinNoiseTexture( VGL_PerlinNoiseImg* perlin ,int width,int height) { GTexture::Image *img = new GTexture::Image; img->data=NULL; img->width = width; img->height = height; img->format = GL_RGBA; img->data = new unsigned char [img->width * img->height * 4]; float p[ 2 ]; int pos = 0; Vector3 col = Vector3(1,1,1); float fHeight = (float)height; float delta = perlin->scale.x / (float)width; for ( int y=0; y<height; y++ ) { p[0] = (float)y / fHeight * perlin->scale.y; p[1] = 0.0f; for ( int x=0; x<width; x++ ) { p[1] += delta; col = perlin->GetColor( p ); for ( int d=0; d<3; d++ ) img->data[ pos++ ] = FloatToByte( col.v[ d ] * 255.0f ); img->data[ pos++ ] = 255; // alpha channel } } return MakeTexFromImg(img); } /// la structure GTexture::Image en question struct Image { int width, height; unsigned int format; unsigned char *data; }; thanks for any help !! mouj

Share this post


Link to post
Share on other sites
Advertisement
Can't anyone help me on this please ?
Probably the app can be uploaded somewhere so that you'd be able to get and test it, if that helps.

mouj

Share this post


Link to post
Share on other sites
glGetError() is nice. As a guess to what the problerm is, you don't seem to be setting up filtering and you only upload the lowest mip level. The default filter uses mip maps, so that won't work on any decent OpenGL implementation.

Share this post


Link to post
Share on other sites
Hey, thanks for the answer ! Indeed textures are not filtered, we will try this and use mip maps, and get back !

*edit: right on it ! it seems to be working now ! Thanks !

mouj

[Edited by - moujot on September 27, 2004 5:18:42 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!