Default Texture Color?

I’m new to OpenGL and I’m working on a Vuforia Augmented Reality app.
I’m importing textures to my app using a perl script that converts .obj files to .h
files.

My imported textures have these arrays:
glVertexPointer(3, GL_FLOAT, 0, frameARVerts);
glNormalPointer(GL_FLOAT, 0, frameARNormals);

The texture coordinates are missing and I wonder if it’s possible to generate the texture coordinates somehow?

When I render (I’m not sure if this is the word used" my tetures in my app they have a yellowish color,
is it possible to change this color?

There are many things wrong with the information you have posted and it’s not clear what you are trying to say. Please slow down and discuss one item at a time, clearly describing (with code) the parts that have gone wrong, what you’d expect, and what you observed.

My imported textures have these arrays:
glVertexPointer(3, GL_FLOAT, 0, frameARVerts);
glNormalPointer(GL_FLOAT, 0, frameARNormals);

…is meaningless. Textures are images (bitmaps, if you will) and have nothing to do with rendering geometry.

The texture coordinates are missing and I wonder if it’s possible to generate the texture coordinates somehow

Well, are they in the OBJ file or just missing after your code converts them to .h files (what ever that is).
Yes, in some cases, texture coordinates of reaular geometry can be calculated in a Vertex shader - but not for complex geometry.

my tetures in my app they have a yellowish color,
is it possible to change this color

Then you are rendering the object & texture wrongly. Is blending enabled? Are you using a shader?

Sorry for my last input, I’ll try to be more clear this time.

I’m developing an Android AR (Augmented reality) app using a code example from Qualcomm.
I’m completely new to both AR and OpenGL.

I have textures in .obj format and to import these textures to my project I’m using a perl scrips.
The script outputs a .h that contains two arrays. See code below:

float sideVerts [] = {
// f 9//9 6//6 10//10
-0.231038325580029, 0.105720149112096, -0.0585550619509055,
-0.231184883305453, 0.0997986647895742, -0.0625237611900266,
-0.230957413502451, 0.105516044102722, -0.0566150803927526,

}

float sideNormals [] = {
// f 9//9 6//6 10//10
-0.999345908214985, 0.00044890045386168, 0.0361601192247726,
-0.998600666745904, 0.0196637717127176, 0.0490922036240545,
-0.999098931038037, -0.00144239592868675, 0.0424175139846333,

}

When I draw my textures I use the following code:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);

SampleUtils::translatePoseMatrix(-10.0f, -190.0f, kObjectScale0-700, &modelViewMatrix.data[0]);
SampleUtils::rotatePoseMatrix(-90.0f, 1.0f, 0.0f, 0.0f, &modelViewMatrix.data[0]); // rotate X
SampleUtils::rotatePoseMatrix(0.0f, -0.0f, 1.0f, 0.0f, &modelViewMatrix.data[0]); // rotate Y
SampleUtils::rotatePoseMatrix(40.0f, -0.0f, 0.0f, 1.0f, &modelViewMatrix.data[0]); // rotate Z
SampleUtils::scalePoseMatrix(kObjectScale0, kObjectScale0, kObjectScale0, &modelViewMatrix.data[0]);

SampleUtils::multiplyMatrix(&projectionMatrix.data[0], &modelViewMatrix.data[0], &modelViewProjection.data[0]);

glUseProgram(shaderProgramID);

glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &sideVerts[0]);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &sideNormals[0]);

glEnableVertexAttribArray(vertexHandle);
glEnableVertexAttribArray(normalHandle);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID);
glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjection.data[0] );

glDrawArrays(GL_TRIANGLES, 0, sideNumVerts);

glDisable(GL_DEPTH_TEST);

(This is not all the code in my project, I had to do some copy and paste.)
My textures are shown in a yellowish color and I wonder if it’s possible to change the color and the transparency of my textures.

I think you have a misunderstanding here. A texture is a bitmap, but an obj files describes a geometry. The geometry may contain information about texture coordinates, though.


glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &sideVerts[0]);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &sideNormals[0]);

You would need a call here to also define the texture coordinates. However, glVertexAttribPointer() no longer takes a pointer to data, it takes an offset to be used in the VBO. So you have to define one (more more) VBOs. You also need a Vertex Array object (VAO).


glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID);

This bind a bitmap, good! But you need to define the bitmap also. Do a glGenTextures() and a glTexImage2D() (and a few more configuration calls). Maybe you have done it elsewhere.

[quote]
Instead of getting it all done by yourself, have a look at an example that you can change. I would recommend a minimum, but complete: OpenGL-Examples/03texture.cpp at master · progschj/OpenGL-Examples · GitHub

Nah, he is probably using an old context so he isn’t forced to use VAO.