Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

131 Neutral

About ak09

  • Rank
  1. As an example, the SendMessage(hWnd, CB_GETCURSEL, 0, 0) function returns the selected index of a combo box. If my purpose is to read this index multiple times, I should call this function multiple times. Or don't I? Instead, is there an address where these kind of stuff are stored so I can and use it for making things easier?
  2. ak09


    Hi, mhagain, thanks for the reply. Yeah, my hardware can't deal with that you mentioned. For the moment I'm wondering how good or bad is my current approach of copying a texture binded by some FBO into another binded by another FBO. The method consists in clearing the destination texture and drawing the first one to the second, so I can make the copy even if dealing with different sized textures.
  3. ak09


    Yeah, it seems that I can't. FBO is not a buffer object.
  4. ak09


    I tried every reasonable combination. Maybe it's important to say that I'm trying to copy an FBO to another (because I don't know if this function can deal with FBO's).  
  5. From the specification, void *glCopyBufferSubData(enum readtarget, enum writetarget, intptr readoffset, intptr writeoffset, sizeiptr size);               glCopyBufferSubData copies part of the data store attached to readtarget to the             data store attached to writetarget. The number of basic machine units indicated by size             is copied from the source, at offset readoffset to the destination at writeoffset,             also in basic machine units. It's not very clear, however, what's the meaning if readoffset, writeoffset and size, and how should them be used.           glBindFramebuffer(GL_COPY_READ_BUFFER, fboSrc);         glBindFramebuffer(GL_COPY_WRITE_BUFFER, fboDst);         glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, ?, ?, ?);     Any clue?         
  6. Thanks for the replies.   That's exactly what I want: be able to see my layers from different perspectives and choose one among them with a nice interface. However, I couldn't make it work yet. Tried both approaches, from Bob and Olof, but stills nothing. I don't know if I'm doing the calculations ok. Let me try to explain exactly how it's being done so far: The layer l1 is drawn over the layer l2. Every layer have it's own attributes, i.e, xPosition, yPosition, width, height, and angle, so I must (I guess) apply the properly transformations in the modelview matrix before each draw.   As posted before, that's my perspective function, called before anything:   void setPerspective(int w, int h) {     glViewport(0, 0, w, h);     glMatrixMode(GL_PROJECTION);     glLoadIdentity();     // gluOrtho2D(0, w, h, 0); (the old guy)     gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 0.001, 5000.0);     glMatrixMode(GL_MODELVIEW);     glLoadIdentity();     ... (transformations suggested by you) }       And that's the mess with which my layer is drawn, working perfectly with ortho2D:                 glLoadIdentity();             setPerspective(dst->width, dst->height);                // Dest transformations             glTranslatef(dst->cx, dst->cy, 0);  // cx = width/2   cy = height/2             glRotatef(-dst->angle, 0, 0, 1);             glTranslatef(-dst->cx, -dst->cy, 0);             glTranslatef(-dst->x, -dst->y, 0.0f);                // Source transformations             glTranslatef(src->x, src->y, 0.0f);             glTranslatef(src->cx, src->cy, 0);             glRotatef(src->angle, 0, 0, 1);             glTranslatef(-src->cx, -src->cy, 0);             glBindTexture(GL_TEXTURE_2D, src->texID;             glBegin(GL_QUADS);             glTexCoord2f(0.0f, 1.0f);  glVertex2i(0,0);                 glTexCoord2f(1.0f, 1.0f);  glVertex2i(src->width,0);               glTexCoord2f(1.0f, 0.0f);  glVertex2i(src->width,src->height);               glTexCoord2f(0.0f, 0.0f);  glVertex2i(0,src->height);             glEnd();             glBindTexture(GL_TEXTURE_2D, 0);      
  7. Sorry, but this is a little vague to me. All I'm doing is making a perspective change before every texture draw — since they can have different sizes — with:   void setPerspective(int w, int h) {     glViewport(0, 0, w, h);     glMatrixMode(GL_PROJECTION);     glLoadIdentity();     gluOrtho2D(0, w, h, 0);     glMatrixMode(GL_MODELVIEW); }     By replacing my gluOrtho2D with gluPerspective, what changes shoud I make and where?
  8. I'm drawing 2D, on different layers, dealing with real coordinates [(0,0), (screenWidth, screenHeight)] instead of the standard [-1,1]. And everything is ok when using gluOrtho2D(0, w, h, 0). However, I want to be able to render those layers in a 3D space, so the user can merge in the scene. The problem is: with gluPerspective, all my coordinates are changed, and for the reason I'd have to change them all in my code, this is strictly unwanted. So, is there a (simple) way to solve my thing?  
  9. Solved! Instead of HTSIZE I return now HTBOTTOMRIGHT.
  10. I got it, but returning HTSIZE when mouse is over my area just makes it freeze. This is what I get:       case WM_NCHITTEST:         if (onArea(LOWORD(lParam), HIWORD(lParam))             return HTSIZE;         return DefWindowProc(hWnd, msg, wParam, lParam);  
  11. The rectangle I mentioned represents a layer on wich my stuff will be drawn. But I'm dealing with several layers. So, doesn't your suggestion implies in making HWND's of my layers?
  12. Ok, so I have a rectangle drawn on my screen (via OpenGL), and I want to make it resizable — just like the standard resize box of all windows. Is there a simple way, other than checking mannualy if mouse position is here or there and changing cursor again and again , to do it?
  13.  I found that a simple fragment shader for that would be something like:     uniform sampler2D Mtexture; void main() {     vec4 color = texture2D(Mtexture, gl_TexCoord[0].st);     gl_FragColor = vec4(1.0 - color.r, 1.0 - color.g, 1.0 - color.b, color.a); } And the OGL code:       glUseProgram(prog);     glBindFramebuffer(GL_FRAMEBUFFER, fbo);     glColor4f(1, 1, 1, 1);     glBindTexture(GL_TEXTURE_2D, tex);     glBegin(GL_QUADS);     glTexCoord2f(0.0f, 1.0f);  glVertex2i(0,0);         glTexCoord2f(1.0f, 1.0f);  glVertex2i(width,0);       glTexCoord2f(1.0f, 0.0f);  glVertex2i(width,height);       glTexCoord2f(0.0f, 0.0f);  glVertex2i(0,height);     glEnd();     glBindTexture(GL_TEXTURE_2D, 0);     glBindFramebuffer(GL_FRAMEBUFFER, 0);     glUseProgram(0); However, it's not giving me the expected results, and this is driving me crazy. Should I disable GL_BLEND before applying the filter? Case not, which function to use? Should I clear my texture before using a shader on it? <-- Never understood this
  14. ak09

    Blending problem

    Sorry, what do you mean?
  15.  The first image shows one circle overlapping another. They were drawn in a texture, with fbo, and blended with   glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,GL_ONE,GL_ONE_MINUS_SRC_ALPHA);   [attachment=15533:certo.PNG] The second one shows the same stuff, but one circle is on textureA, and the other one on textureB (both handled by a fbo). Each texture was drawn on the screen, calling glBindTexture(GL_TEXTURE_2D, textureA); ... glBindTexture(GL_TEXTURE_2D, textureB); ...   [attachment=15534:err.PNG] My question is: why the blending differs? How can I fix it?  
  • 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!