Skip to main content
GameDev.net gamedev.net
🔒 Locked

Generating textures

Started by vivekd Jul 12, 2006 at 8:49 AM 1 replies 450+ views
Original Post
vivekd
vivekd
I am unsuccessful in generating textures using the following statement: GL.glGenTextures(1, texture_array); where texture_array is an array of unsigned integers. I have initialized the array with zeros. The values remain unchanged after executing above statement. Kindly help me.
jon723
jon723
you would usually do this to generate textures


GLuint mytexture;

glGenTexture(1, &mytexture); // for a single texture


GLuint textures[3];

glGenTextures(3, &textures); // for an array
www.lefthandinteractive.net
Kalidor
Kalidor
Quote:
Original post by jon723
...
GLuint textures[3];
glGenTextures(3, &textures); // for an array
glGenTextures takes a pointer to a GLuint, what you pass here is a pointer to an array of GLuints. You would need to pass the array itself (ie: glGenTextures(3, textures), just like vivekd is doing). And juding by the GL namespace I'm guessing this isn't even C/C++ so that might not apply.

To the OP, are you expecting more than just the first element in texture_array to be non-zero? The code you posted should only create a valid texture name in texture_array[0] since you are only asking to generate one. If that's not the problem, are you checking for OpenGL errors after that call? Do you have a valid rendering context before that call?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.