Thanks for the answer, Edit: so i am not sure why this did not work, but i found an example from the project "Explosions" made by 71squared, that has a file that deals with the texture import. It works fine, if anyone is looking for the same thing.
Thanks for the answer
- Viewing Profile: Posts: PaulCaben
Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics
Community Stats
- Group Members
- Active Posts 7
- Profile Views 401
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
110
Neutral
User Tools
Contacts
PaulCaben hasn't added any contacts yet.
Latest Visitors
No latest visitors to show
Posts I've Made
In Topic: Texture image replaced by a "number" ?
09 July 2012 - 11:20 PM
In Topic: Why do i get stripes instead of a plain color? (in a defined area)
04 July 2012 - 08:34 PM
Okay thanks
In Topic: Why do i get stripes instead of a plain color? (in a defined area)
02 July 2012 - 04:44 PM
Thanks, ok so it works!
I changed a bit the vertices, and added some glDisable... in the draw method.
Could you explain me a little bit about these snapshots :
With :
Cnothing.png 9.92K
19 downloads
Then with :
CdisableColor.png 7.41K
21 downloads
And finally with :
The final image :
CdisableTexture.png 7.29K
24 downloads
What are these COLOR_ARRAY and TEXTURE_COORD by default? And why the texture coord would create stripes on the image?
Thanks!
I changed a bit the vertices, and added some glDisable... in the draw method.
Could you explain me a little bit about these snapshots :
With :
//glDisable(GL_TEXTURE_2D); //glDisableClientState(GL_COLOR_ARRAY); //glDisableClientState(GL_TEXTURE_COORD_ARRAY); glBindTexture(GL_TEXTURE_2D, _textureImage.texture.name); glColor4f(1, 1, 1, 1); glVertexPointer(2, GL_FLOAT, 0, _polyVertices); glTexCoordPointer(2, GL_FLOAT, 0, _polyTexCoords); glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)_nPolyVertices);
Cnothing.png 9.92K
19 downloadsThen with :
//glDisable(GL_TEXTURE_2D); glDisableClientState(GL_COLOR_ARRAY); //glDisableClientState(GL_TEXTURE_COORD_ARRAY);
CdisableColor.png 7.41K
21 downloadsAnd finally with :
//glDisable(GL_TEXTURE_2D); glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY);
The final image :
CdisableTexture.png 7.29K
24 downloadsWhat are these COLOR_ARRAY and TEXTURE_COORD by default? And why the texture coord would create stripes on the image?
Thanks!
In Topic: Why do i get stripes instead of a plain color? (in a defined area)
02 July 2012 - 12:07 AM
Thanks,
I would like to create a special wall, with different points in the x-axis (the red points), all connected to the y-axis (the green points). Is that what you mean by triangulate the vertices?
ques.png 5.74K
23 downloads
I've tried to do this, but i have a problem (Edit)
I have a EXC_BAD_ACCESS in the draw method, next to "bind texture", i thought it might be because of the textCoord array, that may be looking for empty coordinates, but the texture is a 512pixels/or points (i'm not sure) square...
If i comment the bind texture line and the textcoord line, it gives me something strange, that moves, for example :
Capture d’écran 2012-07-02 à 13.07.44.png 14.7K
23 downloads
Capture d’écran 2012-07-02 à 13.07.48.png 13.37K
21 downloads
Would you know something about this?
Thanks
I would like to create a special wall, with different points in the x-axis (the red points), all connected to the y-axis (the green points). Is that what you mean by triangulate the vertices?
ques.png 5.74K
23 downloadsI've tried to do this, but i have a problem (Edit)
I have a EXC_BAD_ACCESS in the draw method, next to "bind texture", i thought it might be because of the textCoord array, that may be looking for empty coordinates, but the texture is a 512pixels/or points (i'm not sure) square...
- (void)generatePath {
int _nVertices = 0;
_hillKeyPoints[_nVertices] = CGPointMake(44, 0); //_nVertices = 1
_hillKeyPoints[++_nVertices] = CGPointMake(100, 75); //_nVertices = 2
_hillKeyPoints[++_nVertices] = CGPointMake(50, 150); //_nVertices = 3
_hillKeyPoints[++_nVertices] = CGPointMake(150, 225); //_nVertices = 4
}
-(void)generatePolygons{
_nPolyVertices = 0;
float x1 = 0;
float y1 = 0;
int keyPoints = 0;
_fromKeyPointI = 0;
_toKeyPointI = 4;
for (int i=_fromKeyPointI; i<_toKeyPointI; i++){
//V0: at (0,0)
_polyVertices[_nPolyVertices] = CGPointMake(x1, y1);
_polyTexCoords[_nPolyVertices++] = CGPointMake(x1, y1);
//V1: to the first "point"
_polyVertices[_nPolyVertices] = CGPointMake(_hillKeyPoints[keyPoints].x, _hillKeyPoints[keyPoints].y);
_polyTexCoords[_nPolyVertices++] = CGPointMake(_hillKeyPoints[keyPoints].x, _hillKeyPoints[keyPoints].y);
//V2, same y as point n°2:
_polyVertices[_nPolyVertices] = CGPointMake(0, _hillKeyPoints[keyPoints+1].y);
_polyTexCoords[_nPolyVertices++] = CGPointMake(0, _hillKeyPoints[keyPoints+1].y);
//V3 = V1
_polyVertices[_nPolyVertices] = _polyVertices[_nPolyVertices-2];
_polyTexCoords[_nPolyVertices++] = _polyVertices[_nPolyVertices-2];
//V4 = V2
_polyVertices[_nPolyVertices] = _polyVertices[_nPolyVertices-2];
_polyTexCoords[_nPolyVertices++] = _polyVertices[_nPolyVertices-2];
//V5 = same x,y as point n°2
keyPoints++;
_polyVertices[_nPolyVertices] = CGPointMake(_hillKeyPoints[keyPoints].x, _hillKeyPoints[keyPoints].y);
_polyTexCoords[_nPolyVertices++] = CGPointMake(_hillKeyPoints[keyPoints].x, _hillKeyPoints[keyPoints].y);
y1 = _polyVertices[_nPolyVertices].y;
//CCLOG(@"y1 : %f", y1);
}
for(int i = 1; i < kMaxPolyVertices; ++i) {
//ccDrawLine(_polyVertices[i-1], _polyVertices[i]);
CCLOG(@"_polyVertices[i-1].y : %f, _polyVertices[i].y : %f", _polyVertices[i-1].y, _polyVertices[i].y);
}
}
- (id)init {
if ((self = [super init])) {
[self generatePath];
[self generatePolygons];
}
return self;
}
- (void) draw {
glBindTexture(GL_TEXTURE_2D, _textureImage.texture.name);//EXC_BAD_ACCESS
glDisableClientState(GL_COLOR_ARRAY);
glColor4f(1, 1, 1, 1);
glVertexPointer(2, GL_FLOAT, 0, _polyVertices);
glTexCoordPointer(2, GL_FLOAT, 0, _polyTexCoords);
glDrawArrays(GL_TRIANGLES, 0, (GLsizei)_nPolyVertices);
}
If i comment the bind texture line and the textcoord line, it gives me something strange, that moves, for example :
Capture d’écran 2012-07-02 à 13.07.44.png 14.7K
23 downloads
Capture d’écran 2012-07-02 à 13.07.48.png 13.37K
21 downloadsWould you know something about this?
Thanks
- Home
- » Viewing Profile: Posts: PaulCaben

Find content