Jump to content
  • Advertisement

tonysameh

Member
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

157 Neutral

About tonysameh

  • Rank
    Member
  1. tonysameh

    OpenGL polygon with borders

    Thank you.
  2. I need to draw a red square with black borders. Is there any parameter I can set to do that, or the only way is to draw a red polygon between the 4 vertices and then draw black lines between them?
  3. Sorry for my deep ignorance. But is collision detection part of game physics?
  4. I am reading both books in parallel and I am enjoying both so much. But it looks like they will not cover any game programming as they talk about OpenGL only (rendering graphics). Now what will be my next step? How can I learn articles like collision detection or games design in general? And is there a good book talking about games programming using OpenGL? P.S.: Beginning game programming using OpenGL is not very good. Thanks in advance for your answers.
  5. tonysameh

    My Y-axis is inverted .. why?

    Original post by jyk First, there are different conventions for which direction the +y axis points, so it can't really be said that it 'should' point one way or the other. Second, it looks like you have your orthographic projection set up so that +y will point down, so it shouldn't come as too much of a surprise that it doesn't point up (try flipping the signs of the 3rd and 4th arguments to glOrtho() and see what effect that has). Also, are the tags you're looking for (you can also use 'pre' tags for small bits of code).[/quote] Yes I got it. I got everything, the glOrtho parameters, the source tag and the pre tag. Thanks a lot
  6. tonysameh

    My Y-axis is inverted .. why?

    Here's my complete code <code> void RenderScene(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glBegin(GL_LINES); glColor3f(1,0,0); glVertex3d(-10,0,0); glVertex3d(100,0,0); glColor3f(0,1,0); glVertex3d(0,-10,0); glVertex3d(0,100,0); glColor3f(0,0,1); glVertex3d(0,0,-10); glVertex3d(0,0,100); glEnd(); glutSwapBuffers(); } // This function does any needed initialization on the rendering // context. void SetupRC() { glClearColor(0.0f, 0.0f, 0.0f, 1.0f ); } void ChangeSize(int w, int h) { GLfloat nRange = 100.0f; // Prevent a divide by zero if(h == 0) h = 1; // Set Viewport to window dimensions glViewport(0, 0, w, h); // Reset coordinate system glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Establish clipping volume (left, right, bottom, top, near, far) if (w <= h) glOrtho (-nRange, nRange, nRange*h/w, -nRange*h/w, -nRange*2.0f, nRange*2.0f); else glOrtho (-nRange*w/h, nRange*w/h, nRange, -nRange, -nRange*2.0f, nRange*2.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(800, 600); glutCreateWindow("OpenGL Atom"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); SetupRC(); glutMainLoop(); return 0; } </code>
  7. The +ve Y-axis should point upwards, right? I used the following code to draw the 3 axes. Each of them has a small part in the negative direction and a longer part in the positive direction. glBegin(GL_LINES); glColor3f(1,0,0); glVertex3d(-10,0,0); glVertex3d(100,0,0); glColor3f(0,1,0); glVertex3d(0,-10,0); glVertex3d(0,100,0); glColor3f(0,0,1); glVertex3d(0,0,-10); glVertex3d(0,0,100); glEnd(); The output was something like that: __|__________ ...| ...| ...| ...| ...| <Don't care about the dots. I only put them because spaces are removed in the threads> That means that the +ve Y axis looks downwards, while the X and Z axes are as expected. Did I make any wrong assumptions?
  8. tonysameh

    Never learn games programming!

    OH! You guys are really wonderful. Your replies are the best ones I got among all my posts in all forums. I wanted to reply to each one of you but I'll waste a lot of time. I need it after you all gave me a lot of energy to continue reading my OpenGL book. Thanks for every one, really.
  9. tonysameh

    Never learn games programming!

    Quote:Original post by Samuelson And you listen to them? Who cares what their opinion on what you should/shouldn't do is, it's easy for them to make decisions for you because they don't have to live with the consequences, just ignore them and go for whatever you want. If you work hard enough, you will definitely get it, full stop. I have to get an advice from someone. And every time I get convinced with an opinion, I find 1000 people proving it to be wrong. Frustrating.
  10. You should never learn games programming You should never start learning DirectX.. It's very complicated and works only on Windows.. OpenGL is multi platform and simpler. You should never start learning OpenGL.. It's only used in rendering and you can never use it for sound, input and networking (like DirectX). Never switch back to DX, remember the comlexity and the single platform issues.. Actually you should never start learning any low level graphics API. Are you re inventing the wheel or what? Get an engine and start using it. You should never start using SDL, it's only 2D You should never start using ORGE3D. It is only a rendering engine. You should never use any engines because you should understand the low level concepts of graphics before developing something big.. Noo. Don't think again about DX and OGL.. They are low level, they are hard to learn and you have to write 100s lines of codes to draw a sqaure. You better do nothing. That what I got from people few months after deciding to start learning games programming. That I should not do this step. I have to stay as I am, developing boring applications and never try to do something I like.
  11. Hi, Which of the two functions should be used in animation? Is it the same to use glutTimerFunc or glutIdle and sleeping inside it? Thanks
  12. I drew a line in XY plan parallel to the X-axis (horizontal line). When increasing the its width with glLineWidth, is it expected to get thicker in the XY plan only or in the XYZ plan? By other words, did it become a 2D rectangle or a 3D cuboid?
  13. Quote:Original post by Antheus So that you can associate context with callback. The int will be passed to callback function. Third parameter can be anything - only you know what it means. Example:void callback(int value) { switch (int) { case 1 : printf("Hello"); case 2 : printf("World"); } }; ... glutTimerFunc(100, callback, 1); glutTimerFunc(200, callback, 2);Here, same function is used, different parameter will be passed. This is common idiom for asynchronous invocation, where the caller will be long gone when the callback is invoked. OK thanks a lot. I was a little confused as I thought this parameter is part of the timing. You made it clear that it is only used to pass any information to the callback.
  14. The first argument is the "to be slept" time and the second is the pointer to the callback function. But why do I have to provide another integer to this callback function, which is the third argument in glutTimerFunc?
  15. My text book said that some openGL distributions will still draw square points after this line. It looks like that's my case. Now how can I upgrade my distribution (or version)? I used the following lines: glPointSize(6); // Points are n pixels in diameter glEnable(GL_POINT_SMOOTH); glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBegin(GL_POINTS); glVertex2f( 1.0, 1.0 ); glVertex2f( 2.0, 1.0 ); glVertex2f( 2.0, 2.0 ); glEnd();
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!