glBindTexture(GL_TEXTURE_2D, WhatTex); // Bind the Texture to the object glGetTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_WIDTH,w1); glGetTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_HEIGHT,h1); glBindTexture(GL_TEXTURE_2D, texBox); // Bind new Texture to the object // now i want to use the glTexSubImage2D( ) //command so i copy then whattex in the tex box
i have two problems First; gltexsubimage2d want integer width and height and i have PGLInt so i get an error Second; i cant copy the image .... Help....
Thanks....
_________________ Try to think first before you act....
Note that glTexSubImage2D does require that the texture has already sufficient size. The size of a texture is initially zero! In contrast to that glTexImage2D does delete the texture buffer and create a new one with correct size.
glTexSubImage2D and glTexImage2D do read from main memory, not from another texture. If you want to copy a texture you might want to use a Framebuffer-Object and render a Fullscreen-Quad. That's faster because you don't have to download and upload the texture to graphics memory again.
Note that glTexSubImage2D does require that the texture has already sufficient size. The size of a texture is initially zero! In contrast to that glTexImage2D does delete the texture buffer and create a new one with correct size.
glTexSubImage2D and glTexImage2D do read from main memory, not from another texture. If you want to copy a texture you might want to use a Framebuffer-Object and render a Fullscreen-Quad. That's faster because you don't have to download and upload the texture to graphics memory again.
ok i see what you mean... Now i get this results from the w1 and h1 w1 = 0 my pic is 450 width h1 = -1234354 my pic is 350 height
What is that? .......
So you say that i must put the image to the memory and how can i call the image with glTexSubImage2D ?
Thanks for your help...
_________________ Try to think first before you act....
ok i see what you mean... Now i get this results from the w1 and h1 w1 = 0 my pic is 450 width h1 = -1234354 my pic is 350 height
GL_TEXTURE_WIDTH and GL_TEXTURE_HEIGHT are no valid parameters for glGetTexParameter. You have to use glGetTexLevelParameter instead: glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, @w1); glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, @h1);
Zitat:
So you say that i must put the image to the memory and how can i call the image with glTexSubImage2D?
Note that I used C++-Syntax since I have no idea how to create a dynamic array in Delphi. Note also that you might use another internal texture format. In that case replace GL_RGBA with GL_RGB or whatever you use. You will also have to adapt the array size.
Code:
glBindTexture(GL_TEXTURE_2D, WhatTex); glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, @w1); glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, @h1); GLubyte* data = new GLubyte[w1*h1*4]; // dynamic array of type GLubyte and size w1*h1*4 glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); // copy texture into main memory
Mitglieder in diesem Forum: 0 Mitglieder und 2 Gäste
Du darfst keine neuen Themen in diesem Forum erstellen. Du darfst keine Antworten zu Themen in diesem Forum erstellen. Du darfst deine Beiträge in diesem Forum nicht ändern. Du darfst deine Beiträge in diesem Forum nicht löschen. Du darfst keine Dateianhänge in diesem Forum erstellen.